Skip to main content

Posts

Showing posts with the label TestNG

Updating Sauce Labs dashboard with Selenium 2 test results

If you have not yet known of Sauce Labs, Sauce Labs specialises in executing Selenium tests on cloud. If you don't want to manage those umpteen configurations for executing your Selenium tests, then Sauce Labs is the answer. I am not going to explain executing your Selenium tests on Sauce Labs as there is enough documentation on Sauce Labs which already explains this. What I was stuck with is updating test results on Sauce Labs dashboard. Status "finished" does not indicate about success/failure of tests and you may probably not have time to see log/video of each and every finished tests. I posted query to Sauce Labs and got to know about the Sauce Labs REST api . But things were still not very clear as I was not sure of on what basis I could update test results in Sauce Labs dashboard.

TestNG - DependsOnMethod which returns a value

Came across a bizarre scenario while using TestNG of late. I had test with method with a return type and another method being dependent on it. i.e. - ########################################### public class TestNGTest {         @Test     public Integer returnsSomething() {         return new Integer(0);     }         @Test(dependsOnMethods={"returnsSomething"})     public void dependentMethod() {         System.out.println("Hello World");     } } ########################################### This over simple test does not work and throws exception - ########################################### org.testng.TestNGException: com.core.tests.TestNGTest.dependentMethod() is depending on nonexistent method com.core.tests.TestNGTest.returnsSomething ########################################### And I...

Selenium Tutorial: Capture screenshot on selenium test failure using TestNG and Fest

There is a method in DefaultSelenium class called CaptureScreenshot()which can be used to capture screen shot in general. But this is not effective when screen shot is to be taken only during failures. To achieve capturing screen shot on failure FEST can be used ( http://fest.easytesting.org/ ) Regardless of how the FEST-Swing takes a screenshot, it needs to know which tests should be considered "GUI tests." In order to do so, one needs to add the annotation @GUITest. This annotation can be placed at class or method level, and it is inherited by subclasses of annotated classes. Hence in case of selenium it should be added on the class which is extended by other test classes Once downloaded Fest, add these jar files in library of Intellij - fest-swing-1.2.jar fest-swing-testng-1.2.jar fest-util-1.1.2.jar fest-reflect-1.2.jar Same should be added in the library folder of project and property of ANT so that ANT could access these. Now import the GUI test in SelTestCas...