generator-jhipster: Generated java integration tests have incorrect suffix 'IntTest'
Overview of the issue
Maven plugin dedicated to integration tests (maven-failsafe-plugin includes by default tests with IT prefix/suffix, not IntTest prefix/suffix :
https://maven.apache.org/surefire/maven-failsafe-plugin/examples/inclusion-exclusion.html
Motivation for or Use Case
Currently integration tests generated by JHipster are run during test phase by maven-surefire-plugin whereas they should not be run.
Reproduce the error
- Generates a new application from .yo-rc.json.
- Run mvn test
- Output will contains:
[INFO] Running com.mycompany.myapp.web.rest.LogsResourceIntTest
Related issues
Suggest a Fix
JHipster Version(s)
5.7.0
JHipster configuration
{ “generator-jhipster”: { “promptValues”: { “packageName”: “com.mycompany.myapp”, “nativeLanguage”: “en” }, “jhipsterVersion”: “5.7.0”, “applicationType”: “microservice”, “baseName”: “jhipster”, “packageName”: “com.mycompany.myapp”, “packageFolder”: “com/mycompany/myapp”, “serverPort”: “8081”, “authenticationType”: “jwt”, “cacheProvider”: “hazelcast”, “enableHibernateCache”: true, “websocket”: false, “databaseType”: “sql”, “devDatabaseType”: “h2Disk”, “prodDatabaseType”: “mysql”, “searchEngine”: false, “messageBroker”: false, “serviceDiscoveryType”: “eureka”, “buildTool”: “maven”, “enableSwaggerCodegen”: false, “jwtSecretKey”: “N2E3YmM1N2RiOTk3MmFiYWQ3ZGZmNGRjY2U4Mzk2ZWYwNTczMzEyZjdiYjNkYmU5NWY4YmQyZThhNzNmYWQwZjdjMTlhODg4MDJmOTE5ODBhNzY2OWViNWEwMDRlMzM5MTkyYTdjMzNmNDUzMzMwNDg4NDRjNWE5Njg1ZDAxOTc=”, “testFrameworks”: [], “jhiPrefix”: “jhi”, “otherModules”: [], “enableTranslation”: true, “clientPackageManager”: “npm”, “nativeLanguage”: “en”, “languages”: [ “en” ], “skipClient”: true, “skipUserManagement”: true } }
- Checking this box is mandatory (this is just to show you read everything)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 20 (17 by maintainers)
Commits related to this issue
- rename end-to-end tests to IT*.java currently JHipster mix unit tests and integration tests, this change allows to run unit test via `mvn test` and unit+integration via `mvn verify` Fixes #8868 — committed to Allsimon/generator-jhipster by Allsimon 5 years ago
- rename integration tests to *IT.java currently JHipster mix unit tests and integration tests, this change allows to run unit test via `mvn test` and unit+integration via `mvn verify` Fixes #8868 — committed to Allsimon/generator-jhipster by Allsimon 5 years ago
- rename integration tests to *IT.java currently JHipster mix unit tests and integration tests, this change allows to run unit test via `mvn test` and unit+integration via `mvn verify` Fixes #8868 — committed to Allsimon/generator-jhipster by Allsimon 5 years ago
Both #9337 (maven) and #9328 (gradle) have been merged, so I am closing this.
Hello,
verify being after the package phase is really useful if you test with some others tools (https://github.com/palantir/docker-compose-rule in a multi module maven project for example).
Purely subjectively, I’d argue that the “slow” feedback loop is in fact “much faster”. I usually make a large part of the coverage with standard unit tests and fallback to Spring when we really need it. Instantiating a full Spring app is reaaaaally slow for unit tests.
They literally launch a complete Cassandra container.
I created PR https://github.com/jhipster/generator-jhipster/pull/9174 to separate unit from integration test in maven project @atomfrede can you check for gradle?
I have something working, awaiting some feedback before opening the PR
Here is a task lists gathered from #6131, #6149: (I might have missed something)
Yes for me the discussion on #6131 is still accurate, and I still haven’t any Java developer separate unit tests and integration tests (and that’s bad, and I know it, but that’s the way people work).
Now we’ve always tried to provide “best practices” and push new and interesting stuff, so I’m totally in favor of changing this, I just have 2 issues with this:
Thanks @Allsimon !
I don’t necessary agree with the separate source/resource folder. It’s not standard. But I don’t have the final word 😃
Regarding separate coverage for UT/IT I don’t understand why it’s needed. On the contrary, we should make sure coverage is consolidated.
And for migrating existing IT, I’m not sure… maybe take a look to https://github.com/jhipster/generator-jhipster/blob/master/generators/app/index.js#L452 and cleanup.js to see if it can be used.