1

To reduce run time of my tests I want to run my tests in parallel. I have few classes that I can't run in parallel to each other.

lets say I have two types of classes: - parallel Classes - contains class1, class2 - NotParallel Classes - contains class3, class4 I want to run class1 and class2 in parallel to class3 and class4 (but lass3 will not run in parallel to class4)

I tried to do this:

<suite name="sanity"  thread-count="2" parallel="tests">
    <test name="parallel" preserve-order="true" parallel="classes">
        <classes>           
            <class name="class1"/> 
            <class name="class2"/> 
        </classes>  
    </test>
    <test name="NotParallel" preserve-order="true">
        <classes>           
            <class name="class3"/>  
            <class name="class4"/>
        </classes>

    </test>
</suite>

I'm running both tests in parallel but just the first test have the parallelism for class inside it.

I tried to search in TestNG documentation if I have the option to add the parallel="classes" to test. I don't see it there, but it is working.

Does anyone used this option to parallel test classes (and not suite)

do you see any issue or case where it will not work?

Thanks

1 Answer 1

2

Yes you can put parallel in a <test> block. Here is the DTD.

You could also establish a <suite> of suites to suit your needs as follows;

<suite ...>
    <suite-files>
        <suite-file path="a.xml" />
        <suite-file path="b.xml" />
    <suite-files>
</suite>
Sign up to request clarification or add additional context in comments.

1 Comment

thanks for your comment. but how I can establish a <suite> of suites?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.