STEP 14
Prerequisite : STEP 1 to STEP 13 of creating data driven framework for selenium webdriver software testing tool should be Implemented.
If you know, we need very custom data driven framework for selenium webdriver where you can skip specific software test suite, specific test case or specific data set line too from your software test execution whenever required.
Till Now, We have Implemented software test suite and test case skip facility In data driven framework of selenium webdriver. Now this Is the time to Implement skipping specific test data set line facility In our selenium webdriver automation framework.
Why Need Test Data Skip Function?
Supposing you are testing a software web application log in form to check validations on form fields using different 10 data set combinations. Now at specific point, You wants to test form using only 5 main data set combinations. In such condition, Your framework should have a facility to skip selected test data set lines.
How To Skip Test Suites From Execution
Here we will use "checkToRunUtilityOfData" function of SuiteUtility class In @BeforeTest method to retrieve "DataToRun" flags of all data set lines from software test case data sheets. And then Inside @Test method, If found "DataToRun" = "Y" for specific data set line then remaining test will be executed using that specific data set. And If "DataToRun" = "N" or blank for specific data set line then remaining test will be skipped using testng SkipException and then It will check "DataToRun" flag for next data set.
Skip Test Data Set From Execution
Step 1 :
For skipping test data set, First of all set "SuiteToRun" = "Y" for both test suites and "CaseToRun" = "Y" for all four test cases and save all three excel files of data driven framework as shown In bellow Image.
Step 2 :
Set "DataToRun" as shown In bellow Image In all 4 test cases files. Then save and close all excel files.
Step 3 :
Noy you needs to modify your all 4 software test case files to Implement logic of skip data set. I have modified all four test case files. You can download them by clicking on bellow given link.
Extract the downloaded folder and past all 4 test cases files as described bellow.
(Note : It should replace existing file when paste It on package. It should not Insert new file.)
- Paste SuiteOneCaseOne.java File on com.stta.SuiteOne Package.
- Paste SuiteOneCaseTwo.java File on com.stta.SuiteOne Package.
- Paste SuiteTwoCaseOne.java File on com.stta.SuiteTwo Package.
- Paste SuiteTwoCaseTwo.java File on com.stta.SuiteTwo Package.
Running Test
Note : Before running test suite, Please make sure that your all .xls files are closed. If any file Is open then you will get an error during test suite execution.
Now we are all set to run our selenium automation framework project "WDDF" to verify results. Run your test from testng.xml file.
Whne execution get completed, Look at your testng results. It will looks like bellow.
If you see In above result, Some test data lines are executed and some of them are skipped from execution as we have set "DataToRun" = "N" against those data lines In excel data sheets. You can set "N" for other data set lines and run your software test to verify the accuracy.
No comments:
Post a Comment