简体   繁体   中英

Tagging not working to run tests in IntelliJ with JUnit5

I'm migrating to Junit5 from 4. Can run all tests fine, single tests fine (both via the green play buttons). When I try to run tests tagged with @Tag ( @Tag("foo") ), it tells me that no tests are found. In the run configuration, I'm putting foo in the "Tag expressions" box, using Test kind: Tags. I've used Categories with Junit4 in the past, and Tags seem like a 1-to-1 replacement, right? I do still have some Category tags in my codebase, as I'm switching over. Several tests tagged with @Tag as well. Whether the @Category tag is present or not makes no difference in the behavior.

IntelliJ result:

Running categories [interface org.junit.Test]

Process finished with exit code 0

在此处输入图片说明

Use ˋorg.junit.jupiter.api.Testˋ instead of ˋorg.junit.Testˋ to run JUnit5 tests. Only those can handle the ˋTagˋ annotation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM