久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

有沒有辦法只在 Android Gradle 項目中運行一組特定

Is there a way to only run a specific set of instrumentation tests in an Android Gradle project?(有沒有辦法只在 Android Gradle 項目中運行一組特定的儀器測試?)
本文介紹了有沒有辦法只在 Android Gradle 項目中運行一組特定的儀器測試?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 Android/Gradle 項目.每當我想運行測試時,我都會運行:

./gradlew connectedInstrumentTest

它在我的項目的測試文件夾下運行我的所有測試.

我的測試文件夾有幾個自動化測試以及非自動化測試.我最感興趣的是在沒有慢速自動化測試的情況下運行快速的非自動化測試.

有沒有辦法只運行一組特定的測試,例如來自一個特定的類或類似的東西?我基本上是在詢問任何類型的分離,以便我可以在需要時選擇只運行幾個測試.

<小時>

這里創建了一個示例項目..p>

編輯 local.properties 以指向您的 Android SDK.

接下來,啟動模擬器或將手機連接到計算機.然后您可以使用 ./gradlew connectedInstrumentTest --info 運行測試.這會運行所有測試.

我無法弄清楚的是如何只在一個類而不是所有測試中運行測試.

解決方案

Android Gradle Plugin 1.3.0 起

從 1.3.0 版開始,您可以(終于!)指定 Android Gradle 插件必須傳遞給 InstrumentationTestRunner 的參數.

例如,如果您只想運行帶有 @SmallTest 注釋的測試并忽略其他測試:

<代碼>android {//....默認配置 {//....testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"testInstrumentationRunnerArgument "size", "small"}}

<小時>

舊的解決方法在插件 1.3.0 之前無法做到這一點,但我發現了一些解決方法.基本上我已經用 @SmallTest 注釋對快速測試進行了注釋,并使用 InstrumentationTestRunner 的自定義子類我能夠只運行它們而不是整個套件.

您可以在this gist中找到示例代碼.

I have an Android/Gradle project. Whenever I want to run tests, I run:

./gradlew connectedInstrumentTest

which runs all my tests under the test folder of my project.

My test folder has several automation tests as well as non-automation tests. I'm mostly interested in running the fast non-automation tests without the slow automation tests.

Is there a way to run just a specific set of tests, such as from one specific class or anything similar? I'm basically asking about any kind of separation so that I can choose to run just a few tests when I want to.


Created a sample project here.

Edit local.properties to point at your Android SDK.

Next, start up an emulator or connect a phone to your computer. Then you can run tests using ./gradlew connectedInstrumentTest --info. This runs all tests.

What I am unable to figure out is how to only run tests in, say, one class and not all tests.

解決方案

Since Android Gradle Plugin 1.3.0

Starting from version 1.3.0 you can (finally!) specify the arguments the Android Gradle Plugin have to pass to the InstrumentationTestRunner.

For example, if you want to run only the tests annotated with @SmallTest and ignore the others:

android {
  //....
  defaultConfig {
  //....
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    testInstrumentationRunnerArgument "size", "small"
  }
}


Old workaround Prior to plugin 1.3.0 is not possible to do that but I've found a little workaound. Basically I've annotated with the @SmallTest annotation the fast tests and using a custom subclass of the InstrumentationTestRunner I'm able to run just them and not the whole suite.

You can found the example code in this gist.

這篇關于有沒有辦法只在 Android Gradle 項目中運行一組特定的儀器測試?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現 IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 成人av网站在线观看 | 国产日韩精品久久 | 少妇一级淫片免费放播放 | 精品国产91 | 国精日本亚洲欧州国产中文久久 | 不卡一二三区 | 一级毛片色一级 | 国产一区精品 | 美国一级黄色片 | 日本精品一区二区 | 成在线人视频免费视频 | 成人久久18免费网站麻豆 | 中文字幕在线剧情 | 成人h片在线观看 | www.47久久青青 | 国产一二三区在线 | 在线中文视频 | 午夜小电影 | 亚洲 欧美 日韩 精品 | 国产xxx在线观看 | 久久久精品一区 | 日韩精品一区二区在线观看 | 中文字幕日韩一区 | 日韩精品色网 | 中文字幕日韩欧美一区二区三区 | 亚洲精品黑人 | 日本一区二区电影 | 国产精品视频一二三区 | 国产一区二区在线免费观看 | 欧美一级欧美一级在线播放 | 九九久久精品 | 一级黄色毛片a | 久久最新精品 | 依人成人 | 成人在线视频观看 | 欧美白人做受xxxx视频 | 国产成人在线一区 | 欧美日韩国产精品激情在线播放 | 亚洲午夜精品视频 | 欧美日韩视频 | 国产欧美一级二级三级在线视频 |