Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

singleInstrumentationCall error #13

Closed
hram opened this issue Dec 15, 2017 · 10 comments
Closed

singleInstrumentationCall error #13

hram opened this issue Dec 15, 2017 · 10 comments

Comments

@hram
Copy link

hram commented Dec 15, 2017

I'v test project with this spoon config

spoon {
if (project.hasProperty('spoonPackageName')) {
instrumentationArgs = ['package:' + project.spoonPackageName]
}
}

and I run tests by this command

gradlew clean spoonDebugAndroidTest -PspoonPackageName=hram.testspoon.package1

In 'hram.testspoon.package1' I'v 2 classes with 1 test in each
The problem is that after 2 tests succes run in junit report I'v only one last test

After issues search I'm added parametr singleInstrumentationCall and spoon config like this

spoon {
if (project.hasProperty('spoonPackageName')) {
instrumentationArgs = ['package:' + project.spoonPackageName]
}
singleInstrumentationCall=true
}

But in this case 'package' parameter is ignored and runs all tests in project
And good news is that junit report have all tests )

How can I fix that?

@jaredsburrows
Copy link
Owner

@hram This is currently supported:

.

@hram
Copy link
Author

hram commented Dec 21, 2017

@jaredsburrows pardon for my english
But can you read my message?
I know about singleInstrumentationCall
And I wrote about it
The problem is: "When I set up singleInstrumentationCall = true then package parameter is ignored and runs all available tests instead of specific package"

I think this is spoon problem, but maybe you can help me?

@jaredsburrows
Copy link
Owner

I see. I believe this is another limitation by Spoon 2.

Have you tried using the @SmallTest, @MediumTest and @LargeTest annotations?

@jaredsburrows
Copy link
Owner

Any update on this?

@hram
Copy link
Author

hram commented Jan 19, 2018

In my test project https://github.com/hram/TestSpoonWeblate I have 3 tests:

  • two small tests
  • single large test

if I setup spoon like this

testSize = "SMALL"
singleInstrumentationCall = true

as a result spoon runs all 3 tests

@moodytux
Copy link

I'm also seeing this issue, where setting the parameter "singleInstrumentationCall = true" doesn't shard the tests across devices and instead runs all tests on all devices.

Looking into the logging from running this, it appears that the correct command runs to start with:

11:03:30 I/RemoteAndroidTest: Running am instrument -w -r -e shardIndex 1 -e numShards 2 -e log true uk.co.fakedomain.myapp.test/uk.co.fakedomain.myapp.espresso.TestAndroidJUnitRunner on Nexus_4_API_23_Swiftshader_1_64bit [emulator-5554]
11:03:30 I/RemoteAndroidTest: Running am instrument -w -r -e shardIndex 0 -e numShards 2 -e log true uk.co.fakedomain.myapp.test/uk.co.fakedomain.myapp.espresso.TestAndroidJUnitRunner on Nexus_4_API_23_Swiftshader_2_64bit [emulator-5556]

however, shortly after it runs another command gets run which is breaking the sharding:

2018-01-30 11:03:31 [SDR.run] Ignored tests: []
2018-01-30 11:03:31 [SDR.run] Ignored tests: []
2018-01-30 11:03:31 [SDR.run] Running all tests in a single instrumentation call [emulator-5556]
2018-01-30 11:03:31 [SDR.run] Running all tests in a single instrumentation call [emulator-5554]
2018-01-30 11:03:31 [SDR.runTestOnDevice] Running tests [emulator-5554]
2018-01-30 11:03:31 [SDR.runTestOnDevice] Running tests [emulator-5556]
11:03:31 I/RemoteAndroidTest: Running am instrument -w -r uk.co.fakedomain.myapp.test/uk.co.fakedomain.myapp.espresso.TestAndroidJUnitRunner on Nexus_4_API_23_Swiftshader_1_64bit [emulator-5554]
11:03:31 I/RemoteAndroidTest: Running am instrument -w -r uk.co.fakedomain.myapp.test/uk.co.fakedomain.myapp.espresso.TestAndroidJUnitRunner on Nexus_4_API_23_Swiftshader_2_64bit [emulator-5556]

as there are no shard options specified. Presumably this section was added for when running multiple instrumention calls, because in such case the commands in the second block include the '-e class' parameter so this issue doesn't present itself.

@moodytux
Copy link

I've just noticed that perhaps this is an issue with the underlying spoon library: square/spoon#509

@jaredsburrows
Copy link
Owner

@hram I will fix the "testsize".

@jaredsburrows
Copy link
Owner

@moodytux I hope that fixes the issue soon!

@jaredsburrows
Copy link
Owner

singleInstrumentationCall is supported.
testSize is being fixed here: #24.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants