How to continue execution when Assertion is failed

I suggest you to use soft assertions, which are provided in TestNg natively package automation.tests; import org.testng.asserts.Assertion; import org.testng.asserts.SoftAssert; public class MyTest { private Assertion hardAssert = new Assertion(); private SoftAssert softAssert = new SoftAssert(); } @Test public void testForSoftAssertionFailure() { softAssert.assertTrue(false); softAssert.assertEquals(1, 2); softAssert.assertAll(); } Source: http://rameshbaskar.wordpress.com/2013/09/11/soft-assertions-using-testng/

Order of execution of tests in TestNG

This will work. @Test(priority=1) public void Test1() { } @Test(priority=2) public void Test2() { } @Test(priority=3) public void Test3() { } priority encourages execution order but does not guarantee the previous priority level has completed. test3 could start before test2 completes. If a guarantee is needed, then declare a dependency. Unlike the solutions which declare … Read more

Priority in TestNG with multiple classes

In your suite xml use group-by-instances=”true” Sample, where TestClass1 and TestClass2 has the same content as yours <suite thread-count=”2″ verbose=”10″ name=”testSuite” parallel=”tests”> <test verbose=”2″ name=”MytestCase” group-by-instances=”true”> <classes> <class name=”com.crazytests.dataproviderissue.TestClass1″ /> <class name=”com.crazytests.dataproviderissue.TestClass2″ /> </classes> </test> </suite> I get the output testA1 testA2 testA3 testB1 testB2 testB3

ChromeDriver and WebDriver for Selenium through TestNG results in 4 errors

There are exactly 4 errors as follows: Error: ChromeDriver cannot be resolved to a type Solution: You need to add the following import import org.openqa.selenium.chrome.ChromeDriver; Here you can find a discussion on chrome Webdriver can’t be resolved to a type error eclipse and java Error: Test cannot be resolved to a type Solution: You need … Read more

How to execute cucumber feature file parallel

Update: 4.0.0 version is available at maven central repository with bunch of changes.for more details go here. Update: 2.2.0 version is available at maven central repository. You can use opensource plugin cucumber-jvm-parallel-plugin which has many advantages over existing solutions. Available at maven repository <dependency> <groupId>com.github.temyers</groupId> <artifactId>cucumber-jvm-parallel-plugin</artifactId> <version>2.1.0</version> </dependency> First you need to add this plugin … Read more

How to run TestNG from command line

You need to have the testng.jar under classpath. try C:\projectfred> java -cp “path-tojar/testng.jar:path_to_yourtest_classes” org.testng.TestNG testng.xml Update: Under linux I ran this command and it would be some thing similar on Windows either test/bin# java -cp “.:../lib/*” org.testng.TestNG testng.xml Directory structure: /bin – All my test packages are under bin including testng.xml /src – All source … Read more