Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Customized JUnit5 TestEngine that reads test-scenarios from .json files #1312

Open
jdneo opened this issue Sep 26, 2021 · 9 comments

Comments

@jdneo
Copy link
Member

jdneo commented Sep 26, 2021

Referenced from @emyklebost:

Hello. I've created a custom JUnit5 TestEngine that reads test-scenarios from .json files. I would like to run these tests in vscode using the junit-platform-console-standalone.jar without a build tool. I am able to do this manually using PowerShell, e.g.: java -jar junit-standalone.jar -cp engine.jar -f test/my.test.json

I've added the Extension Pack for Java and the following in settings.json:

{
    "java.project.referencedLibraries": [
        "engine.jar",
        "junit-standalone.jar"
    ],
}

No tests are discovered in the Testing side-bar and nothing happens when clicking Run Tests. Any suggestions?

I've created a branch with my vscode setup and some screenshots as examples: https://github.com/emyklebost/fhir-tdp/tree/vscode-integration

@emyklebost
Copy link

emyklebost commented Sep 26, 2021

Cucumber's JUnit5 Test Engine is also relevant. Adding support for other DiscoverySelectors than Class- and Method-Selectors will allow for tests written in Gherkin and other custom DSLs to be discovered and runnable in vscode.

@YashinaTatiana
Copy link

Hello! @jdneo could you please clarify do I understand correctly that UniqueIdSelector is not supported for now?
No tests found for customized JUnit5 TestEngine in vscode.

@jdneo
Copy link
Member Author

jdneo commented Mar 12, 2023

Could you provide more details? Like a sample project or sth?

Currently the test discovery is annotation based. Tests annotated by @Testable will be marked as test items.

@YashinaTatiana
Copy link

YashinaTatiana commented Mar 15, 2023

The idea is similar to running .feature files in Cucumber. Our tests are located in a custom folder and are defined in toml files (contain steps, expected result, etc.) rather than in Java classes, so we don't have @Test annotations. The customized JUnit5 TestEngine is used for test execution.

Do I understand correctly that this configuration is not supported currently in Visual Studio code, since test discovery is annotation based? or maybe there are some additional steps/workaround that can be used to run tests with a custom TestEngine that will detect tests with an overridden discover method?

Thanks

@jdneo
Copy link
Member Author

jdneo commented Mar 15, 2023

Since current test discovery is annotation based, looks like your case might not be supported now. Have you tried in Eclipse? If Eclipse supports your case, we should be able to support it too.

@YashinaTatiana
Copy link

YashinaTatiana commented Mar 15, 2023

I was able to run tests in IntelliJ IDEA via Run 'All Tests' button on src/../java (and directory marked as test source root). Tried in Eclipse, getting No tests found using Junit5 error

@YashinaTatiana
Copy link

Looks like the custom junit5 TestEngine is not recognized by Visual Studio code. Method discover of custom TestEngine is not invoked. Could you please clarify if integration with customized TestEngine is supported? maybe some additional setup is required ?

@jdneo
Copy link
Member Author

jdneo commented Mar 17, 2023

Our implementation is similar with Eclipse. So, I'm afraid it's not supported right now.

Is it possible to share a sample project for your request?

@YashinaTatiana
Copy link

got it, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants