SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Introducing Selenium Webdriver In Data Driven Framework

Our core data driven framework creation part Is over In STEP 21. Now this Is the right time to Introduce selenium webdriver In our selenium data driven framework. If you are totally new to selenium webdriver then you must have to visit webdriver tutorials PART 1 and PART 2 pages where you will find the links of very useful tutorials on webdriver.

STEP 22

Prerequisite : All previous 21 data driven framework creation steps should be Implemented. You will find the links of all previous steps on THIS PAGE.

Now let me describe you how to Introduce Selenium webdriver In our data driven framework. We are going very slowly In this framework tutorials so that you can get each and every point very easily.

Introducing Selenium WebDriver In Framework
You already know how to open web browser and how to navigate to any website's URL using selenium webdriver. So I am not describing all those things over here. So let us Implement simple web browser opening, URL navigation and closing browser steps In all four test cases. Initially we will Implement all these things very simply In all four test cases. In up coming steps, We will centralize all common functions at one place to manage them very easily.

Modify Excel Files
From now onward, We will execute all 4 test cases every time. You need to modify all excels files as described bellow.

  • Set SuiteToRun = "Y" for both test suites In TestSuiteList.xls file.
  • Set CaseToRun = "Y" for all 4 test cases In SuiteOne.xls and SuiteTwo.xls files.
  • Set DataToRun = "Y" for all 8 data set lines In SuiteOne.xls and SuiteTwo.xls files.

Download Test Case Files
I have modified all four test cases to open the web browser, navigate to URL and close the web browser. Let me tell you one thing more -> We will not use test data of excel files for next few steps so Ignore them right now. We will use them whenever required. You can download bellow given zip folder to get all modified test cases files.
Extract downloaded folder and copy-paste those files as described bellow on "WDDF" project.
  • 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.
Note : All required jar files for selenium webdriver should be Included In "WDDF" project's build path as described In STEP 3 and STEP 4.

Execute Test And Observe Result
Now we are all set to execute test from shortcut of "Run Test.bat" file from desktop. Double click on It. It will start executing your test cases one by one. We have total 8 data lines for 4 different test cases so It will open Firefox browser, navigate to URL and close the browser for 8 times.

On completion of execution, XSLT report will be generated. Open XSLT report and verify result.

3 comments:

  1. Null Pointer exception is coming in the report for the Skipped Test Suite and it is shown as Failed in reports.
    I am confused why this is not displayed as Skipped in the reports.

    ReplyDelete
  2. All executions set to Yes....after run, they are all passed in excel sheet but failed in the report with NoClassDefFoundError

    ReplyDelete
  3. After copying the above files, all tests failed due to NoClassDefFoundError: com/google/common/base/Function

    This code update is not OK.

    ReplyDelete