Thursday, January 31, 2013

Errors when run TestNG script

Error - java.lang.IllegalStateException: Cannot get a text value from a numeric cell
at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.java:650)
at org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue(HSSFCell.java:727)
at org.apache.poi.hssf.usermodel.HSSFCell.getStringCellValue(HSSFCell.java:710)


Cause - Your java code is trying to read everything as string. So for those strings you will need to specify them as text data in excel.


Solution - Select the cell in spreadsheet, Right click on cell Select Format cells, Select Numbers > Text and Click OK.



Friday, September 28, 2012

Agile QA


With more and more teams adopting agile methodology for the application development, It is important for QA to grasp the agile methodology and to adapt in such a way to start effectively using the agile methodology for testing as well.
This article is trying to introduce the Agile Methodology to testers, and compare the differences between traditional (Waterfall) QA and agile way of testing. We go on to explore how agile methodology affects the way testing is performed, the involvement of QA and how to effectively use it to produce a Quality Product

In Agile, QA is expected to be a very proactive part of development. They no longer just certify the functionality of the application based on a contract. They have to be part of the day to day development. They ensure quality at all levels and act as a communication hub between the business, management and developers.
One of the main challenges for a QA team is that the necessary skills required to perform their job effectively becomes exponentially increased. They need to understand the code, write their own automated suite cases, perform exploratory testing and suggest new ideas.
The frontiers of QA, in Agile, are a blur, because they share the same objective as developers and managers- to create the best application for the customer. They don’t care about contract documents. And an important source of misunderstanding for new QA Agile teams transitioning from waterfall, is to find that there aren’t any specifications or guides to tell them how to certify a specific functionality.
When talking about QA in Agile, one of the most common arguments I have heard is that QA is not ready to perform all the activities they are supposed to be performing in agile successfully. While for some people this may seem an issue or a threat, I see it as an opportunity for change.

As team adopt Agile methodology and QA become part of agile development process, QA will not be considered as separate part of software development team.

Testing in Waterfall and Agile

In old system, Tester is testing implementation by developer according to test cases he created however he is not sure that test meets the customer requirement or not, Tester needs approval from customer whether or not assumption made by him are adequate or correct. Feedback as to success or failure of a requirement, implementation is delayed.



In Agile methodology, the developer, has run through the acceptance tests that Customer, Developer and Tester created prior to Development team starting implementation. Tester quickly runs through the same acceptance tests and then starts doing more testing to get a feeling for how the implementation fits into the entire workflow. At the review the next morning, Customer agrees that the story is complete.



In Agile testing method developer and tester work as a pair to understand and implement what Customer(product owner, business analysts, and subject matter experts) needs.
The development focus is to create an implementation that does what it is supposed to do.
The testing focus is to check that the implementation does precisely that and does not do what it should not.
Customer tests encompass the business facing functional tests that ensure the product is acceptable to the customer

The three basic units in a software project are
the customer unit,
the developer unit, and
the testing unit.

The customer unit (which may include product owner, business analysts, and subject matter experts) determines the requirements, creates acceptance tests, and sets priorities.

The developer unit implements the requirements and ensures the implementation meets the acceptance tests.

The testing unit checks that an implementation does what it is supposed to do and does not do what it is not supposed to do. The testers help the customer unit develop acceptance tests, and the developer unit passes those tests. The triad works together to produce quality software.

Role of QA in Agile Development

In Agile development Developer runs unit test. If other developers merge their code to built integration platform. Developers run component test to see that when integrated, other developer code do not affect outcome of his code. Also developer need to run acceptance test to verify that his code meet the acceptance requirement.

Agile QA need to know developers and interact with the team in professional way. Also work closely with customer to define acceptance test for each story.
The Agile QA completes the requirement gathering in the form of test cases and once there is enough to be tested, verify these features meet the requirement specified.
Agile QA have to run all the tests, verify that built meets acceptance criteria, but often unit test are not run by tester and tester focus more on Exploratory testing, Usability testing and Property testing of the built.

Once the customer is satisfied with outcome of all test run, the built is deployed to the production platform. There is possibility that user may do unexpected behavior which may uncover the bug not face by Tester. Hence Tester in Agile has responsibility of overall experience of user and should conduct Positive as well as negative tests to uncover bugs. As a QA in Agile should also focus on unexpected, unspecified, functional and non functional test. Perform all the possible scenarios and not just specified test case scope derived from Requirements.

Agile QA provides early feedback to the team. Feedback involves using current output to influence future output. Quick feedback means less delay.

Types of tests



Customer tests encompass the business facing functional tests that ensure the product is acceptable to the customer. The result of almost every acceptance test can be expressed in yes or no terms. Examples Should password field have minimum 6 characters? or In case of Forgot password, Should app ask security question?

Property test include nonfunctional requirements such as scalability, reliability, security, and performance.

Usability tests are conducted whether users feel comfortable with the application considering different parameters : the flow, navigation and layout, speed and content. You might create some factual tests, such as, “Given a certain level of user, can he pay for an order in less than 30 seconds?” or, “Given 100 users ranking the system usability on a scale from 1 to 10, is the average greater than 8?” But often, usability is more subjective: “Does this screen feel right to me?” or, “Does this workflow match the way I do things?” Usability testing is strictly manual.

Exploratory tests are tests whose flow is not described in advance [Petti- chord01]. An exploratory tester does parallel test design, execution, result interpretation, and learning. Exploratory testing may disclose defects undiscovered by other forms of testing [Whittaker01], [Bach01]. The term has also been applied to a situation in which all team members take on the persona of a user and go through the system based on the needs and abilities of that user. Because a system has to be working to be explored, these tests cannot be created up front. But they can be performed whenever the program is in a working condition.

Unit tests are created by developers in conjunction with writing code. They aid in creating a design that is testable, a measure of high technical quality. Unit tests also serve as documentation for the way the internal code works.

Component tests verify that units and combinations of units work together to perform the desired operations. As we will see later, many of the unit and component tests are derived from the acceptance tests [Wiki03].

All types of testing are important to ensure delivery of a quality product that involves collaboration between the business customer, the developer, and the tester.

Challenges in Agile Testing

Less or No Documentation : In agile we do have less documentation. Working less documentation Requirement Specification are replaced with a Product Backlog, Functional Specification are replaced with User Stories and all other documentation is created as and when it's needed. As for planning your tests, you'll be involved in the requirement analysis process where you can include your test conditions that form part of the User Story.

Moving from manual to automation : As in agile regression testing is done in every iteration. Manually repeating all the regression test in every iteration is costly and time consuming. Manual tester need to learn automation and keep regression scripts up to date.

Need to become Technical : Agile QA need to become more technical aware and learn basics about programming languages. Agile QA can help team to fix minor defect eg : typos

Pros of Agile QA

Agile QA knows performance of application sooner and hence can pay more attention on risk areas
Agile QA have time for Detail management and planning
Requirements and designs in Agile are not assumed due to constant interaction and planning with customer

Cons of Agile testing

Time span of the iteration is less and tester need to perform all types of test, continuous integration test including regression test for previous iteration code this increase workload can lead to burnout.
Testing happen on fly hence agile tester do not get time to document every move thus less documentation or no documentation may result in ambiguity.



References :
Lean-Agile Acceptance Test-Driven Development - by Ken Pugh
Agile Testing Myths -by Ray Claridge
Waterfall vs. Agile: QA and Management - Alberto Gutierrez

Friday, April 15, 2011

SQL Answers

SELECT .. GROUP BY
1a. Show the total number of prizes awarded.
A : SELECT COUNT(winner) FROM nobel

1b. List each subject - just once
A : select distinct subject from nobel

1c. Show the total number of prizes awarded for Physics
A : select count(subject) from nobel where subject = 'Physics'

2a. For each subject show the subject and the number of prizes.
A : select subject, count(winner) from nobel group by subject

2b. For each subject show the first year that the prize was awarded.
A: select subject, min(yr) from nobel group by subject

2c. For each subject show the number of prizes awarded in the year 2000.
A : select subject, count(winner) from nobel where yr = 2000 group by subject

