Tuesday 12 March 2013

Running Test Cases(s)

Now its finally time to run our test case(s).
Navigate to the RegressionTestHarness directory and run ant

Note: When running either the IEDriverServer/chromedriver for the first time your firewall will ask for permission to allow access, so you should allow access and re-run ant again.

You will now see the Internet Explorer browser open and perfom a google search for "WebDriver API" and click on the search button and then the browser will close.

  
Congradulations thats our test case run via the harness.
Just a recap of the stages:
  • Record Test Case(s) Using Selenium IDE
  • Convert Test Case(s)
  • Fix Compilaton Errors (if any)
  • Specify Configuration
  • Run Test Case(s)

Test Results

The harness will generate the results of the test case(s) run in two styles.
  •  testNG - index.html in the RegressionTestHarness/results directory
  • JUnit     - index.html in the RegressionTestHarness/results/junitreports directory
The testNG results are slightly more complicated to understand, I personally prefer the JUnit style easy to read and understand. But both are provided by the framework.

4 comments:

  1. Hi,
    Navigate to the RegressionTestHarness directory and run ant
    means: C:RegressionTestHarness>ant ?
    After this
    what should i do?

    ReplyDelete
  2. I assume you have installed Ant?

    if so then navigate to the "RegressionTestHarness" directory and then type: ant

    for example
    C:\workspace\RegressionTestHarness>ant

    you wait for a while and you will see that your tests will start to run.

    You do have some tests cases created?

    ReplyDelete
  3. Hi Imran,

    I'm getting following upon executing ant via command line.

    You need to specify at least one testng.xml, one class or one method

    testng] The tests failed.

    junit-report:
    [exec] Buildfile: c:\Selenium-Regression-Project-master\RegressionTestHarne
    uild.xml
    [exec]
    [exec] report:
    [exec]
    [exec] BUILD FAILED
    [exec] c:\Selenium-Regression-Project-master\RegressionTestHarness\build.xm
    : c:\Selenium-Regression-Project-master\RegressionTestHarness\results\junitr
    ts does not exist.
    [exec]
    [exec] Total time: 0 seconds
    [exec] Result: 1

    D SUCCESSFUL
    l time: 4 seconds

    pls assist

    ReplyDelete
  4. hi imran,
    i am getting this error in eclipse
    org.testng.TestNGException:
    Cannot instantiate class com.examples.tests.test1
    in command prompt it is working fine

    ReplyDelete