Skip to content

JUnit 5 Support #93

Closed
Closed

Description

As the java community progresses to use JUnit 5 instead of JUnit 4 please add support for JUnit 5 as well

Activity

  1. angelozerr commented on Feb 28, 2018

    @angelozerr

    I think it's more an issue with JUnit support of Eclipse JDT. I have created a bug for that https://bugs.eclipse.org/bugs/show_bug.cgi?id=531779

  2. ansyral commented on Mar 7, 2018

    @ansyral
    Collaborator

    we'll support basic feature of JUnit5 in 0.4.0

  3. smoyer64 commented on Mar 29, 2018

    @smoyer64

    Angelo (@angelozerr) - I don't think that the issue you raised in #93 (comment) is going to help with JUnit 5 support. When running JUnit 5 tests in Eclipse, the plugin uses the JUnit5 Engine for discovery and for execution. The structure of a JUnit5 test plan includes both tests and containers which can form an arbitrarily deep hierarchy (in practice it's fairly constrained. As an example, consider the following code:

    public class MinimalJunitTests {
    
        @Test
        void test() {
        }
    
        @ParameterizedTest
        @CsvSource({ "Test 1", "Test 2", "Test 3" })
        void parameterizedTest(String parameter) {
        }
    
        @TestFactory
        Stream<DynamicTest> dynamicTest() {
            return Stream.of("One", "Two", "Three")
            .map(s -> DynamicTest.dynamicTest(s, () -> {}));
        }
    
        @AlternateTestAnnotation
        void alternateTest() {
        }
    
        @Nested
        public class NestedMinimalTests {
    
            @Test
            void nestedTest() {
            }
        }
    
    }
    

    This class doesn't contain all the ways that JUnit5 tests can be created so it's not really suitable as a full example, but when run using Maven or Eclipse, this code executes nine test methods with the following hierarchy:

    junit5-eclipse

    I'm a bit confused because DiscoveryRequestCreator looks like it's set up to use JUnit5 discovery - but I can't find anywhere to set-up the options that are required (or even find the default options).

  4. smoyer64 commented on Mar 31, 2018

    @smoyer64

    After running a few more JUnit5 tests through VS Code's Java test extension I've also realized that the @DisplayName annotations are not being used when present. I can submit a separate issue for this problem if you want (along with a small code sample and Eclipse output.

  5. cmaslen commented on Oct 31, 2018

    @cmaslen

    In addition to DisplayName not working @ParameterizedTest methods are not picked up. Likely reason is the junit-jupiter-params artifact is not included on the class path of the VS code runner.

    Would be great if this worked out of the editor, but you can get by running mvn test or the Gradle equivalent for now.

  6. jdneo commented on Nov 1, 2018

    @jdneo
    Member

    We are working on refactoring the code with TestNG support right now and will be coming soon.

    More support on Junit5 will be the next work item.

  7. smoyer64 commented on Nov 5, 2018

    @smoyer64

    Sheng Chen (@jdneo) I wouldn't be much help with TestNG but ping me if you need some help with the JUnit 5 work

  8. jdneo commented on Nov 6, 2018

    @jdneo
    Member

    Steve Moyer (@smoyer64) Much appreciated, thank you! 😄

  9. added this to the 0.12.0 milestone on Nov 23, 2018
  10. jdneo commented on Nov 23, 2018

    @jdneo
    Member

    Hi ALL

    To better track the work items, I'm going to closing this issue, you can check them separately in the following issues:

  11. removed this from the 0.11.1 milestone on Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions