-
Notifications
You must be signed in to change notification settings - Fork 44
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
How to use with @ContextConfiguration(locations = {"classpath:testContext.xml"}) #6
Comments
Nothing has changed with regard to support for XML configuration files. Thus, you must have configured something incorrectly. Where does your Is it in the root of your classpath (e.g., |
As a side note, the declaration of |
Thanks for the answer. Yes it is in my classpath, I use the default folder structure and IDEA lint validations is ok with
Maven test-compile produces:
New maven dependencies for JUnit5: <junit.jupiter.version>5.0.0-M2</junit.jupiter.version>
<junit.vintage.version>4.12.0-M2</junit.vintage.version>
<junit.platform.version>1.0.0-M2</junit.platform.version>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit.platform.version}</version>
</dependency>
</dependencies>
</plugin>
...
<!-- JUnit -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit.vintage.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.test</groupId>
<artifactId>spring-test-junit5</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<scope>test</scope>
</dependency> PS. Thanks for the side note |
I just introduced a test exactly like you have described in 36b00d6.
The above passes without any errors when using Thus, generally speaking, XML configuration is certainly supported. |
If you could create a simple project that reproduces the problem you're encountering (e.g., in a public Git repository), I would be happy to look into it. |
Thanks Sam, ok during next week I will try to prepare it, so I can also test it separately from my project. |
Sounds good. Thanks! |
Sam, thanks to your new test, I was able to check better your code and the problem is that I have old import org.junit.Before;
import org.junit.Test; I couldn't be aware of them because it compiles as it should be, but they don't work with JUnit5, so we have to import: import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; Maybe you can specify this in your README to remind us that we need to be sure to use Annotations from the new |
Another little question, how to force execution orders? |
|
As of JUnit 5.0 M2, there is no support yet for controlling the order in which tests in JUnit Jupiter are executed. See the following issues for details: |
Sure, I can add a note on that. |
Closing this issue since the original poster has resolved the issue. |
Thanks for the support! |
You're welcome! |
Note added to README in 57aaa1f. |
I write here for another thing:
Indeed I also have empty suite: @RunWith(JUnitPlatform.class)
@IncludeEngines("junit-jupiter")
@SelectPackages("eu.davidea.tamarindo")
public class AllTests {
} |
Your last question is not related to the |
Hello, I was trying out this extension but it seems that Spring is not initialized if used with
.xml
.I launched your JUnit tests in your project with
@ContextConfiguration(classes = TestConfig.class)
and they works.My bean with
@Autowired
has null pointer.Here my code snipped:
Service is null when used in the tests.
The text was updated successfully, but these errors were encountered: