Skip to content

Cannot run @TestFactory tests #1565

@JasonWThompson

Description

@JasonWThompson

Issue #699 adds support for the @TestFactory junit 5 annotation. I created a dynamic unit test that uses the TestFactory annotation and clicked the icon to run the test. The icon did not change from its unran state. I ran the test from the mvn command line and the test executed and passed. I then intentionally broke the test so that the code under test threw an exception. Running this within vscode caused the test to fail and the icon to change to the failed icon. I fixed the test and reran it. The failure icon remained. Assertion failures are also ignored.

Here's a sample test to run that will demonstrate this issue:

    /**
     * Sample test that reproduces an issue with the java test runner.
     */
    @TestFactory
    public Stream<DynamicTest> testDynamicTestIssue()
    {
        final Stream<Long> parameters = Stream.of(1L, 2L);
        final Function<Long, String> testNames = input -> "TestInput " + input;
        final ThrowingConsumer<Long> test = input -> {assertEquals(1L, input);};

        return DynamicTest.stream(parameters, testNames, test);
    }

I'm using 0.38.2 of the plugin. I also tested that this is an issue in the latest prereleased version. I'm using 1.77.3 of VS Code. My OS is Windows 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions