netbeans-gradle-project icon indicating copy to clipboard operation
netbeans-gradle-project copied to clipboard

Test single executes test twice if test file part of a suite

Open fortiernor opened this issue 8 years ago • 2 comments

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).

fortiernor avatar Jan 03 '17 22:01 fortiernor

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?

kelemen avatar Jan 03 '17 22:01 kelemen

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.

fortiernor avatar Jan 04 '17 01:01 fortiernor