[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: RFR: 8254013: gradle test should run all test classes even if they don't end with "Test"
From:       Pankaj Bansal <pbansal () openjdk ! java ! net>
Date:       2020-10-28 14:29:46
Message-ID: fUpMhrLGtahb46cK7a-_x9qIZWVwN_sKHqZkHNJQl_U=.1e8d4374-f1a7-4ba3-882f-397179d6430c () github ! com
[Download RAW message or body]

On Thu, 22 Oct 2020 11:45:08 GMT, Kevin Rushforth <kcr@openjdk.org> wrote:

> The test targets in `build.gradle` are set up to run only classes whose name ends \
> with exactly `Test`. A test class named `RunMyTest.java` will be run, but a test \
> called `CheckSomething.java` will not be. This was done because gradle's built-in \
> scanner for test classes was buggy in earlier versions of gradle. It seems to have \
> been fixed in the gradle 3.x time frame from what I can tell. 
> The current approach leads to two problems. The first is that gradle will try to \
> execute  all classes named `XxxxxTest.java` whether or not it should. Attempting to \
> execute utility classes without test methods (meaning without at least one method \
> annotated with `@Test`) or `abstract` classes (whether or not there are any test \
> methods) will fail. 
> The second is that a test class that isn't named `XxxxxTest.java` will not be run, \
> even if it contains `@Test` methods. This can (and has) lead to tests being skipped \
> when they should be run. 
> The solution is to enable gradle's built-in scanning for test classes which works \
> exactly like you would expect it to: it runs any concrete class that has at least \
> one `@Test` method or whose parent class has such a method. This means that a class \
> with no test methods that subclasses an abstract class with `@Test` methods will be \
> run correctly. 
> I ran a full test on all three platforms. The following test classes which were \
> formerly not run are now run: 
> modules/javafx.base: test.javafx.collections.ObservableListWithExtractor : 52 tests
> modules/javafx.base: test.javafx.event.EventSerializationEventExists 0 tests (*)
> modules/javafx.controls:. test.javafx.scene.control.MiscellaneousTests : 3 tests
> tests/system: test.com.sun.javafx.application.SwingNoExit : 1 test
> 
> They pass on all three platforms.
> 
> (*) - There is only one test in this class and it is currently `@Ignore`d

Marked as reviewed by pbansal (Author).

-------------

PR: https://git.openjdk.java.net/jfx/pull/329


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic