2 years ago

#74289

test-img

mmo

How to prevent maven surefire to execute test methods of a test-class in parallel?

For our application I have written a class that does some house-keeping on received input files, i.e. it is supposed to move processed files into an "archive" folder and delete files older than a given cut-off date from that archive.

For that class I have also written some unit-tests, which first create a bunch of files with appropriate attributes and then executes the house-holding code and finally verifies for files being properly moved, deleted and others still existing.

Because the unit-tests manipulate "physical" files they must not run in parallel, to avoid that these tests interfere with each other.

How can I prevent maven's surefire plugin from running the test-methods of this specific class in parallel?

I found a few SO-questions asking related questions (usually on how to execute methods or classes in parallel) but I found no solution to prevent parallel execution of methods of a test-class (ideally for a single class only).

Any advice or hint?

maven-surefire-plugin

0 Answers

Your Answer

Accepted video resources