Permalink
Browse files

GRAILS-6296 - tests for individual test method targeting.

  • Loading branch information...
1 parent 2007700 commit 6cbfb3db9273c2cba5cfaa3c5b148a7e2a9eee28 @ldaley ldaley committed May 30, 2010
@@ -1,11 +1,34 @@
import spock.lang.*
class TargetingSpec extends BaseSpec {
-
- def "run a single test"() {
- expect:
- execute('targeting', 'test-app', 'AllPassing') == 0
- output.contains("Running 1 unit test...\nRunning test AllPassingTests...PASSED")
- }
+
+ def "run a single test"() {
+ when:
+ execute('targeting', 'test-app', 'AllPassing')
+
+ then:
+ exitStatus == 0
+ output.contains("Running 2 unit tests...\nRunning test AllPassingTests...PASSED")
+ }
+
+ def "run a single test method"() {
+ when:
+ execute('targeting', 'test-app', 'OnePassingOneFailing.testPassing')
+
+ then:
+ exitStatus == 0
+ output.contains("Running 1 unit test...\nRunning test OnePassingOneFailingTests...PASSED")
+ }
+
+ def "run a single method of two different tests"() {
+ when:
+ // AllPassing.testFailing, but has the same method name as the method in OnePassingOneFailing
+ // So we are testing here that method matching is restricted to the given class
+ execute('targeting', 'test-app', 'OnePassingOneFailing.testPassing', 'AllPassing.testFailing')
+
+ then:
+ exitStatus == 0
+ output.contains("Running 2 unit tests...")
+ }
}
@@ -1,6 +1,12 @@
class AllPassingTests extends GroovyTestCase {
- void testNothing() {
+ void testPassing() {
}
+
+ void testFailing() {
+ // this doesn't fail, but has to be named the same as the
+ // failing method in OnePassingOneFailing to test targeting
+ // methods on different classes
+ }
}

0 comments on commit 6cbfb3d

Please sign in to comment.