October 4, 2016

Software Development Life Cycle (SDLC)

What is SDLC?

                There are various software development approaches defined and designed which are used during development process of software, these approaches are we normally called as “Software Development Process Models” (e.g. Waterfall model, incremental model, V-model, iterative model, RAD model, Agile model, Spiral model, Prototype model etc.). Each process model follows a particular life cycle in order to ensure success in the process of software development.
Software life cycle models describe phases of the software cycle and the order in which those phases are executed. Each phase produces deliverables required for the next phase in the life cycle. i.e., the output of one phase will be the input for the next phase. For example once the requirements are collected we start the design phase and once the design phase is completed we will start developing/Code the application. Once the code is developed it will be assigned to the tester to test the application. If everything is properly developed we will deploy the code.
There are six phases in every Software development life cycle model:
  1. Requirement gathering and analysis
  2. Design
  3. Implementation OR coding
  4. Testing
  5. Deployment OR Installation
  6. Maintenance


 Requirement gathering and analysis
Business requirements are gathered in this phase. This phase is the main focus of the project managers and stake holders. Meetings with managers, stake holders and users are held in order to determine the requirements like: who is going to use the system? How will they use the system?  What data should be input into the system?  What data should be output by the system?  These are general questions that get answered during a requirements gathering phase. After requirement gathering these requirements are analyzed for their validity and the possibility of incorporating the requirements in the system to be development is also studied.
Output: Requirement Specification document is created which serves the purpose of guideline for the next phase of the model
Design
In this phase the system and software design is prepared from the requirement specifications which were studied in the first phase. System Design helps in specifying hardware and system requirements and also helps in defining overall system architecture.
Output: The system design specifications serve as input for the next phase of the model.
In this phase the testers comes up with the Test strategy, where they mention what to test, how to test.
Implementation / Coding
On receiving system design documents, the work is divided in modules/units and actual coding is started. Since, in this phase the code is produced so it is the main focus for the developer. This is the longest phase of the software development life cycle.
Output: Developed code/system as per the requirements in the system design and FRD for that release
Testing
After the code is developed it is tested against the requirements to make sure that the product is actually solving the needs addressed and gathered during the requirements phase. During this phase all types of functional testing like unit testing, integration testing, system testing, acceptance testing are done as well as non-functional testing are also done.
Output: Feedback on the developed code. Here there are two directions.
  • One is if the requirements are satisfied and the application is behaving as it is intended to then it will deployed to the production
  • Second is if many of the requirement are not satisfied or the application is not behaving as it is expected then it will be go the Coding phase
Deployment
After successful testing the product is delivered / deployed to the customer for their use.
As soon as the product is given to the customers they will first do the beta testing. If any changes are required or if any bugs are caught, then they will report it to the engineering team. Once those changes are made or the bugs are fixed then the final deployment will happen.
Output: End user experience on the deployed system, if he is facing any problem it will go to Maintenance Phase
Maintenance

Once when the customers starts using the developed system then the actual problems comes up and needs to be solved from time to time. This process where the care is taken for the developed product is known as maintenance.

Please find the below article to learn about the Agile software development guide 

Software Testing Life Cycle (STLC)

What is Software Testing Life Cycle (STLC)
Software Testing is not a single activity. It consists of several activities carried out in a systematic way to deliver an efficient software product. All these Activities /Phases constitute STLC.

Below are the Activities /Phases of STLC:
  1. Requirements Gathering phase
  2. Test Planning Phase
  3. Test Case Development Phase
  4. Environment Setup Phase
  5. Test Case Execution Phase
  6. Test Conclusion Phase
  7. Test Cycle Closure Phase
Each of these activities have a definite Activities & Deliverables associated with it

