Klemens Morbe
Klemens Morbe

Reputation: 653

Test run finished to early

I want to switch my test runs from sequential to parallel (class level) with 5 threads.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="testSuite" parallel="classes" thread-count="1" time-out="30000">
    <test name="testCase">
        <packages>
            <package name="com.package.path"/>
        </packages>
    </test>
</suite>

Everything works fine for a small amount of tests (15-20). But when I want to run more/all tests (about 400), the test run finishes too early. I get the message:

Total tests run: 25, Failures: 0, Skips: 0

But all tests aren't finished yet. There are plenty of tests missing. In the console I can see, that the tests continue running. The test assertions pass and an output is generated.

I don't get it why I get the finish event too early. Can anyone help?

UPDATE: The same happens, when I reduce thread-count to 1 and still keep the parallelism. I probably have some issue with my own code.

Upvotes: 0

Views: 117

Answers (1)

Klemens Morbe
Klemens Morbe

Reputation: 653

I misunderstood the attribute time-out. When setting the other attribute parallel="classes", the timeout is set for the entire class and not the method.

Some of my test cases have a high execution time. For one class with multiple test cases like that, the timeout was triggered too early. Since the timeout was reached the first time, all my tests in all classes were aborted by TestNG.

Hope I can help others with this issue.

Upvotes: 1

Related Questions