Prerequisite : All previous selenium framework creation steps starting from STEP 1 to STEP 10 should be Implemented.
Right now we are at the middle of selenium Webdriver software automation framework creation process. Now next step Is to Implement software automation test suite skipping functionality In selenium data driven automation framework.
Why Need Test Suite Skip Function?
Supposing you are testing software web application and you have created 10 different software test automation suites for your application. But at any specific stage, You wants to execute only 3 software test suites from 10 test suites. In this condition, Your selenium automation framework should have a facility to run only selected 3 test cases. Remaining 7 software test automation suites should skiped from execution.
How To Skip Test Suites From Execution
For skipping test suites from execution, We have to add some code In both software automation test suite's base files and we have to set "SuiteToRun" = "N" (against the test suite you wants to skip) In TestSuiteList.xls file. So code of SuiteOneBase.java and SuiteTwoBase.java files will check the "SuiteToRun" flag for that specific test case In "SuitesList" sheet of TestSuiteList.xls file.
Skip "SuiteOne" Suite From Execution
So let's consider, You wants to skip "SuiteOne" from execution and you wants to execute only "SuiteTwo" suite In our automation framework. For that you needs to set "SuiteToRun" = "N" for "SuiteOne" In "SuitesList" sheet of TestSuiteList.xls file as bellow.
I have updated SuiteOneBase.java and SuiteTwoBase.java files and also updated TestSuiteList.xls file accordingly to skip "SuiteOne" from execution. You can download all three file's zip folder by clicking on bellow given link.
Extract the zip folder after downloading It. You will get bellow given three files from It. Replace them with existing files of "WDDF" project In Eclipse as described bellow.
(Note : It should replace existing file when paste It on package. It should not Insert new file.)
- Paste TestSuiteList.xls File on com.stta.ExcelFiles Package.
- Paste SuiteOneBase.java File on com.stta.SuiteOne Package.
- Paste SuiteTwoBase.java File on com.stta.SuiteTwo Package.
Now run your testng.xml file by right clicking on It as described In previous post and verify testng result and console result.
Testng result will looks like bellow
So we achieved our goal of skipping "SuiteOne" from execution. Now supposing you wants to skip "SuiteTwo" from execution. To do that, You just need to set "SuiteToRun" = "Y" for "SuiteOne" and "SuiteToRun" = "N" for "SuiteTwo" In "SuitesList" sheet of TestSuiteList.xls file. It will execute only "SuiteOne" and skip "SuiteTwo" execution.