A Primer in Software Testing

Software testing is a field that gained currency in late 90s and 00’s for different reasons. As people moved from client server to web applications, it got a new life as software systems will behave differently. Software testing was re-invigorated with Web 2.0. Subsequently it was in focus again with mobile applications and tailoring user experience for mobile devices. Lately, focus on software testing is again on the go with new architectural patterns including micro services architecture. Model driven testing and behavior driven development have been other testing approaches that have influenced the overall industry. Today, cloud based applications (such as Salesforce) that can scale on-demand and cloud based storage are in vogue; these require not-so-different test practices.

While testing has taken different shapes and forms, the underlying approach to testing remains somewhat unchanged. The following blog gives a structured approach to looking at testing. Understand the business domain. Identify the actors in the domain who would want to achieve certain goals. An orchestration of multiple actors trying to achieve various goals would form an end-to-end business process. In every use case, one can identify the basic/main flow, alternate flows and exception/failure flows. In these flows, we start with identifying the business rules behind. After this, the input and output conditions are studied in depth. Prior to identifying test data and test cases, data domains are identified.

 

Gmail Login

Identify the business rules

Say the business rule is: Allow login when user account is valid, active and password is valid. Now, expand this business rule to interpret the following:

  • Bring captcha image when the password does not match for 3 continuous attempts
  • If user account is inactive, allow user to activate account
  • Otherwise, do not allow user to login

Identify the input and output conditions

Input conditions S1 S2 S3 S4 S5 S6 S7
User account valid Y Y Y Y N Y Y
User account active Y N Y Y X Y Y
Password matching Y X N N X Y Y
Password not matching for continuous 3 times NA NA Y N X NA NA
Captcha image matches NA NA NA NA X N Y
Output conditions
User authenticated and Inbox opens * *
User prompted with a failure message * * *
User account re-activation message *
User prompted with a captcha image *

 

Identify data domains

Data domains, generally speaking, are for the fields that are visible in the UI. Note some exceptional cases:

  • Not always do we need not identify data domains for all fields in the UI
  • Sometimes, data domains have to be identified for some precondition fields as well

 

Scenario S1:

User name size = {smallest, longest, anything in-between)

User name characters / content = {Starts with alphabet, starts with number}

Password size = {smallest, longest, anything in-between)

Password characters / content = {Starts with alphabet, starts with number, starts with spl character}

User account active = {Account becomes inactive if not accessed today, Account was accessed only 5 days back, Account is created only today, Account created yesterday}

 

Identify test cases

Scenario S1:

Precondition: Username and corresponding password already exists

Test description: For valid user name and password, the system logs in and shows the Inbox

Test steps: Enter username. Enter password. Click on Login button.

Note that pairwise technique is used to identify the test data.

Test data Expected Result
Username: A1234567

Password: x123456$

Account becomes inactive if not accessed today

User allowed to log-in
Username: Z1234567A1234567

Password: 123456×123456$er

Account was accessed only 5 days back

User allowed to log-in
Username: ShruthiN

Password: #x123456$

Account is created only today

User allowed to log-in
Username: 7KabilanG

Password: #x123456$

Account created yesterday

User allowed to log-in

 

MakeMyTrip.com – Search for flights

Book flights use case with the following steps:

  • Search for flights
  • Select a flight
  • Review selection
  • Travelers and payment
  • Booking confirmation

 

For Search for flights, a partial breakdown of the test requirements would be as follows:

  • Book One way Vs Return Trip
  • Multi-city
  • Check Flight Status
  • View flight results
    • Grid layout
      • Flights listed where there is availability
      • Show All / Filtering of results on clicking of
        • Time
        • Airline
        • Price
      • Form layout
        • Previous Day / Next Day
        • See all results / No. of results per page
        • Flights listed where there is availability
          • Flight route determination and Total fare calculation
          • “Hurry! Few seats left” message logic
          • Reduced airfare display

 

Identify the business rules

Say the test requirement is: Flights listed where there is availability.

Now, expand this to underline the business rules:

  • List of flights is provided based on information available in the flights master database
  • Flights Master database gets data refreshed once in 5 minutes as the system receives data from different airline providers
  • For the given date of travel, if number of seats available is greater than or equal to the seats requested, then show the flight in the listing
  • If no flight is available, a suitable error message should be displayed
  • On the flights that are displayed, further filters can be set on a combination of the following:
    • Grid display
      • Clicking on airline
      • Clicking on the price
      • Clicking on the time
    • Filter your search sidebar
  • Appropriate fare rules get calculated and displayed along with the displayed flights
  • When only a few seats are left out, Hurry, few seats are left – message is to be brought
    • When only 15 seats are left out, display the message.

 

