Selecting specific tests to run in gradle

后端 未结 3 2087
野趣味
野趣味 2021-02-13 19:13

I\'m trying to fix our messy failing test runs, and, unfortunately, I\'m very new to gradle. We currently have testng, junit, and I\'d like to add some spock tests to the mix a

相关标签:
3条回答
  • 2021-02-13 19:57
    $> gradle test -Dtest.single=YourTestClass
    
    0 讨论(0)
  • 2021-02-13 20:13

    By default, the test task runs all JUnit tests it can find, which includes any Spock tests. To make it run TestNG tests instead, configure the task as follows:

    test {
        useTestNG()
    }
    

    If you have both JUnit and TestNG tests, you need two test tasks, one for each test framework.

    To run a subset of tests, use the -Dtest.single system property. For more information, see the corresponding section in the Gradle User Guide.

    0 讨论(0)
  • 2021-02-13 20:20

    You may provide using the command line:

    $> gradle test --tests org.somewhere.MyTestClass
    

    Or even

    $> gradle test --tests org.somewhere.MyTestClass.my_test_case
    
    0 讨论(0)
提交回复
热议问题