How to run JUnit tests with Gradle?

前端 未结 5 1187
野的像风
野的像风 2020-12-12 20:19

Currently I have the following build.gradle file:

apply plugin: \'java\'

sourceSets {
    main {
        java {
            srcDir \'src/model\'
           


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-12 20:28

    If you want to add a sourceSet for testing in addition to all the existing ones, within a module regardless of the active flavor:

    sourceSets {
        test {
            java.srcDirs += [
                    'src/customDir/test/kotlin'
            ]
            print(java.srcDirs)   // Clean
        }
    }
    

    Pay attention to the operator += and if you want to run integration tests change test to androidTest.

    GL

提交回复
热议问题