Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 251 Vote(s) - 3.65 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to run parameterized tests with Android Test Orchestrator

#1
I'm trying to run parameterized tests using Android Test Orchestrator. But for some reason parameterized tests won't start. I can run all tests properly without Orchestrator but I need it to clear some data between tests.

This is output from Gradle. It can see all 14 tests but only 12 are executed (missing 2 are parameterized):

Starting 14 tests on Nexus_5X_API_27(AVD) - 8.1.0

Tests on Nexus_5X_API_27(AVD) - 8.1.0 failed: Test run failed to complete. Expected 14 tests, received 12

Test run failed to complete. Expected 14 tests, received 12

**Gradle:**

android {

defaultConfig {
testInstrumentationRunner "foo.bar.CustomRunner"
}

testOptions {
unitTests.returnDefaultValues = true
execution 'ANDROID_TEST_ORCHESTRATOR'
}
}

dependencies {
androidTestImplementation "com.android.support.test:runner:$runnerVersion"
androidTestUtil "com.android.support.test:orchestrator:$runnerVersion"
}

**Test:**

@LargeTest
@RunWith(Parameterized::class)
class ParamTest(val param1: String, val param2: String) {

companion object {
@JvmStatic
@Parameterized.Parameters
fun data(): Collection<Array<Any>> {
return listOf(
arrayOf("param1", "param2"),
arrayOf("param21", "param22")
)
}
}

@Test
fun shouldDoSthWithParams() {
//some test
}

}

**EDIT:**

As a workaround sealed class can be used:

@LargeTest
@RunWith(AndroidJUnit4::class)
class ParamTest1 : ParamTest("param1", "param2")

@LargeTest
@RunWith(AndroidJUnit4::class)
class ParamTest2 : ParamTest("param21", "param22")

sealed class ParamTest(val param1: String, val param2: String) {

@Test
fun shouldDoSthWithParams() {
//some test
}

}
Reply

#2
Parameterized tests aren't currently supported in Orchestrator:

[To see links please register here]

Reply

#3
The issue was fixed in version `1.3.0-beta02` of the `androidx.test:runner` library. See the [AndroidX Test 1.3.0 Beta02][1] release notes which calls this issue out explicitly as fixed.


[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through