最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

maven - How to configure parallel test execution in jenkins for large java application? - Stack Overflow

programmeradmin3浏览0评论

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

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

Share Improve this question edited Feb 15 at 0:01 Spider asked Feb 14 at 23:43 SpiderSpider 4551 gold badge7 silver badges28 bronze badges 2
  • Why using such ancient Maven version and ancient surefire version... please update... maven.apache./plugins – khmarbaise Commented Feb 15 at 10:14
  • I don't have control over pipeline, but seems like we're in the process of upgrading to 3.9.2 – Spider Commented Feb 18 at 21:40
Add a comment  | 

1 Answer 1

Reset to default 0

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./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?

发布评论

评论列表(0)

  1. 暂无评论