netbeans-gradle-project
netbeans-gradle-project copied to clipboard
Test single executes test twice if test file part of a suite
This is regarding earlier post [#293.] If I run a test on a single file from netbeans, sometimes each test method is executed twice.
However this does not happen if I run the test from the command line, ie:
$ gradle -Dtest.single=[test file name] test
For instance, a test file with 17 tests including 1 failing test:
- from Netbeans: "34 tests completed, 2 failed"
- from command line: "17 tests completed, 1 failed"
This seems to happen only from within Netbeans and only if the test file is referred to within a test suite:
@RunWith(Suite.class) @Suite.SuiteClasses( { [test file name].class }) public class SuiteName {}
If I comment out the test file name in the suite and then run the single test from within Netbeans, test methods are executed once (correct behaviour).
Now the plugin is using the --tests argument instead of "-Dtest.single" (unless you are using a very old version of Gradle). What happens when you use the "--tests" from the command line?
Indeed, with --tests on the command line the behaviour is the same as from Netbeans. I guess it really is a gradle bug then? I should have mentioned I run gradle 3.2.1 under Archlinux.