Unit and integration tests get the same default name

In Grails, unit tests and integration tests are generated using the same naming convention, so if you test a domain class with a name Foo, both tests are generated with a name FooTestsin the same package. Is there an expectation that I should have either a unit test or an integration test, but not both? Do people put their integration tests into another package from their unit tests or rename them? What is the preferred way to get around this?

btw I hacked grails / scripts / _GrailsCreateArtifacts.groovy to change the way classes are generated to force it to generate different names (the value for the suffix property is all that has changed). I don’t like to include something that means “integration” in the name when the class is in the folder with the name “integration”, but this at least avoids manual renaming.

createIntegrationTest = { Map args = [:] ->
    def superClass = args["superClass"] ?: "GroovyTestCase"
    createArtifact(name: args["name"], suffix: "${args['suffix']}IntTests", 
        type: "Tests", path: "test/integration", superClass: superClass)
}
+5
source share
1 answer

I think giving them a different name is the right choice.

*IntTests 

or

*IntegrationTests
+4
source

All Articles