0
0
JUnittesting~5 mins

Parallel test configuration in JUnit - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is parallel test configuration in JUnit?
It is a setup that allows multiple tests to run at the same time to save time and improve efficiency.
Click to reveal answer
beginner
How do you enable parallel test execution in JUnit 5?
By configuring the junit-platform.properties file with junit.jupiter.execution.parallel.enabled = true.
Click to reveal answer
intermediate
What is the purpose of ExecutionMode.CONCURRENT in JUnit?
It tells JUnit to run tests or test classes at the same time instead of one after another.
Click to reveal answer
intermediate
Name one risk of running tests in parallel.
Tests might interfere with each other if they share data or resources, causing false failures.
Click to reveal answer
advanced
How can you control the number of threads used in JUnit parallel tests?
By setting junit.jupiter.execution.parallel.config.fixed.parallelism in the junit-platform.properties file.
Click to reveal answer
Which file is used to configure parallel execution in JUnit 5?
Apom.xml
Bjunit-platform.properties
Cbuild.gradle
Dtestng.xml
What does setting junit.jupiter.execution.parallel.enabled = true do?
AEnables parallel test execution
BDisables parallel test execution
CRuns tests sequentially
DSkips tests
Which JUnit annotation or setting controls if tests run concurrently?
AExecutionMode.CONCURRENT
B@TestInstance
C@BeforeEach
D@Disabled
What is a common problem when running tests in parallel?
ATests run slower
BTests lose coverage
CTests cannot run on multiple threads
DTests may share state causing failures
How do you limit the number of threads used in parallel tests in JUnit?
AUse @ThreadLimit annotation
BSet <code>parallel.threads</code> in pom.xml
CSet <code>junit.jupiter.execution.parallel.config.fixed.parallelism</code>
DSet <code>maxThreads</code> in build.gradle
Explain how to enable and configure parallel test execution in JUnit 5.
Think about the properties file and execution modes.
You got /4 concepts.
    What are the benefits and risks of running tests in parallel?
    Consider speed vs test reliability.
    You got /4 concepts.