Closed mapio closed 11 months ago
Thank you for reporting this bug.
Though it's not related with #1603, but this reflects some 'bad' design/implementation when handling the invocation/dynamic tests.
Some refactoring is needed.
Please use this private build to unblock yourself: vscode-java-test-0.40.2023092907.vsix.zip
The PR still needs more days (~ 1 week) to be merged due to the holiday here. If you find any issue using the private bit, please let me know.
I've tested it. It's true that now tests in a container are picked up. But test reports do not show any form of hierarchy.
According to this post for example it should go from to .
What did you see from your side?
I'm sorry but I can't reproduce the example of the Medium post.
With this code:
import static org.junit.jupiter.api.DynamicContainer.dynamicContainer;
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.junit.jupiter.api.DynamicContainer;
import org.junit.jupiter.api.TestFactory;
public class TestContainers {
@TestFactory
Collection<DynamicContainer> testContainer() {
List<DynamicContainer> containers = new ArrayList<>();
containers.add(
dynamicContainer("First Container", List.of(
dynamicTest("First test of first container", () -> {}),
dynamicTest("Second test of first container", () -> {})
))
);
containers.add(
dynamicContainer("Second Container", List.of(
dynamicTest("First test of second container", () -> {}),
dynamicTest("Second test of second container", () -> {})
))
);
return containers;
}
}
I get
TestContainers > testContainer() > First Container > TestContainers.First test of first container PASSED
TestContainers > testContainer() > First Container > TestContainers.Second test of first container PASSED
TestContainers > testContainer() > Second Container > TestContainers.First test of second container PASSED
TestContainers > testContainer() > Second Container > TestContainers.Second test of second container PASSED
as gradle test
output, but this in the sidebar
So apparently the two containers are there, but are not viewable.
Ahah, my fault. I was looking at the "Testing result" panel, not at the testing sidebar. There the containers show up!
So now the question is: why the UI of the panel and sidebar are different?
My understanding is that the Test Explorer (sidebar) is used to show all the tests in the workspace. While the Test Result (panel) is used to show the tests of each execution.
We have an issue about improve the Test Result content: https://github.com/microsoft/vscode-java-test/issues/1588
The explanation makes a lot of sense! Thank you for referring me to the other issue. You are very helpful, thank you for your time and work!
With this test
Gradle outputs the result, but VSCode runs the test and reports just an empty bullet, not picking the failure.