Data Driven Testing


Steps for Data Driven Testing using ITKO-Lisa:

Starting LISA
·         Go to  Start menu and select Programs->LISA-> LISA Workstation
        




·         Once you start LISA, you will be asked to select the registry. You can choose local registry or connect to a server. Local registry will start the local application server, which resides under LISA_HOME>\webserver folder.

    


·         Click OK to enter the LISA Workstation and you see the below screen which you will see when you open the LISA Workstation.




·         In Project tree, right click the on Tests folder and select create new test case as shown below:
        
  •        You will get a pop-up window in which you can browse to the directory where you want to  save the Test Case and enter the name of the new Test Case:




                    

·         Click save and the test case editor would be opened as displayed below
         

·         The Test Case Editor is divided into three parts:
Ø  Project Tree – This section provides you a tree structure of the projects, test cases, suites, Configurations etc
Ø  Model Editor – This section is more like the work area where the various steps are created to come up with a test case
Ø  Element Tree – This sections helps you add define functions for the steps added within the model editor. For example, provides an option to retrieve a particular tag in the webservice response.




·          Steps can be added in the below mentioned ways:
Ø  From the main menu, click on Actions > Create a New Step
Ø  Go to Test Case toolbar and Click on the Add Step icon
·         By clicking on the Add Step button; a panel will get opened where all the common Test Steps are being listed.


                       
·         There a various ways in which a webservice can be tested using LISA. For the example we will choose a Webservice Execution step.
·         After adding Web service Request step; double click on the stepthis will open its step editor.       
·         Provide the end point URL of the Web service in “WSDL Server URL” section.

·         Paste your Raw XML request in the Web Service request section       

 Parametrizing the request & adding data Set
Parameterizing is very important, especially when it comes to Data Driven testing as test should contain various data inputs. In order to achieve this, each web service request should be parameterized and the dataset added to ensure same request is executed with multiple sets of test data for better test coverage. This will be your input excel file.
Parameterizing the request
Ø  Enclose all the tags which needs to be parameterized in {{ }} braces.
Ø  Create an Excel having all the tag names which need to be parameterized as the column; with a set of values and save this excel on to your machine.

1.    Email Address= Input test data.
2.    Iteration= Test Cycles.
3.    Reportsfoldername= Folder name where you want to save request and response files and test results.



·         To Add dataset in to your Test Step
Ø   Click on the Data Sets tab in the right panel in order to expand it.

                              

Ø  Click on the Add icon in the Data Sets tab, to open the Data Set panel where all the Common Data Sets are being listed in LISA as shown below:
                              




Ø  Select the option “Read rows from Excel file”. This will open the below window


     
Ø  Browse to the directory where you have store the Excel file.
Ø  Click on Test and Keep. If the configuration is successful you will receive a success message.

Add another Data sheet for comparing expected test results.





·         Add a Java script step Adds in modelà Java Script Step to set test execution status based on validation. This script case is re usable for any test case, variables needs to be changed.
E.g. If Extracted response using xpath matches expected data in the above sheet, set test case status to pass or else fail.

          

// This Beanshell script should return a boolean result indicating the assertion is true or false
//Script to set a property based on the outcome of comparison between actual and expected outcome

boolean bEFlag,bVFlag
bEFlag=false;
bVFlag=false;
//Initialize the status variables to failed outcome
testExec.setStateValue("Email_Validation","MISMATCH");
testExec.setStateValue("ValidValue_Validation","MISMATCH");
testExec.setStateValue("TESTCASE_VALIDATION","FAILED");


if ("{{Email}}"=="{{ValidEmail}}")
            {
            bEFlag=true;
            testExec.setStateValue("Email_Validation","PASSED");
            print("Email validated....");
            }

if ("{{EmailValue}}"=="{{ACTEmailValue}}")
            {
            bVFlag=true;
            testExec.setStateValue("EmailValue_Validation","PASSED");
            print ("EmailValue validated....");
            }

           
return bFlag;


End of Java Script step.

                                           

                                      Report Execution Status

Ø  Once Validation Step is completed, add write properties to file step under Utilitiesà Write Properties to File.





Ø  Define variables, adjust the sequence as desired.


      

Ø  When the test case execution is completed.
Ø  Go to desired folder REPORTS1 created on your local machine.
    Ø  Request, Response and Test Case execution results will be stored .
     Ø  Test Execution file will have a detailed test result for each data field, if all the values are matching for a test case, test case status will be updated to pass, and if any value is mismatching a test case status will be marked as failed.


 Post Implementation Benefits:

       Dynamic test data generation facility
       Easy to extend the approach for incorporating   load/stress testing needs.
       Permit higher reuse of  commonly used validation steps – first step towards reusable function libraries
       Enhanced test report customization capabilities not provided by ITKO LISA tool.
       Reduction in time required for scripting and test execution.
       Approximately 50% effort savings considering 3 cycles of execution.
       Test results are captured in excel format during run can be further enhanced to come out with JCP specific test result layouts.
       Around 50% effort savings compared to manual testing.



4 comments:

  1. When I was trying to Run Test Suite locally, getting below System error message as "Failed to load suite editor". Please help me.

    ReplyDelete
  2. can i use this for SQL codes also? In that case whole testing data have to be in excel sheet or we have any method to connect software with database?

    ReplyDelete
  3. How would I be able to read a data that is at 7th row in my excel sheet?
    If anyone could help me.

    ReplyDelete
  4. Use a java scripted step where you can set counter Value as 7.

    ReplyDelete