"create tests" generates integration tests instead of unit tests
I really like the Grails-aware navigation bar that shows up when I'm editing Grails domain classes, controllers and views. It also has entries for navigating to/creating tests for the domain classes and controllers. Unfortunately, both of these assume that we're creating these tests as integration tests instead of unit tests. I much prefer creating unit tests (and mocking as necessary) because the tests can be run via the Junit configuration, which is way faster and provides feedback in the Run window about the test status and failing assertions.
Is there any way to link these entries in the navigation bar to unit tests instead of integration tests?
请先登录再写评论。
There's currently no way to do this automatically besides invoking
Grails command line (CtrlAltG). Please feel free to create a JIRA issue.
I probably should have titled my post differently. Creating the tests isn't really such a big issue since that's a one time occurrence, and it could be handled with ctrl-alt-g as you suggest. What I really miss is the ability to navigate between the domain class and controller and their corresponding tests by clicking on the buttons in the nav bar. I assume the response for that is the same, right?
Is there a better way to refer to this grails-aware nav bar if I open a JIRA issue? I wasn't sure what to call it so I made up that name.
Not exactly. Then it's a bug, but I can't imagine how could that be.
Please describe your domain/controller/tests layout, the class names and
locations.
Grails navigation bar?
My structure is as follows:
/grails-app/controllers/com/tha/registry/PersonController.groovy
/grails-app/domain/com/tha/registry/Person.groovy
/grails-app/views/person/create.gsp (and edit/list/show)
/test/unit/com/tha/registry/PersonControllerTests.groovy
/test/unit/com/tha/registry/PersonTests.groovy
I can navigate back and forth between the domain class, the controller and the views, but not the tests. I did just notice that when editing a view, I can navigate to PersonTests.groovy, but not the controller test and that is only available when editing the view, not the other files. When editing PersonTests.groovy or PersonControllerTests.groovy the Grails navigation bar is not present.
Which IDEA version are you using? Seems that IDEA 9 should navigate
correctly. You may try it.