jeudi 27 octobre 2016

How do I get detailed logging when I run a single test in Gradle?

I'm trying to find out why a single test is failing in my build, so I know I need to run gradle with the tests flag like so:

./gradlew test --tests com.myname.myproject.mypackage.MyTestClass.myTestMethod

However I wanted to see some trace logs so I had more detailed information on what my test was doing. I know that the options for seeing more detailed logs are --stacktrace, --info, and --debug. So normally, to see more detailed logging on all tests, I'd use the following:

`./gradlew test --debug` or `./gradlew test -d`

In this case, I'd like to only see debug logs for myTestMethod, but none of my attempts are working. I always get debug logs for ALL of the tests; it's running ALL of the tests instead of the single one I specify. I've tried the following combinations, all to no avail:

With --debug

Appended at the end: ./gradlew test --tests com.myname.myproject.mypackage.MyTestClass.myTestMethod --debug

Appended at the end with quotes around the tests param: ./gradlew test --tests "com.myname.myproject.mypackage.MyTestClass.myTestMethod" --debug

Appended before tests flag: ./gradlew test --debug --tests com.myname.myproject.mypackage.MyTestClass.myTestMethod

Appended before tests flag with tests param in quotes: ./gradlew test --debug --tests "com.myname.myproject.mypackage.MyTestClass.myTestMethod"

With -d

Appended at the end: ./gradlew test --tests com.myname.myproject.mypackage.MyTestClass.myTestMethod -d

Appended at the end with quotes around the tests param: ./gradlew test --tests "com.myname.myproject.mypackage.MyTestClass.myTestMethod" -d

Appended before tests flag: ./gradlew test -d --tests com.myname.myproject.mypackage.MyTestClass.myTestMethod

Appended before tests flag with tests param in quotes: ./gradlew test -d --tests "com.myname.myproject.mypackage.MyTestClass.myTestMethod"

Is there something I'm doing wrong?

Gradle version used in wrapper: 2.14.1

Note: I'm also setting up some environment variables before the command, specifically, spring boot profiles. I'm thinking that shouldn't affect anything as it's not part of the gradle command, but I figured I'd state so just in case. So in reality, all of the commands I'm running look more like this: SPRING_PROFILES_ACTIVE=profile1,profile2 ./gradlew test ...

Aucun commentaire:

Enregistrer un commentaire