Spider
Spider

Reputation: 455

How to configure parallel test execution in jenkins for large java application?

I have a java application I manage that's getting larger. When I had one test suite I had an easy configuration like so

<suite name="suite1" parallel="suites" thread-count="10">
    <suite-files>
        <test name="Test1">
        <classes>
            <class name="com.example.YourTestClass"/>
        </classes>
    </test>
    <test name="Test2">
        <classes>
            <class name="com.example.YourTestClass"/>
        </classes>
    </test>
    </suite-files>
</suite>

I lazily set thread count to 10, because that's the number of cores on my hardware had and assumed the jenkins server probably would probably have more than that.

But over time I've had several other people/teams add test suites and it's grown to about 12 test suites.

I'm executing these test suites using the parallel keyword from jenkins. However I'm curious if all these suites can be executed in parallel, while also all accessing 10 threads.

There's no errors, but then it fails to execute a couple or several test suites. Here's what I see.

[2025-02-14T16:43:58.954Z] [INFO] 

[2025-02-14T16:43:58.954Z] [INFO] --- surefire:2.22.2:test (default-test) @ my-tests ---

[2025-02-14T16:43:58.954Z] [INFO] 

[2025-02-14T16:43:58.954Z] [INFO] -------------------------------------------------------

[2025-02-14T16:43:58.954Z] [INFO]  T E S T S

[2025-02-14T16:43:58.954Z] [INFO] -------------------------------------------------------

[2025-02-14T16:43:58.954Z] Killed

Using jdk17, maven 3.6.1

Upvotes: 0

Views: 53

Answers (1)

chubbsondubs
chubbsondubs

Reputation: 38842

Looks like one of your JVMs is being killed because it exits. If your test threw an exception, called System.exit, it times out waiting for a non-daemon thread to complete or if the JVM just crashes these could be the reason test suites may not run.

https://maven.apache.org/surefire/maven-surefire-plugin/examples/shutdown.html

It's weird "killed" is all that is written to the console. I'd expect a little more feedback from surefire or maven about why the JVM was killed. Could someone have written a test that is doing something it shouldn't?

Upvotes: 0

Related Questions