Recall & Review
beginner
What is the purpose of the Gradle
test task?The Gradle
test task runs the unit tests in a project, typically using frameworks like JUnit. It compiles the test code and executes tests to check if the code works as expected.Click to reveal answer
intermediate
How do you run only tests with a specific name pattern using the Gradle
test task?You can configure the
test task in build.gradle with filter { includeTestsMatching 'pattern' } to run only tests matching that pattern.Click to reveal answer
beginner
What file does Gradle use to configure the
test task?Gradle uses the
build.gradle file to configure the test task and other build settings.Click to reveal answer
beginner
How can you generate a test report after running the Gradle
test task?Gradle automatically generates a test report in
build/reports/tests/test/index.html after running the test task. You can open this file in a browser to see test results.Click to reveal answer
intermediate
What is the default testing framework used by Gradle's
test task when using JUnit?Gradle supports JUnit 4 and JUnit 5 by default. You need to add the correct dependencies in
build.gradle to use the desired JUnit version.Click to reveal answer
What command runs the tests in a Gradle project?
✗ Incorrect
The
gradle test command runs the unit tests in the project.Where does Gradle place the test reports by default?
✗ Incorrect
Gradle generates test reports in
build/reports/tests/test/index.html by default.How can you include only tests matching a pattern in Gradle?
✗ Incorrect
You use
filter { includeTestsMatching 'pattern' } inside the test task configuration.Which file configures the Gradle
test task?✗ Incorrect
The
build.gradle file is used to configure the test task.To use JUnit 5 in Gradle, what must you do?
✗ Incorrect
You must add the JUnit 5 dependencies explicitly in
build.gradle to use it.Explain how the Gradle
test task works and how you can customize which tests run.Think about running tests and filtering them.
You got /4 concepts.
Describe where Gradle stores test reports and how you can view them.
Reports are saved as HTML files.
You got /3 concepts.