Implementing Calc Sum Test In Selenium WebDriver DDF

In Previous Step, We have Implemented URL centralization In DDF to make your future URL maintenance easy and you can change test site URL from one place. Now next step Is to write some WebDriver test code. In this step We will Implement simple calc test In our SuiteOneCaseOne.java test case.

STEP 26
Prerequisite : WebDriver DDF creation steps from Step 1 to Step 25 should be Implemented. You will find links for all steps on this MASTER PAGE.

For What This Test Is
This Is very simple calc test to Sum three Integer values. It will use excel file's test data sheet's data to build the xpath of calc buttons. In short, We will use excel sheet data In our webdriver test case to perform some action on page and get the result.

Download Required Files
Right now, we will Implemented this test only In SuiteOneCaseOne.java test case file. Letter on, We will Implement It In all test cases. For now, you have to download SuiteOneCaseOne.java file. Download bellow given zip folder to get SuiteOneCaseOne.java.
Replace existing SuiteOneCaseOne.java file with downloaded file In "com.stta.SuiteOne" package. 

Running Test
Double click on "Shortcut to Run Test.bat" file on desktop. It will start running your test cases. During  SuiteOneCaseOne.java test case execution, Webdriver will click on calc buttons as per data set lines values of SuiteOneCaseOne excel sheet.

If you will see log file, It will show you data set line's sum as shown In bellow given Image.


What we have achieved from this step
We have used test data from exel sheet to perform actions on calc application using selenium webdriver data driven framework.


4 comments:

  1. Hi Aravind,
    Your tutorials are real good.
    I have one query though from the log file at this step -
    If you see the last snapshot of this step i.e. of applog.log it shows that the sum result is 21 where as the expected result was 22 in the excel, so ideally this should fail but it is reported as PASS in the excel as well as in the console.
    Please rectify or let me know the reason.

    A keen visitor of your site,
    Gaurav

    ReplyDelete
  2. Awsome , Thanks for sharing this wonderfull info
    :)

    ReplyDelete
  3. I AM NOT ABLE TO EXECUTE ANY TESTCASES IN BROWSER. ITS NOT OPENING ANY OF THE BROWSER. PLEASE HELP ME OUT.

    ReplyDelete
    Replies
    1. use mozilla and replace the code in suite base with

      if(Param.getProperty("testBrowser").equalsIgnoreCase("Mozilla")){
      //To Load Firefox driver Instance.
      System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir")+"//BrowserDrivers//geckodriver.exe");
      driver = new FirefoxDriver();
      ExistingmozillaBrowser=driver;
      Add_Log.info("Firefox Driver Instance loaded successfully.");

      }

      this is required when mozilla is installed on some other location than the usual

      Delete