1. Requirement Phase: During this phase of STLC, we will analyze and study the requirements. Here in this phase we will discuss with stakeholders to understand the requirements clearly and try to find out whether the requirements are testable or not. This phase helps to identify the scope of the testing. If any feature is not testable, communicate it during this phase so that the mitigation strategy can be planned.
Activities
o    Identify types of tests to be performed (Smoke, Sanity, Regression and Automation testing etc.,).
o    Prioritize the requirements.
o    Prepare Requirement Traceability Matrix (RTM).
o    Identify test environment details where testing is supposed to be carried out.
o    Automation feasibility analysis (if required).
Deliverables 
o    RTM
o    Automation feasibility report. (if applicable)
2. Test Planning Phase: Infact, Test planning is the first step of the testing process. In this phase we identify the activities and resources which would help to meet the testing objectives. Typically this will done by Sr. QA Manager.
Activities
o    Preparation of test plan/strategy document for various types of testing
o    Test tool selection
o    Test effort estimation
o    Resource planning and determining roles and responsibilities.
o    Training requirement
Deliverables 
o    Test plan /strategy document.
o    Effort estimation document.
3. Test Case Development PhaseThe major task in this STLC phase is of creation of the detailed test cases. Prioritize the test cases also identify which test case will become part of the regression suite. Before finalizing the test case, It is important to carry out the review to ensure the correctness of the test cases. And it is also important to take the confirmation of the the test cases created before the actual execution starts. If automation testing is required, identify the test cases for automation and proceed for scripting the test cases and make sure that you sent them fro review and got confirmation.
Activities
o    Create test cases, automation scripts (if applicable)
o    Review and baseline test cases and scripts
o    Create test data (If Test Environment is available)
Deliverables 
o    Test cases/scripts
o    Test data
4. Test Environment Setup PhaseTest environment includes software and hardware conditions under which product is to be tested. Test environment set-up is one of the critical aspects of testing process and can be done in parallel with Test Case Development Stage. Test team may not be involved in this activity if the customer/development team provides the test environment. In this case test team is required to do a readiness check (smoke testing) of the given environment.
Activities 
o    Setup test Environment and test data
o    Perform smoke test on the build
Deliverables 
o    Environment ready with test data set up
o    Smoke Test Results.
5. Test Execution PhaseDuring this phase test team will carry out the testing based on the test plans and the test cases prepared. Bugs will be reported back to the development team for correction and once the bug is fixed by the development team, retesting/regression will be performed.
Activities 
o    Execute tests as per plan
o    Document test results, and log defects for failed cases
o    Map defects to test cases in RTM
o    Retest the defect fixes
o    Track the defects to closure
Deliverables 
o    Completed RTM with execution status
o    Test cases updated with results
o    Defect reports
6. Test Conclusion Phase: This phase concentrates on the exit criteria and reporting. We've to know the reporting persons. Depending on your project and stakeholders choice, you can decide on reporting whether you want to send out a daily report or weekly report etc.
There are different types of reports
o    DSR – Daily status report
o    WSR – Weekly status reports
The important point is, the content of the report changes and depends upon whom you are sending your reports.
o    If you are reporting to Project managers belong to testing background then they are more interested in the technical aspect of the project, so include the technical things in your report ( number of test cases passed, failed, defects raised, severity 1 defects etc.).
o    If you are reporting to upper stakeholders, they might not be interested in the technical things so report them about the risks that have been mitigated through the testing.
Activities
o    Provide the accurate figures and result of testing
o    Identify the risks which are mitigated
Deliverables 
o    Updated Taceability Metrics
o    Test Status report
o    Risk management report
7. Test Cycle Closure Phase: Testing team will meet , discuss and analyze testing artifacts to identify strategies that have to be implemented in future, taking lessons from the current test cycle.
The following are the tasks for the Test Closure:
o    Check for the completion of the test. Whether all the test cases are executed or mitigated deliberately. Check there are no severity 1 defects opened.
o    Do lessons learnt meeting and create lessons learnt document.( Include what went well, where are the scope of improvements and what can be improved)
Activities
o    Evaluate cycle completion criteria based on Time,Test coverage,Cost,Software,Critical Business Objectives , Quality
o    Prepare test metrics based on the above parameters.
o    Document the learning out of the project
o    Prepare Test closure report
o    Qualitative and quantitative reporting of quality of the work product to the customer.
o    Test result analysis to find out the defect distribution by type and severity.
Deliverables 
o    Test Closure report
o    Test metrics

September 2, 2016

Cucumber Basics

Cucumber Basics:


There are few terminologies in cucumber. Let's understand them

Feature Files

Feature files are the files which are used to write the test automation steps in Gherkin language. Normally this will be live document. The extension of these files will be .feature.

A Feature file will contain much number of Scenarios. Each scenario represents a test case. In Each Scenario there are Steps which are differentiated by keywords called (GIVEN, WHEN, THEN etc.,)

Feature:

This gives information about the high level business functionality and the purpose of Application under test. Everybody should be able to understand the intent of feature file by reading the first Feature step.

Scenario:

Basically a scenario represents a particular functionality which is under test. By seeing the scenario user should be able to understand what the test is all about. Each scenario should follow given, when and then format. This language is called as “gherkin” language.
·         Given: As we know the meaning of given, it  specifies the precondition.
·         When: This is used when some action is to be performed.
·         Then: The expected outcome or result should be placed here.
·         Background: Whenever any step is required to perform in each scenario then those steps needs to be placed in Background.
·         And: And is used to combine two or more same type of action. i.e., if you have multiple prerequisites, then we have the combine all the GIVEN statement by using "AND" keyword.
Basic template for a FEATURE file:
Feature: <Description of the Feature>

Scenario: <Scenario 1>
                Given <Prerequisite>
                When <Actions be be performed>
                Then <Expected Result>

Scenario: <Scenario 2>
                Given <Prerequisite>
                When <Actions be be performed>
                Then <Expected Result>             
EX:
Feature: Login Functionality Feature
                In order to ensure Login Functionality works,
                I want to run the cucumber test to verify it is working

