jd96
jd96

Reputation: 595

How do I mark a folder as a test folder in Eclipse?

I have two test directories in my java project. One contains integration tests and another unit tests:

── src
│   ├── it
│   │   └── java
│   ├── main
│   │   ├── java
│   │   └── resources
│   └── test
│       └── java

I'm using the failsafe plugin to run these integration tests. To register the src/it/java directory as a testing source I'm using the build-helper-maven-plugin plugin. See https://stackoverflow.com/a/17866387/11550924 for the full setup.

It works fine from the command line - running mvn verify successfully executes my integration tests.

However in Eclipse I get import warnings on all classes that are scoped as test (e.g. junit) in the integration test classes.

It must be that Eclipse isn't recognising this folder as one which contains tests.

Does anyone know how to tell Eclipse that this folder is a testing folder?

Upvotes: 0

Views: 1257

Answers (1)

jd96
jd96

Reputation: 595

I switched to IntelliJ and this folder structure worked fine.

If you can't do that just put the integration tests under src/test/java/it.

Upvotes: 0

Related Questions