Identify the input and output conditions

Let us focus on what gets displayed when Search Flights is done.

Input conditions S1 S2
Number of passengers requested <= Number of seats available Y N
Output conditions
Flight is displayed *
Flight not displayed *

 

Identify data domains

Scenario S1:

Number of seats available = {All, No. of passengers, No. of passengers + 1, No. of passengers + 6)

 

Scenario S2:

Number of seats available = {None, No. of passengers – 1, No. of passengers – 6)

 

For both Scenario 1 and Scenario 2:

Type of passengers requested = {All adults, Adults + Children, Adults + Children+ Infant, Adults + Infant)

No. of passengers requested = {1, 6, 3}

No. of flights matching the required needs = {1, Maximum display per page, Maximum display per page + 1, 5, 10}

Names of airlines matching the required need = {Only one airline, all airlines supported, at least three airlines}

 

Identify test cases

Scenario 1 and Scenario 2 combined

Assuming there are only four airlines – Kingfisher Red, Kingfisher Class, Jet Konnect and Go Air. Assume 100 is the maximum number of seats in all flights.

Get the total number of times the test has to be conducted

Passenger mix Total passengers
Passengers 1A, 5A, 3A+1C, 2A+1C+1I, 1A+2I, 6A, 1A+1C 1, 5, 4, 4, 3, 6, 2
# airlines that match the need 1, 4, 3

 

Test case 1:

Pre-condition –

Airline # Seats available
Kingfisher Red 100
Kingfisher Class 0
Jet Konnect 0
Go Air 0

Requested passengers: 1A

Expected result –

Listed flights
Kingfisher Red

 

Test case 2:

Pre-condition –

Airline # Seats available
Kingfisher Red 4
Kingfisher Class 5
Jet Konnect 6
Go Air 11

Requested passengers: 5A

Expected result –

Listed flights
Kingfisher Class
Jet Konnect
Go Air

 

Test case 3:

Pre-condition –

Airline # Seats available
Kingfisher Red 4
Kingfisher Class 5
Jet Konnect 6
Go Air 10

Requested passengers: 3A+1C

Expected result –

Listed flights
Kingfisher Red
Kingfisher Class
Jet Konnect
Go Air

 

Other test cases:

Still to be covered are test cases when passengers requested are: 4, 3, 6 and 2

 

MakeMyTrip.com – “Hurry! Few seats left”

For Search for flights, a partial breakdown of the test requirements would be as follows:

  • View flight results
    • Grid layout
      • Flights listed where there is availability
      • Show All / Filtering of results on clicking of
        • Time
        • Airline
        • Price
      • Form layout
        • Previous Day / Next Day
        • See all results / No. of results per page
        • Flights listed where there is availability
          • Flight route determination and Total fare calculation
          • “Hurry! Few seats left” message logic
          • Reduced airfare display

 

Identify the business rules

Now, expand this to underline the business rules:

  • When only a few seats are left out, Hurry, few seats are left – message is to be brought
    • When only 15 seats are left out, display the message.

 

Identify the input and output conditions

Input conditions S1 S2
Number of seats available <= 15 Y N
Output conditions
Hurry, few seats are left – message is displayed in flight details *
Hurry, few seats are left – message not displayed in flight details *

The above data domains can be included to test conditions under section MakeMyTrip.com – Search for flights

NB: Include as many business rules as possible into a single test. This will reduce the number of times a test has to be conducted. The idea will be: Conduct a test with suitable test data; identify as many things as possible simultaneously.

 

Input conditions S1 S2 S3 S4
Number of passengers requested <= Number of seats available Y N Y N
Number of seats available <= 15 N NA Y NA
Output conditions
Flight is displayed * *
Flight not displayed * *
Hurry, few seats are left – message is displayed in flight details *
Hurry, few seats are left – message not displayed in flight details *

 

 

Identify data domains

These data domains are in addition to the ones already identified under section MakeMyTrip.com – Search for flights

 

Scenario S1:

Number of seats available = {All, Valid number between 5 and 15, 15-1, 15)

 

Scenario S3:

Number of seats available = {0, 15+1, Valid number between 15 and full availability of flight)

 

Identify test cases

The above data domains can be included to test cases under section MakeMyTrip.com – Search for flight

Kabilan Giridharan

Over 20 years experience in leading product engineering and quality software delivery for business-critical enterprise applications. Expertise in agile digital transformation and business process re-engineering.
Posted in Agile, Software Testing.

Leave a Reply

Your email address will not be published. Required fields are marked *

*