SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Selenium WebDriver Framework - Implementing Suite Skip Function

STEP 11
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.

11 comments:

  1. Hello,
    Please is this the last step in creating the data driven framework?
    Thanks,
    Eddie

    ReplyDelete
  2. We are at the middle of framework creation.
    Still few more steps related to reporting result and Integrating webdriver with framework are pending

    ReplyDelete
  3. Even if i give "N" inside "TestSuiteList" as SuitetoRun, it is still running all the classes. Kindly help me out

    ReplyDelete
  4. I am giving "N" against SuiteOne in SuiteToRun column inside "TestSuiteList" .xls but all classes are running. Kindly help me out.

    ReplyDelete
  5. Using @BeforeSuite annotation I am having problems as the SkipException never is thrown when matches the 'if' conditions. The exception is thrown from the DataProvider as NullPointException.
    I changed the annotation by @BeforeClass and it works pretty. But I don't think that's the best approach. Are some conditions to use @BeforeSuite annotation?
    Thanks

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Even if i give "N" inside "TestSuiteList" as SuitetoRun, it is still running all the classes. Kindly help me out

    ReplyDelete
  8. Even if i give "N" inside "TestSuiteList" as SuitetoRun, it is still running all the classes. Kindly help me out

    ReplyDelete
  9. guys executing testng.xml,which has both suits but only one sute is executing when i try to executing testNG.xml....
    Plzzzzzzzzzzzz help
    thanks in advance

    ReplyDelete
  10. Hi guys, despite giving N in 'SuiteToRun' for 'SuiteOne', its still running all the 4 test cases. Looking for somehelp to resolve it. Thanks in advance

    ReplyDelete
  11. Hi Prem Reddy, Please use SuiteOneBase.java and SuiteTwoBase.java files from Download Step11.zip. After extraction replace the file and then do the changes in xls and try.

    ReplyDelete