This page is hosted for free by zzz.com.ua, if you are owner of this page, you can remove this message and gain access to many additional features by upgrading your hosting to PRO or VIP for just 41.60 UAH.
Do you want to support owner of this site? Click here and donate to his account some amount, he will be able to use it to pay for any of our services, including removing this ad.

How to run same test few times?

images (2) To run same test few times just use parameter invocationCount, in the example below you will see test which runs 5 times, it has default priority equal to 0

@Test(priority = 0,invocationCount=5)

Plus you could use threadPoolSize

threadPoolSize( parameter for load testing ) set the size of the thread pool . The method with this parameter will be invoked from multiple threads as specified by invocationCount.
Note: this attribute is ignored if invocationCount is not specified

@Test(invocationCount = 2, threadPoolSize = 3)
public void load_test(){Load_test.loadTest();}

LoadTest()

public static void loadTest()
{
    System.out.printf("%n[START] Thread Id : %s is started!",Thread.currentThread().getId());
    some_link.click();
      System.out.printf("%n[END] Thread Id : %s",Thread.currentThread().getId());
}

HOW TO RUN TESTS IN PARALLEL(SELENIUM WEBDRIVER /JAVA/TESTNG)

If you want to run test in parallel  in the same time just change your your testng.xml(Note, if you use this variant to run test in parallel both test classes must have own setting)

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Parallel_test_runs_ddi_dev" parallel="tests" thread-count="2">

    <test name="ddi_dev">
        <classes>
            <class name="TestCases_ddi_firefox"/><!--first class with tests inside -->
        </classes>
    </test>
    <test name="ddi_dev_2">
        <classes>
            <class name="TestCases_ddi_2"/><!-- second class with tests inside-->
        </classes>
    </test>
</suite>