Подтвердить что ты не робот

Gradle - эквивалент тестового {} блока конфигурации для Android

Gradle имеет тестовый конфигурационный блок

https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html

`` `

apply plugin: 'java' // adds 'test' task

test {
  // enable TestNG support (default is JUnit)
  useTestNG()

  // set a system property for the test JVM(s)
  systemProperty 'some.prop', 'value'

  // explicitly include or exclude tests
  include 'org/foo/**'
  exclude 'org/boo/**'

  // show standard out and standard error of the test JVM(s) on the console
  testLogging.showStandardStreams = true

  // set heap size for the test JVM(s)
  minHeapSize = "128m"
  maxHeapSize = "512m"

  // set JVM arguments for the test JVM(s)
  jvmArgs '-XX:MaxPermSize=256m'

  // listen to events in the test execution lifecycle
  beforeTest { descriptor ->
     logger.lifecycle("Running test: " + descriptor)
  }

  // listen to standard out and standard error of the test JVM(s)
  onOutput { descriptor, event ->
     logger.lifecycle("Test: " + descriptor + " produced standard out/err: " + event.message )
  }
}

где можно задать все виды тестовой конфигурации (меня больше всего интересует размер кучи). Есть ли что-то подобное для проектов Android?

4b9b3361

Ответ 1

Есть возможность добавить их. Плагин Android Gradle имеет параметр testOptions, который имеет параметр unitTests, который имеет опцию all.

Итак, если вы пишете:

android {
    testOptions {
        unitTests.all {
           ///apply test parameters
        }
    }
}

тесты будут выполняться с указанными параметрами.