jeudi 15 décembre 2016

How do I inject a property into a test JVM using Gradle?

I could easily exclude the class from execution using the build system which is Gradle but what I don't like about that is that it's silent. I want a failure that has to be fixed prior to check in.

So we use the naming convention of "*ITCase.java" for integration tests and "*Test.java" for unit tests. It's happened before that someone used "*ITest.java" which resulted in integration tests running in the unit test phase. We are suspicious that this has caused us some mysterious transactional issues during parallel runs. I want there to be a test that fails when this happens. Since we make copious use of parent classes, it would seem that we have some means for doing this.

An idea I've had is to inject a property into the test JVM so that I know whether the "test" task is running or the "integrationTest" task is running. Check that property and fail if it's wrong. Not sure how to do that with Gradle.

Aucun commentaire:

Enregistrer un commentaire