私は Groovy も Geb も Spock も使ったことがないので、やや適当な回答ですが...
$ gradle firefoxTest
のようにテスト名を打つと、実行されます。
...
さらに言えばfirefoxTestというテスト名さえもプロジェクト内のどこにも存在しません。
firefoxTest
は build.gradle で、テストを実行するタスクとして定義されています。
build.gradle
groovy
1ext {
2 drivers = ["firefox", "chrome", "phantomJs"]
3
4 // ...(中略)...
5}
6// ...(中略)...
7
8drivers.each { driver ->
9 task "${driver}Test"(type: Test) {
10 reports {
11 html.destination = reporting.file("$name/tests")
12 junitXml.destination = file("$buildDir/test-results/$name")
13 }
14
15 outputs.upToDateWhen { false } // Always run tests
16
17 systemProperty "geb.build.reportsDir", reporting.file("$name/geb")
18 systemProperty "geb.env", driver
19
20 // If you wanted to set the baseUrl in your build…
21 // systemProperty "geb.build.baseUrl", "http://myapp.com"
22 }
23}
24
25// ...(以下略)...
drivers = ["firefox", "chrome", "phantomJs"]
となっていることから、task "${driver}Test"(type: Test)
のところで、firefoxTest
、chromeTest
、phontomJsTest
の3つのテストタスクが定義されます。
ですが、プロジェクト内のどのファイルにもこのクラス名を呼ぶような記述はなく、
この、適当な名前にリネームしたクラスですが、GebReportingSpec
を extend しています。先ほどの firefoxTest
などのタスク内に、reports
と書かれていますので、Geb が class path で見つけたクラスの中で、GebReportingSpec
を extend しているクラスを探し出して、実行しているのだと思います。
これはなにも Geb に限ったことではなく、JUnit を含む、Java のテストフレームワークで一般的に行われていることです。