Questions tagged [junit-jupiter]

JUnit Jupiter is the combination of the new programming model and extension model for writing tests and extensions in JUnit 5.

Use the tag for questions that are specific to JUnit Jupiter.

Use the tag for all other questions related to features provided by JUnit 5 or migration to JUnit 5.

JUnit 5 Resources

263 questions
2
votes
1 answer

JUnit parametrized test with parametrized Spring ApplicationContext configuration

SpringBoot 2.2.11, JUnit 5. My app has several environments. I have a test that tests some conditions in those environments rather than the application itself. Therefore I want to reuse the same test method, but run it against different…
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
2
votes
0 answers

JUnit XML system-out shows logs from all threads

I have a JUnit5 integration test project where I'm running the test classes in parallel. My problem is that my log messages are being mixed together in the junit XML report generated after the test class finishes executing. This makes it difficult…
st0ve
  • 519
  • 3
  • 18
2
votes
1 answer

How to write junit test for DirectoryStream

I have this function in a class called Test.java and it incudes; public List getAllFoldersInTmp(String directory) throws IOException { final List files = new ArrayList<>(); try (DirectoryStream stream =…
Catalina
  • 663
  • 5
  • 20
2
votes
2 answers

How to create a XML report by executing a JAR

I want to develop a stand-alone test-solution delivered as a jar that can be used in a CI/CD environment without being recompiled all the time. Therefore I packed a fat-jar from a multi-maven-module containing a few libaries, a Spring Boot…
froehli
  • 904
  • 1
  • 11
  • 35
2
votes
2 answers

IDE does not recognize Assumptions

I am using Junit5, and my IDE (IntelijIdea) is not recognize Assumptions. I am actually do not know why, but may be there is some dependecy on Maven I do not connect into project. Below I will show you the sample of my code. This is my Assumptions…
Mikhail
  • 195
  • 2
  • 12
2
votes
0 answers

JUnit Jupiter equivalent of JUnit4 Test Case Suites

I am trying to figure out how to create the equivalent of a JUnit4 test case suite in JUnit Jupiter, using Eclipse. For example, let's say I have the following Test Case Suite in JUnit 4: import org.junit.runner.RunWith; import…
Kira Resari
  • 1,718
  • 4
  • 19
  • 50
2
votes
2 answers

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

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…
DraxDomax
  • 1,008
  • 1
  • 9
  • 28
2
votes
1 answer

Spring Boot DataJpaTest (for Repositories) fail with java.lang.IllegalStateException: Failed to load ApplicationContext

I want to test the Repository-Layer of my SpringBootApplication. I used the following Articel: https://www.baeldung.com/spring-boot-testing#integration-testing-with-datajpatest but there's a problem with loading the Application Context. I think…
bernhard
  • 23
  • 1
  • 5
2
votes
2 answers

Redefine template used to create a JUnit 5 class via "Create test" feature of IntelliJ 2019

The menu item Code > Generate… > Test… displays this dialog box. …and produces a method like this in the resulting test class: @Test void fromDuration () { } I want the @DisplayName annotation (new in JUnit 5) to be automatically inserted as well,…
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
2
votes
1 answer

How to use Serenity with Junit5?

I'm trying to run Serenity Tests in my maven project. I'm using junit-jupiter-engine 5.3.1. (It's in the parent pom.) I'm getting multiple error. Is it because the JUnit's version or is there something else? How can I solve it? My test…
pityo10000
  • 117
  • 1
  • 13
2
votes
1 answer

java.lang.IncompatibleClassChangeError org.junit.jupiter.params.provider.Arguments must be InterfaceMethodref constant

import groovy.transform.CompileStatic import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource import java.util.stream.Stream import static…
Anna Ira Hurnaus
  • 1,680
  • 3
  • 19
  • 29
2
votes
3 answers

How to use different webdrivers based on environment

I use selenium-jupiter. I am getting a webdriver from method arguments like this: @Test public void testWithChrome(ChromeDriver chromeDriver) { chromeDriver.get("someUrlHere"); } Now I want to run tests on grid so I need to use webdriver…
2
votes
2 answers

TensorFlow installation denied due to user permissions

I tried to run tensorflow on Jupiter netbook, python 2.7 but I realized it requiered 3.6 pythong version so I followed this steps : Installing with Anaconda Create a conda environment named tensorflow by invoking the following command: C:> conda…
idan
  • 1,508
  • 5
  • 29
  • 60
2
votes
1 answer

How to get rid of the compile time error (despite using the import) for assertThrows? (Java, Eclipse Oxygen)

I am testing out the following code snippet that I found here. Eclipse Oxygen Version: Oxygen.2 Release (4.7.2) - if that matters import org.junit.jupiter.api.Assertions; .... @Test void exceptionTesting() { Executable…
2
votes
0 answers

Unable to debug Junit5 tests on intelliJ older to 2016.2

Q1. Is there any plugin that can provide assistance to debug tests based out of Junit5 on intelliJ IDEA 2015.x? I've gone through articles over the Internet including Running tests for JUnit5 and using Junit5 in intelliJ IDEA which agreed reads out…
Naman
  • 27,789
  • 26
  • 218
  • 353