3b. For each subject show how many years have had prizes awarded.
A : select subject, count(distinct yr) from nobel group by subject

4a. Show the years in which three prizes were given for Physics.
A : select yr from nobel where subject = 'Physics' group by yr, subject having count(subject) > 2

4b. Show winners who have won more than once.
A : select winner from nobel group by winner having count(winner) > 1

4c. Show winners who have won more than one subject.
A : select winner from nobel group by winner having count(distinct subject) > 1

5a. Show the year and subject where 3 prizes were given. Show only years 2000 onwards.
A : SELECT yr, subject
FROM nobel
WHERE yr>=2000
GROUP BY yr, subject
HAVING COUNT(subject)=3

Select JOIN
1a. Find the title and artist who recorded the song 'Alison'.
A : SELECT title, artist
FROM album JOIN track
ON (album.asin=track.album)
WHERE song = 'Alison'


1b. Which artist recorded the song 'Exodus'?
A : SELECT artist
FROM album JOIN track
ON (album.asin=track.album)
WHERE song = 'Exodus'

1c. Show the song for each track on the album 'Blur'
A : SELECT song
FROM track JOIN album
ON (album.asin = track.album)
WHERE album.title = 'Blur'

2a. For each album show the title and the total number of track.
A : SELECT title, COUNT(*)
FROM album JOIN track ON (asin=album)
GROUP BY title

2b. For each album show the title and the total number of tracks containing the word 'Heart' (albums with no such tracks need not be shown).
A : SELECT title, count(*)
FROM album JOIN track
ON(album = asin)
WHERE track.song like '%Heart%'
GROUP BY title

2c. A "title track" is where the song is the same as the title. Find the title tracks.
A : SELECT title
FROM album JOIN track
ON (album.asin = track.album)
WHERE album.title = track.song

2d. An "eponymous" album is one where the title is the same as the artist (for example the album 'Blur' by the band 'Blur'). Show the eponymous albums.
A : SELECT artist FROM album
WHERE title = artist

3a. Find the songs that appear on more than 2 albums. Include a count of the number of times each shows up.
A : SELECT song, count(asin)
FROM album JOIN track
ON (album.asin = track.album)
GROUP BY song
HAVING count(song) >2

3b. A "good value" album is one where the price per track is less than 50 pence. Find the good value album - show the title, the price and the number of tracks.
A : SELECT title, price, count(track.song)
FROM album JOIN track
ON (album.asin = track.album)
GROUP BY album.title
HAVING (album.price/count(track.song)) < 0.5

3c. Wagner's Ring cycle has an imposing 173 tracks, Bing Crosby clocks up 101 tracks.
List albums so that the album with the most tracks is first. Show the title and the number of tracks
SELECT title, count(track.song)
FROM album JOIN track
ON (album.asin = track.album)
GROUP BY title
ORDER BY count(track.song) desc

Movie Database

List the films where the yr is 1962 [Show id, title]
select id, title from movie where yr = '1962'


List all of the Star Trek movies, include the id title and yr. (All of these movies include the words Star Trek in the title.)
SELECT id, title, yr FROM movie WHERE title like 'Star Trek%'


What are the titles of the films with id 1, 2, 3
select title FROM movie where id in (1,2,3)


Obtain the cast list for the film 'Alien'
SELECT name FROM actor JOIN casting
ON (casting.actorid = actor.id)
WHERE movieid = (select id from movie where title = 'Alien')


List the films in which 'Harrison Ford' has appeared
SELECT title from movie join casting
ON (movie.id = casting.movieid)
WHERE actorid = (select id FROM actor where name ='Harrison Ford')


List the films where 'Harrison Ford' has appeared - but not in the star role.
select title from movie join casting on (movie.id = casting.movieid)
WHERE ord != 1 and actorid = (select id FROM actor where name = 'Harrison Ford')


List the films together with the leading star for all 1962 films.
select title, name from movie join casting on (movie.id = casting.movieid) join actor on (casting.actorid = actor.id) where movie.yr =
'1962' and casting.ord = 1