test {// enable TestNG support (default is JUnit)useTestNG()// set a system property for the test JVM(s)systemProperty 'browser', project.getProperty("browser")// explicitly include or exclude testsinclude 'com/eisoo/content/script/TestLogin.class'//include 'com/eisoo/content/script/TestEnterpriseCenter.class'//include 'com/eisoo/content/script/TestStatistics.class'//include 'com/eisoo/content/script/TestContentCenter.class'ignoreFailures = true// show standard out and standard error of the test JVM(s) on the consoletestLogging.showStandardStreams = true// set heap size for the test JVM(s)minHeapSize = "64m"maxHeapSize = "512m"}
然后使用指令 gradle clean test -Pbrowser="firefox"
就可以将选个浏览器的类型传递到 gradle 中