spockframework / spockframework/spock

Grails Spock plugin breaks create-integration-test script

Open
#369 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Module-Core Type-Defect
Dominant language
Java
Stars
3.6k
Forks
483
PR merge metrics
No merged PRs in 30d

Description

Originally reported on Google Code with ID 247

What steps will reproduce the problem? If possible, provide source code and
stack trace.
1. Install the plugin
2. create an integration test via the grails command / script
3. You have to have several other unit and integration tests, preferably that interact
with GORM or other dynamic methods.
4. Now, see the inclusion of @TestMixin(GrailsUnitTestMixin)?  Yeah, that causes random
test failures in both the unit and integration test phases depending on what other
tests you have.  You cannot have ANY unit test artifacts in integration tests or it
corrupts the test environments of both.

Note on #4, this ONLY affects grails 2.0.x installs and is related to the changes in
using mixins as far as I can tell.  It's not specific to the spock plugin either. 
Add that mixin to a normal/preexisting integration test and it should produce similar
errors.  I had to swap the styles of all unit and integration tests on upgrading to
2.0.x.  Having said that, the fix is to change whatever mods to the create script were
made, to not include that annotation for integration tests.

What version of Spock and Groovy are you using?
spock 0.6 groovy 1.8.6 and grails 2.0.3


Please provide any additional information below. You can also assign
labels.

Very cool plugin, but why hijack the create-XX-test scripts?  I'd honestly much prefer
to have the option of creating spock specs or standard tests... meaning, you should
probably create your own 'create' script.

Reported by robb.dan on 2012-04-14 22:00:14

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Grails create-integration-test script and the generated integration test, then reproduce the failure with unit and integration tests that use GORM or other dynamic methods. Check the generated use of @TestMixin(GrailsUnitTestMixin) on Grails 2.0.x and confirm that removing it prevents cross-phase test-environment corruption.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.