junit5

Upgrade from JUnit 4 to JUnit 5 in intellij with gradle

僤鯓⒐⒋嵵緔 提交于 2019-12-11 05:53:59
问题 I want to convert my Gradle project test from JUnit 4 to JUnit 5. As there are a lot of tests, I don't want to convert them all at the same time. I try to configure my build.gradle like this: apply plugin: 'java' compileTestJava { sourceCompatibility = 1.8 targetCompatibility = 1.8 } repositories { mavenCentral() } dependencies { testCompile("junit:junit:4.12") testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.0-M2' testRuntime("org.junit.vintage:junit-vintage-engine:4.12.0-M2")

Is there a Neo4j test harness that uses the JUnit 5 Extension Model?

筅森魡賤 提交于 2019-12-11 04:46:22
问题 In writing test cases for Neo4j I would like to move onto using just the JUnit 5 Extension Model and not use org.junit.vintage or junit-jupiter-migrationsupport . Currently I can only find the Neo4j test-harness for JUnit 4 which uses TestRule and is dependent on org.junit.vintage and junit-jupiter-migrationsupport . Is there a Neo4j test harness for JUnit 5 that uses the Extension Model? References: Neo4j: Home, GitHub Neo4j test-harness : Maven, GitHub, pom.xml JUnit 4: GitHub JUnit 4

Running Groovy test cases with JUnit 5

为君一笑 提交于 2019-12-10 23:37:25
问题 Maybe this is very simple, but I couldn't find any examples on the web: I'd like to use JUnit 5 to run a unit test implemented as a Groovy class. My current setup seems to launch JUnit 5, but fail to detect the test case. IntelliJ recognizes the test, but fails to run it. If I add a Java unit test, it is launched correctly. Here's what I have now: Project structure src main groovy # production code test groovy UnitTest.groovy build.gradle ... build.gradle plugins { id 'groovy' } dependencies

Single JUnit5 test execution with Gradle

浪尽此生 提交于 2019-12-10 17:50:02
问题 I tried to run only one test class from Gradle. I used these commands: gradle -Dtest.single=Junit5Test test gradle test --tests ru.tests.runner.Junit5Test But it runs all of the project's tests. I need to run only one test class. Here is my class: public class Junit5Test { public static void main(String[] args) { LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request() .selectors( selectPackage("ru.tests.api") ) .build(); Launcher launcher = LauncherFactory.create();

When will scenario tests be available in JUnit 5?

∥☆過路亽.° 提交于 2019-12-10 17:43:52
问题 At a conference (JavaForum Stuttgart 2016) they said that JUnit 5 will include a feature to support scenario tests: http://2016.java-forum-stuttgart.de/de/Abstracts+Slot+1.html#art476 They said that TestNG has this feature already, but I don't know TestNG, so I don't know how that looks like. I guess that would be something like in Allure with @Step annotations and the ability to name each step. Is that still planned to implement before the initial version of JUnit 5 is released (general

Any way to run JUnit5 tests in parallel?

那年仲夏 提交于 2019-12-10 16:25:16
问题 Previously I was using Maven+Selenide+JUnit4 for my tests and it was fine, parallel running worked perfectly. Example: <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven.surefire.plugin}</version> <configuration> <parallel>all</parallel> <perCoreThreadCount>true</perCoreThreadCount> <threadCount>4</threadCount> <perCoreThreadCount>false</perCoreThreadCount> <redirectTestOutputToFile>true</redirectTestOutputToFile> <

How to pass gradle systemProperties JUnit5 tests?

不羁岁月 提交于 2019-12-10 14:07:08
问题 I am using gradle 3.5 and Unit 5 (jupiter) . I wish to pass System property to my tests, in order to configure the test I am running the test using this command gradle test -Denv=envFile1 Here is my gradle file : buildscript { repositories { mavenCentral() } dependencies { classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M4' //JUnit 5 } } repositories { mavenCentral() } ext.versionJunitPlatform = '1.0.0-M4' ext.versionJunitJupiter = '5.0.0-M4' ext.versionLog4j = '1.2.17' ext

Unable to run tests with JUnit5 Console Launcher

早过忘川 提交于 2019-12-10 13:51:45
问题 I am trying to run a simple test with the JUnit5 console launcher. I tried several options, but it does not work. Can somebody tell me what goes wrong? java -jar .\junit-platform-console-standalone-1.0.0-RC3.jar -c AFirstTest.class java -jar .\junit-platform-console-standalone-1.0.0-RC3.jar -c AFirstTest gives me a warning WARNUNG: TestEngine with ID 'junit-jupiter' failed to discover tests I tried to run all tests in the directory, but this does not seem to find the test: java -jar .\junit

JUnit 5 and Spring Framework 4.3.x

自古美人都是妖i 提交于 2019-12-10 13:24:09
问题 Is it right, that JUnit 4.12 and junit-vintage-engine (from JUnit 5) can be used together with Spring Framework 4.3.x? Is there a possibility to also use junit-jupiter-api and junit-jupiter-engine (both from JUnit 5)? 回答1: I assume you mean Spring integration tests, something like: import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class)

JUnit5 integration tests with Gradle 4.6

时光怂恿深爱的人放手 提交于 2019-12-10 11:09:27
问题 Gradle 4.6 added support for JUnit5. This works for me as long as I don't have another sourceset for e.g. integration tests: I do not know how to enable useJUnitPlatform() in my integration tests. What I was able to do is to have test task working with new JUnit5 support, but my testInt task was using JUnit5 console and running tests as it would run from command line. At the end I ditch JUnit5 support in gradle and rollback to using JUnit5 console for both tests. How to enable Gradle 4.6