# \#test-tag

**URL:** https://discuss.gradle.org/tag/test-tag/28.md

[Latest](https://discuss.gradle.org/latest.md) · [Categories](https://discuss.gradle.org/categories.md) · [Tags](https://discuss.gradle.org/tags.md)

---

## [Unit test fail when I run "gradle test" but run in Intellij successfully](https://discuss.gradle.org/t/unit-test-fail-when-i-run-gradle-test-but-run-in-intellij-successfully/28814)

<div class="topic-metadata">

**Author:** [@bolobobo](https://discuss.gradle.org/u/bolobobo)\
**Replies:** 7\
**Last updated:** [May 13, 2020, 11:45pm UTC](https://discuss.gradle.org/t/unit-test-fail-when-i-run-gradle-test-but-run-in-intellij-successfully/28814 "2020-05-13T23:45:55Z")

</div>

I wrote a project, which I use testng to test it. It can be built successfully. When I open this project in Intellij, and switch to each single unit test file. All the test can be passed. But when I was trying to run “…

---

## [How to fix 'compileTestJava error: cannot find symbol' by using gradle](https://discuss.gradle.org/t/how-to-fix-compiletestjava-error-cannot-find-symbol-by-using-gradle/32003)

<div class="topic-metadata">

**Author:** [@JawM](https://discuss.gradle.org/u/JawM)\
**Replies:** 4\
**Last updated:** [June 5, 2019, 8:48pm UTC](https://discuss.gradle.org/t/how-to-fix-compiletestjava-error-cannot-find-symbol-by-using-gradle/32003 "2019-06-05T20:48:50Z")

</div>

I want to start some test cases by using gradle. As soon as I start the following command via terminal: gradle clean chromeTest -Durl="https://www.hh.de" I’m getting the following error output at the :compileTestJava …

---

## [Trying to run testng xml from command line using gradle](https://discuss.gradle.org/t/trying-to-run-testng-xml-from-command-line-using-gradle/31723)

<div class="topic-metadata">

**Author:** [@sumit](https://discuss.gradle.org/u/sumit)\
**Replies:** 0\
**Last updated:** [May 10, 2019, 12:35pm UTC](https://discuss.gradle.org/t/trying-to-run-testng-xml-from-command-line-using-gradle/31723 "2019-05-10T12:35:00Z")

</div>

build.gradle file def suite1 = project.hasProperty(“suite1”) def suite2= project.hasProperty(“suite2”) test { useTestNG() { // To generate reports by TestNG library useDefaultListeners = true if(project.hasProper…

---

## [Issue with gradle test in java 9- gradle test is not able to find any class files](https://discuss.gradle.org/t/issue-with-gradle-test-in-java-9-gradle-test-is-not-able-to-find-any-class-files/29743)

<div class="topic-metadata">

**Author:** [@arpitahuddar](https://discuss.gradle.org/u/arpitahuddar)\
**Replies:** 0\
**Last updated:** [December 4, 2018, 10:39pm UTC](https://discuss.gradle.org/t/issue-with-gradle-test-in-java-9-gradle-test-is-not-able-to-find-any-class-files/29743 "2018-12-04T22:39:48Z")

</div>

Migrating mockito to java 9 for class project. This is the code for open source mockito framework. There is only 1 module and its the main module. All the code is in main module. Test is default module created by in…

---

## [How to filter executed tests using command line in a multi project build?](https://discuss.gradle.org/t/how-to-filter-executed-tests-using-command-line-in-a-multi-project-build/29585)

<div class="topic-metadata">

**Author:** [@ghilainm](https://discuss.gradle.org/u/ghilainm)\
**Replies:** 7\
**Last updated:** [November 27, 2018, 11:09am UTC](https://discuss.gradle.org/t/how-to-filter-executed-tests-using-command-line-in-a-multi-project-build/29585 "2018-11-27T11:09:00Z")

</div>

Hi Gradle fans, I would like to filter tests executed in a multi project build in order to separated unit tests from integration tests. I know I can create another ‘test’ task to achieve this but I don’t want to because…

---

## [Aggregate Report generation for gradle tests](https://discuss.gradle.org/t/aggregate-report-generation-for-gradle-tests/29583)

<div class="topic-metadata">

**Author:** [@IrfanSyed-PSC](https://discuss.gradle.org/u/IrfanSyed-PSC)\
**Replies:** 0\
**Last updated:** [November 21, 2018, 5:35am UTC](https://discuss.gradle.org/t/aggregate-report-generation-for-gradle-tests/29583 "2018-11-21T05:35:16Z")

</div>

Hi, I am looking for aggregating test reports for various subprojects that are run from gradle. I saw some old posts but none of them were helpful. These are basically junit based tests. Are there any new plugins that w…

---

## [Android multi module test dependency](https://discuss.gradle.org/t/android-multi-module-test-dependency/26260)

<div class="topic-metadata">

**Author:** [@kotomisak](https://discuss.gradle.org/u/kotomisak)\
**Replies:** 2\
**Last updated:** [October 12, 2018, 1:27pm UTC](https://discuss.gradle.org/t/android-multi-module-test-dependency/26260 "2018-10-12T13:27:00Z")

</div>

Let’s say I have two android modules module-base module-a When I want to access sources from module-base in module-a , I just need to write this in my module-a.gradle dependencies { implementation project(path: ':mod…

---

## [Gradle process dont stop after test execution](https://discuss.gradle.org/t/gradle-process-dont-stop-after-test-execution/28767)

<div class="topic-metadata">

**Author:** [@canb0](https://discuss.gradle.org/u/canb0)\
**Replies:** 0\
**Last updated:** [September 25, 2018, 12:30pm UTC](https://discuss.gradle.org/t/gradle-process-dont-stop-after-test-execution/28767 "2018-09-25T12:30:59Z")

</div>

I am using Gradle, TestNG and Restassured for my testing project. I have a build.gradle file which triggers a testng xml file to run tests. test{ useTestNG() { testLogging.showStandardStreams = true …

---

## [Test not run when using TestNG and JUnit5](https://discuss.gradle.org/t/test-not-run-when-using-testng-and-junit5/28582)

<div class="topic-metadata">

**Author:** [@jameswork](https://discuss.gradle.org/u/jameswork)\
**Replies:** 3\
**Last updated:** [September 14, 2018, 7:42am UTC](https://discuss.gradle.org/t/test-not-run-when-using-testng-and-junit5/28582 "2018-09-14T07:42:31Z")

</div>

Hi, Gradle I use macOS and Gradle 4.10, one of my war project uses TestNG and JUnit5 and has the standard java directories. When I run gradle test -i --rerun-tasks, I can see the test compile is good but test running is…

---

## [Gradle Scan not picking up Instrumentation Tests (androidTest)](https://discuss.gradle.org/t/gradle-scan-not-picking-up-instrumentation-tests-androidtest/28429)

<div class="topic-metadata">

**Author:** [@manchikantishyam](https://discuss.gradle.org/u/manchikantishyam)\
**Replies:** 1\
**Last updated:** [September 7, 2018, 3:30am UTC](https://discuss.gradle.org/t/gradle-scan-not-picking-up-instrumentation-tests-androidtest/28429 "2018-09-07T03:30:07Z")

</div>

I use following command to run my JUnit tests and androidTests(instrumentation) “gradle test connectedAndroidTest --continue --scan” Once this task is completed it publishes the gradle scan report with only unit test re…

---

## [TestKit with Spock - Mismatch between directory set in GradleRunner to what the plugin uses](https://discuss.gradle.org/t/testkit-with-spock-mismatch-between-directory-set-in-gradlerunner-to-what-the-plugin-uses/27378)

<div class="topic-metadata">

**Author:** [@gkohen](https://discuss.gradle.org/u/gkohen)\
**Replies:** 0\
**Last updated:** [June 15, 2018, 11:17pm UTC](https://discuss.gradle.org/t/testkit-with-spock-mismatch-between-directory-set-in-gradlerunner-to-what-the-plugin-uses/27378 "2018-06-15T23:17:57Z")

</div>

Hi Folks, We’re using the Gradle 4.8. the development env is MacOS. We set up the Build result as follows: BuildResult buildResult = GradleRunner.create() .withProjectDir(testProjectDir.root) .withPluginClasspath() …

---

## [Print testcase execution failures on stdout/err](https://discuss.gradle.org/t/print-testcase-execution-failures-on-stdout-err/27048)

<div class="topic-metadata">

**Author:** [@sormuras](https://discuss.gradle.org/u/sormuras)\
**Replies:** 5\
**Last updated:** [May 23, 2018, 8:46pm UTC](https://discuss.gradle.org/t/print-testcase-execution-failures-on-stdout-err/27048 "2018-05-23T20:46:23Z")

</div>

Hej! I want to force test execution failure stacktraces to be printed to stdout/err. All I achieved via build --info --stacktrace and the following configuration test { useJUnitPlatform() testLogging { sh…

---

## [How to dynamically decide which test method to run in gradle](https://discuss.gradle.org/t/how-to-dynamically-decide-which-test-method-to-run-in-gradle/26364)

<div class="topic-metadata">

**Author:** [@freemail165](https://discuss.gradle.org/u/freemail165)\
**Replies:** 0\
**Last updated:** [March 23, 2018, 3:45am UTC](https://discuss.gradle.org/t/how-to-dynamically-decide-which-test-method-to-run-in-gradle/26364 "2018-03-23T03:45:33Z")

</div>

I want to run first 500 tests for a test suite. I found below code which can count/create index for each test. but how can I make sure that when numTests\>500, it will skip the test. In another word, how can I just run t…

---

## [Best approach for triggering afterEvaluate hooks within unit tests](https://discuss.gradle.org/t/best-approach-for-triggering-afterevaluate-hooks-within-unit-tests/26347)

<div class="topic-metadata">

**Author:** [@e.deandrea](https://discuss.gradle.org/u/e.deandrea)\
**Replies:** 1\
**Last updated:** [March 21, 2018, 7:55pm UTC](https://discuss.gradle.org/t/best-approach-for-triggering-afterevaluate-hooks-within-unit-tests/26347 "2018-03-21T19:55:47Z")

</div>

When writing unit tests via the ProjectBuilder we need to trigger afterEvaluate blocks within our plugins to be able to properly test the resulting configuration that the plugins did. I’ve been playing with doing def ru…

---

## [JUnit Platform test execution test filtering](https://discuss.gradle.org/t/junit-platform-test-execution-test-filtering/26277)

<div class="topic-metadata">

**Author:** [@e.deandrea](https://discuss.gradle.org/u/e.deandrea)\
**Replies:** 0\
**Last updated:** [March 16, 2018, 2:18pm UTC](https://discuss.gradle.org/t/junit-platform-test-execution-test-filtering/26277 "2018-03-16T14:18:23Z")

</div>

The new JUnit platform support in Gradle 4.6 is great. One thing I see though is the test selection/filtering. Coming from a tool like IntelliJ, I can click the little triangle icon in an IntelliJ test class and Intelli…

---

## [Gradle Test passes in eclipse but fails on gradle build / Spring Boot](https://discuss.gradle.org/t/gradle-test-passes-in-eclipse-but-fails-on-gradle-build-spring-boot/25777)

<div class="topic-metadata">

**Author:** [@youch12](https://discuss.gradle.org/u/youch12)\
**Replies:** 1\
**Last updated:** [February 9, 2018, 1:36pm UTC](https://discuss.gradle.org/t/gradle-test-passes-in-eclipse-but-fails-on-gradle-build-spring-boot/25777 "2018-02-09T13:36:52Z")

</div>

Hi there, When I test my spring boot project using eclipse whetheir I run it as a junit test or a gradle test, it passes, however when I test it using the command: gradle build or gradle test All my tests fails.…

---

## [Gradle TestListener not getting a handle to the actual exception](https://discuss.gradle.org/t/gradle-testlistener-not-getting-a-handle-to-the-actual-exception/25783)

<div class="topic-metadata">

**Author:** [@StFS](https://discuss.gradle.org/u/StFS)\
**Replies:** 0\
**Last updated:** [February 8, 2018, 2:10pm UTC](https://discuss.gradle.org/t/gradle-testlistener-not-getting-a-handle-to-the-actual-exception/25783 "2018-02-08T14:10:47Z")

</div>

I just created a Gradle TestListener class that I was going to use to detect when a certain custom type of Exception is thrown from a test and use reflection to get the contents of a field in that exception class. Here’…

---

## [Run JUnit with Gradle of only specific intersection of categories](https://discuss.gradle.org/t/run-junit-with-gradle-of-only-specific-intersection-of-categories/25656)

<div class="topic-metadata">

**Author:** [@ido-ran](https://discuss.gradle.org/u/ido-ran)\
**Replies:** 0\
**Last updated:** [January 31, 2018, 7:56am UTC](https://discuss.gradle.org/t/run-junit-with-gradle-of-only-specific-intersection-of-categories/25656 "2018-01-31T07:56:04Z")

</div>

I’m migrating a Java project from been built and test with Maven to be built and test with Gradle. When we run tests we are using maven-failsafe-plugin which is able to accept a logical expression of which categories to…

---

## ["build" shows not enough test failure info, "check" shows info twice?!](https://discuss.gradle.org/t/build-shows-not-enough-test-failure-info-check-shows-info-twice/24664)

<div class="topic-metadata">

**Author:** [@eekboom](https://discuss.gradle.org/u/eekboom)\
**Replies:** 0\
**Last updated:** [November 5, 2017, 3:09pm UTC](https://discuss.gradle.org/t/build-shows-not-enough-test-failure-info-check-shows-info-twice/24664 "2017-11-05T15:09:16Z")

</div>

Setup: Gradle 4.3. Basically, I just executed “gradle init --type=java-application”, added Spock framework as a dependency, converted the JUnit test to Spock and made it fail. Problem: When I run gradlew clean build, th…

---

## [Gradle + Java 9 + JUnit 5](https://discuss.gradle.org/t/gradle-java-9-junit-5/24630)

<div class="topic-metadata">

**Author:** [@sormuras](https://discuss.gradle.org/u/sormuras)\
**Replies:** 0\
**Last updated:** [November 1, 2017, 11:36am UTC](https://discuss.gradle.org/t/gradle-java-9-junit-5/24630 "2017-11-01T11:36:02Z")

</div>

Hi Gradle! Here is a small sample project that builds with Gradle on Java 9 using JUnit 5 for tests: At the moment, I have to disable the default test task and have to inject a custom task like: task testIceCreamMa…

---

## [There were failing tests but tests are 100% successful](https://discuss.gradle.org/t/there-were-failing-tests-but-tests-are-100-successful/24434)

<div class="topic-metadata">

**Author:** [@dbottillo](https://discuss.gradle.org/u/dbottillo)\
**Replies:** 0\
**Last updated:** [October 15, 2017, 11:09am UTC](https://discuss.gradle.org/t/there-were-failing-tests-but-tests-are-100-successful/24434 "2017-10-15T11:09:31Z")

</div>

Hi, I’ve this weird issue running a gradle task through the command line. It’s an Android project and I’m running a simple: ./gradlew connectedAndroidTest The task fails with: \* What went wrong: Execution failed for…

---

## [Aspectj plugin cause unit test case fail?](https://discuss.gradle.org/t/aspectj-plugin-cause-unit-test-case-fail/24418)

<div class="topic-metadata">

**Author:** [@yangshenhuai](https://discuss.gradle.org/u/yangshenhuai)\
**Replies:** 1\
**Last updated:** [October 13, 2017, 7:56am UTC](https://discuss.gradle.org/t/aspectj-plugin-cause-unit-test-case-fail/24418 "2017-10-13T07:56:40Z")

</div>

I am adding unit test for some legacy code .and I use mockito and powermock to mock some external class. After finish writing the case, I run it in eclipse and all test passes. but when I run gradle test one test fails…

---

## [Task test: Creating configurations and source sets for dummy Project](https://discuss.gradle.org/t/task-test-creating-configurations-and-source-sets-for-dummy-project/24348)

<div class="topic-metadata">

**Author:** [@violinner](https://discuss.gradle.org/u/violinner)\
**Replies:** 1\
**Last updated:** [October 6, 2017, 4:30pm UTC](https://discuss.gradle.org/t/task-test-creating-configurations-and-source-sets-for-dummy-project/24348 "2017-10-06T16:30:22Z")

</div>

I am a complete beginner, and created a (working) Gradle 4.1 plugin and a Task test for it. This custom task, MyTask, is for a Java build, and has a method: myMethod(), which refers to configurations and source sets fro…

---

## [Gradle is attempting to execute my Spock tests twice](https://discuss.gradle.org/t/gradle-is-attempting-to-execute-my-spock-tests-twice/24303)

<div class="topic-metadata">

**Author:** [@jjloneman](https://discuss.gradle.org/u/jjloneman)\
**Replies:** 4\
**Last updated:** [October 4, 2017, 6:53pm UTC](https://discuss.gradle.org/t/gradle-is-attempting-to-execute-my-spock-tests-twice/24303 "2017-10-04T18:53:09Z")

</div>

Background I have a Selenium Grid project set up to execute my spec in two different browsers, Chrome and Firefox. I'm using Gradle to execute my specs. The spec will successfully execute twice, once in Chrome and once …

---

## [Ordering Test Class Execution](https://discuss.gradle.org/t/ordering-test-class-execution/23041)

<div class="topic-metadata">

**Author:** [@lordofthejars](https://discuss.gradle.org/u/lordofthejars)\
**Replies:** 4\
**Last updated:** [September 6, 2017, 1:14am UTC](https://discuss.gradle.org/t/ordering-test-class-execution/23041 "2017-09-06T01:14:24Z")

</div>

Hello, I am trying to figure out how to modify the order on how tests are executed. Basically what I want to achieve is next thing. Suppose I have 3 tests: ATest.java, BTest.java and CTest.java. A prior I hae no clue abo…

---

## [Testing the task graph dependencies correctly](https://discuss.gradle.org/t/testing-the-task-graph-dependencies-correctly/23048)

<div class="topic-metadata">

**Author:** [@eyal-lezmy](https://discuss.gradle.org/u/eyal-lezmy)\
**Replies:** 1\
**Last updated:** [June 21, 2017, 11:45pm UTC](https://discuss.gradle.org/t/testing-the-task-graph-dependencies-correctly/23048 "2017-06-21T23:45:46Z")

</div>

Hi guys, I'm developing a Gradle plugin (Genymotion) that is adding some custom tasks belonging to another third party plugin (Android). I need to test that my plugin injects correctly its tasks as dependencies of ce…

---

## [Junit suite are running, also when running a test directly](https://discuss.gradle.org/t/junit-suite-are-running-also-when-running-a-test-directly/23024)

<div class="topic-metadata">

**Author:** [@shay](https://discuss.gradle.org/u/shay)\
**Replies:** 0\
**Last updated:** [June 20, 2017, 1:20pm UTC](https://discuss.gradle.org/t/junit-suite-are-running-also-when-running-a-test-directly/23024 "2017-06-20T13:20:22Z")

</div>

Hello all i have lots of tests and lots of suits. and some times i just want to run a simple test. but i can't, since running a single test is running all my suites, and i have lots of them. can you help me please p…
