1
votes

My testng.xml :

<suite name="Tests Suite" time-out="300000" verbose="1" annotations="JDK" thread-count="4" parallel="tests">

<test name="Tests1">
    <classes>
        <class name="TestingClass1">
        </class>
    </classes>
</test>

</suite>

In "TestingClass1" there are 4 tests but selenium grid triggers tests only on single node.

Could someone please help me in figuring out what wrong i am doing, and how to trigger tests in parallel, thanks in advance.

2
Can you also post your config text file for each node? I see there is no fault in your testng file and hoping that there is no fault in your node configuration for each machine that you are using. - girish-sortur

2 Answers

0
votes

You have given parallel option as test but you have only one test tag in your xml. Change parallel = tests to parallel=methods

I am assuming that you have 4 test methods (methods which have @Test annotation) in the TestingClass1.java file. You should also have taken care of making the driver object thread safe.

0
votes

parallel="tests": TestNG will run all the methods in the same tag in the same thread, but each tag will be in a separate thread. This allows you to group all your classes that are not thread safe in the same and guarantee they will all run in the same thread while taking advantage of TestNG using as many threads as possible to run your tests.

http://testng.org/doc/documentation-main.html#parallel-tests

What you are probably looking for is to have multiple test classes and execute them in parallel with parallel="classes". This is what works best in most cases when Selenium on Java is involved.

You can also go for parallel=methods as correctly described above, although this is not intended for most test automation frameworks, as requires to manage class hierarchy carefully.