junit5

How do I set up a Spring Data Neo4j integration test with JUnit 5 (in Kotlin)?

雨燕双飞 提交于 2020-03-16 08:10:13
问题 Most examples around the Web for doing Spring integration tests with Neo4j are still on JUnit 4, and use the Neo4jRule. How do we create a setup for Neo4j + Spring + JUnit 5? 回答1: If you are testing on embedded, please use the Test Harness with a simple Spring Configuration. Here are some examples: https://medium.com/neo4j/testing-your-neo4j-based-java-application-34bef487cc3c https://github.com/michael-simons/neo4j-sdn-ogm-tips/tree/master/examples/using-the-test-harness https://github.com

How do I set up a Spring Data Neo4j integration test with JUnit 5 (in Kotlin)?

让人想犯罪 __ 提交于 2020-03-16 08:08:10
问题 Most examples around the Web for doing Spring integration tests with Neo4j are still on JUnit 4, and use the Neo4jRule. How do we create a setup for Neo4j + Spring + JUnit 5? 回答1: If you are testing on embedded, please use the Test Harness with a simple Spring Configuration. Here are some examples: https://medium.com/neo4j/testing-your-neo4j-based-java-application-34bef487cc3c https://github.com/michael-simons/neo4j-sdn-ogm-tips/tree/master/examples/using-the-test-harness https://github.com

How to combine JUnit annotations into a custom annotation?

我怕爱的太早我们不能终老 提交于 2020-03-05 04:58:07
问题 (Using OpenJDK-13 and JUnit5-Jupiter) The problem is that my unit tests each make use of a not-small JUnit annotation system, something like this: @ParameterizedTest @MethodSource("myorg.ccrtest.testlogic.DataProviders#standardDataProvider") @Tags({@Tag("ccr"), @Tag("standard")}) This makes test authoring a little tedious, test code a little long and of course, when a change is needed, it's a chore! Was wondering if I could create my own JUnit annotation: @CcrStandardTest , which would imply

JUnit5-Jupiter: Composed (=“meta”) annotation does not resolve to annotation definition

感情迁移 提交于 2020-03-04 20:01:06
问题 I defined my own JUnit annotation: @ParameterizedTest @MethodSource("myorg.qa.ccrtesting.DataProviders#standardDataProvider") @Tags({@Tag("ccr"), @Tag("standard")}) public @interface CcrStandardTest { } Then, I was able to use that annotation in my tests: @CcrStandardTest public void E0010_contact_standard (String testData) { ... My run configuration: JVM options: -ea Class: myorg.qa.ccrtesting.ccrstandardtests.CcrStanConTest - This was suggested by the IDE (and is verified to point to the

JUnit5 tag-specific gradle task

南楼画角 提交于 2020-02-18 08:06:19
问题 I use the following annotation to tag my integration tests: @Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Tag("integration-test") public @interface IntegrationTest { } This is the filter I use in build.gradle to exclude these tests from gradle build : junitPlatform { filters { tags { exclude 'integration-test' } } } So far, so good. Now I would like to offer a Gradle task which specifically runs my integration tests – what's the recommended approach?

How to capture stdout/stderr in junit 5 gradle test report?

六眼飞鱼酱① 提交于 2020-01-24 06:43:33
问题 My gradle project uses junit 5 and I'm trying to get the test reports to show up on my build server. The XML report basically looks fine – it contains all the test classes and methods, but it is missing stdout/stderr printed in test methods. There is only some CDATA containing test metadata. @Test void testToString() { System.out.println("Hello world"); ... } XML report: <testcase name="testToString()" classname="com.my.company.PairsTest" time="0.008"> <system-out><![CDATA[ unique-id: [engine

How to replace @Rule annotation in Junit 5?

你离开我真会死。 提交于 2020-01-24 02:01:06
问题 I'm using wiremock in my tests and have such a line of code: @Rule public WireMockRule wireMockRule = new WireMockRule(8080); I want to switch to Junit 5. So I added the next dependency (using gradle): testCompile('org.junit.jupiter:junit-jupiter-engine:5.1.1') But there no suggestions when I'm trying to import @Rule annotation. Do I need to add another module of junit dependency? Or rules are not supported in Junit5? If not how can I replace @Rule annotation to make tests work again? Thanks.

How configure correctly @RunWith(Parameterized.class) + SpringClassRule + SpringMethodRule with a custom @Rule?

谁说胖子不能爱 提交于 2020-01-22 16:38:07
问题 I am working with Spring Framework 4.3.x and JUnit 4, I have the following structure @Transactional @WebAppConfiguration @RunWith(Parameterized.class) @ContextConfiguration(classes={RootApplicationContext.class, ServletApplicationContext.class}) @TestExecutionListeners(listeners={LoggingTestExecutionListener.class}, mergeMode=MergeMode.MERGE_WITH_DEFAULTS) public class CompleteTest { @ClassRule public static final SpringClassRule SPRING_CLASS_RULE = new SpringClassRule(); @Rule public final

Configuration for Gradle 4.7 to generate the HTML report for JUnit 5 tests

怎甘沉沦 提交于 2020-01-21 15:06:05
问题 I have an app based as follows: Spring Framework 5.0.4.RELEASE Gradle 4.7 - multimodule project configured through JUnit 5.1.1 The configuration about Gradle with JUnit is in the build.gradle file located in the root module: ... subprojects { apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'org.junit.platform.gradle.plugin' sourceCompatibility = '1.8' targetCompatibility = '1.8' repositories { jcenter() } ext { ... junitVersion = '5.1.1' ... } dependencies { ... //Testing ...

Why do JUnit 5 Suite annotations @SelectClasses and @IncludeClassNamePatterns fail to find tests that don't end in “Tests” or “Test”?

丶灬走出姿态 提交于 2020-01-16 09:09:34
问题 While upgrading to JUnit 5 (version 5.5.2), I have made a strange discovery with the suite functionality: my suites can find and run tests that end with the word "Test" but fail to find tests that don't end in "Test" (in my case, they end in "Base"). In JUnit 4, we used the @Suite.SuiteClasses() annotation to find these tests, but the JUnit 5 @SelectClasses annotation seems to miss these test classes entirely. Even using @IncludeClassNamePatterns({"^Com.*Base.*?$"}) fails to detect the tests,