我需要使用Gradle在我的應用程序的特定包中使用命令行在fastfile中運行測試。 我使用這個命令Gradle運行檢測特定程序包上的Android測試
sh './gradlew test --tests "com.package.exemple.*"'
,但它給我這個錯誤
問題配置任務:應用程序:測試命令行。
>未知的命令行選項'--tests'。
我嘗試了很多變體,但沒有人工作。
感謝您的幫助!
我需要使用Gradle在我的應用程序的特定包中使用命令行在fastfile中運行測試。 我使用這個命令Gradle運行檢測特定程序包上的Android測試
sh './gradlew test --tests "com.package.exemple.*"'
,但它給我這個錯誤
問題配置任務:應用程序:測試命令行。
>未知的命令行選項'--tests'。
我嘗試了很多變體,但沒有人工作。
感謝您的幫助!
有一個open issue與此問題有關。請爲它加上星號並使用特定的變體名稱。
當前最高級別的「測試」任務不接受「--test」 參數。相反,您必須針對特定的 變體(例如「testDebugUnitTest」)運行顯式「測試」任務。
您使用的語法是正確的,如文檔in the Gradle User Guide所述。
但似乎VariantName
可能是強制性的建議here。
你可以找到一個例子in the Android Developers Documentation。
Gradle還允許您使用--tests 標誌來針對特定測試。例如,下面的命令只運行指定的生成變異的 sampleTestMethod測試...
./gradlew testVariantName --tests *.sampleTestMethod