Scenario: Login Functionality
                Given user navigates to www.facebook.com
                When user logs in using Username as “USER” and Password “PASSWORD”
                Then login should be successful

Scenario Outline:

Scenario outlines are used when same test has to be performed with different data set. Ex: if we want to test login functionality with multiple different set of username and password.
Let's take the same example to show the usage of Scenario Outline
Feature: Login Functionality Feature
                In order to ensure Login Functionality works,
                I want to run the cucumber test to verify it is working

Scenario Outline: Login Functionality
                Given user navigates to www.facebook.com
                When user logs in using Username as <username> and Password <password>
                Then login should be successful

Examples:
|username|password|
|Suresh|password1|
|Naresh|password12|

Observations:

  • Column names (username and password) are passed as parameters to WHEN statement.
  •  Scenario Outline is used instead of Scenario
  • EXAMPLES are used to pass different arguments in tabular format. Vertical pipes are used to separate the columns

Tags:

Cucumber by default runs all scenarios in all the feature files. In real time projects, there could be hundreds of feature file which are not required to run at all times. We can also use multiple tag names for a single feature.

For instance: Feature files related to smoke test need not run all the time. So if you mention a tag as smokeTest in each feature file which is related to smoke test and run cucumber test with @SmokeTest tag. Cucumber will run only those feature files specific to given tags. Please follow the below example. You can specify multiple tags in one feature file.
Let's take the same example to show the usage of Scenario Outline
@SmokeTest @RegressionTest
Feature: Login Functionality Feature
                In order to ensure Login Functionality works,
                I want to run the cucumber test to verify it is working

Scenario Outline: Login Functionality
                Given user navigates to www.facebook.com
                When user logs in using Username as <username> and Password <password>
                Then login should be successful

Examples:
|username|password|
|Suresh|password1|
|Naresh|password12|
Tags can be applied to Scenarios, Please see the example below
@SmokeTest @RegressionTest
Feature: Login Functionality Feature
                In order to ensure Login Functionality works,
                I want to run the cucumber test to verify it is working

Scenario Outline: Login Success Functionality
                Given user navigates to www.facebook.com
                When user logs in using Username as <username> and Password <password>
                Then login should be successful

Examples:
|username|password|
|Suresh|password1|
|Naresh|password12|

@SmokeTest
Scenario Outline: Login Failure Functionality
                Given user navigates to www.facebook.com
                When user logs in using Username as <username> and Password <password>
                Then login should be successful

Examples:
|username|password|
|Rajesh|password1|
|Mahesh|password12|

Observation: 

  • Suppose you want to execute the scenarios/features which are in Regression Suite, then the Junit Runner will execute only "Login Success Functionality" Scenario
  • Suppose you want to execute the scenarios/features which are in Smoke Suite, then the Junit Runner will execute only "Login Success Functionality" and "Login Failure Functionality" Scenarios

Junit Runner:

Cucumber Runner / JUNIT Runner Class is the class, which is used to get all the feature files in the specified location.
The Basic Template of Junit Runner is  as follows:
@RunWith(Cucumber.class)  
@CucumberOptions (
                format(deprecated)/plugin={"pretty","json:target"} ,
                features = {"src/java/features/"}
                )
public class Runner {
}

Observations:

  • Cucumber.class : Whenever we run anything as part of cucumber it iwll run using the cucumber.class file
  • CucumberOptions: it is used to provide some additional inputs like, format, feature files location and tags
Example:
@RunWith(Cucumber.class)  
@CucumberOptions (
                format(deprecated)/plugin={"pretty","json:target"} ,
                features = {"src/java/features/"},
                tags={"@SmokeTest", "@RegressionTest"}
                )
public class Runner {
}
Note: To run the specific feature file cucumber uses standard Junit Runner and specify tags in @Cucumber. Options(Deprecated)/@CucumberOptions. Multiple tags can be given by using comma separate. Here you can specify the path of the report and type of report you want to generate.

If you run this Runner file, all the Scenarios/features under SmokeTest/RegressionTest will be executed and the result be generated in JSON format.

Trouble Shootings:

If you get the Invocation Target Exception, then you have to remove Cucumber-spring.jar from the build path
If you ran the feature file but it threw an error like this:
                Exception in thread "main" cucumber.runtime.CucumberException: Unknown option: --plugin
                 at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:119)
                 at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:50)
                 
then you have to update the jar files to latest version
If you are not able to import the "@Cucumber.Options" and it is throwing error, the use "@CucumberOptions" instead of "@Cucumber.Options" (Deprecated)
If you are getting the below exception
Exception in thread "main" Usage: java cucumber.api.cli.Main [options] [ [FILE|DIR][:LINE[:LINE]*] ]+

Then use the version 1.2.4 for cucumber-Java, Cucumber-Junit and Cucumber-core jars. user version 2.12.2 for gherkin
                change the code as below:
                                @CucumberOptions(
                                 plugin = {"pretty","jason:Target/"},
                                 features = {"src/Cucumber/"}
                                )