ghd214 / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

AndroidJUnit4 should skip tests with failing assumptions #126

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a testcase using the AndroidJUnit4.class runner
2. Create a test with a failing assumption
3. Run test

What is the expected output? What do you see instead?

"The default JUnit runner treats tests with failing assumptions as ignored. 
Custom runners may behave differently."

Expected: Test report contains the test marked as skipped via the <skipped /> 
node

Actual:   The test counts a failure due to a AssumptionViolatedException

What version of the product are you using? On what operating system?

Espresso 2.0 on any operating system

Please provide any additional information below.

Test skips are currently possible through the @Ignore annotation

Attached is an example project.

Original issue reported on code.google.com by Wmbe...@gmail.com on 26 Jan 2015 at 8:27

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by vale...@google.com on 18 Mar 2015 at 5:56

GoogleCodeExporter commented 9 years ago
Fixed in next version.

Original comment by nkors...@google.com on 24 Mar 2015 at 6:13

GoogleCodeExporter commented 9 years ago
Fixed in espresso 2.1

Original comment by valera.z...@gmail.com on 21 Apr 2015 at 10:12

GoogleCodeExporter commented 9 years ago
This does not seem to be fixed in espresso 2.1
Just tried it, using sample from Stephan Linzner : 
https://github.com/googlesamples/android-testing

Adding assumeTrue, or assumeThat to simple espresso tests throws exactly same 
exception and does not mark tests ignored - exactly as stated in the original 
bug report.

Original comment by kiru...@gmail.com on 25 Apr 2015 at 9:35

GoogleCodeExporter commented 9 years ago
Sorry about that, I reopened the issue and check it again.

Quick question though, are you guys using Android Studio, Eclipse or command 
line? 

Original comment by nkors...@google.com on 6 May 2015 at 5:21

GoogleCodeExporter commented 9 years ago
I have been experiencing this issue in Android Studio. 

Original comment by designat...@gmail.com on 19 May 2015 at 7:56

GoogleCodeExporter commented 9 years ago
This issue should be high priority.
I could not skip test cases related to TV when it is running on mobile/tablets.
It will be good, if google provides workaround until this issue is solved.

Original comment by aravinds86 on 20 Jul 2015 at 4:28

GoogleCodeExporter commented 9 years ago
This was fixed on the Runner side. 

Now it has to be fixed on the Android Studio + Gradle side, there is a separate 
bug that's tracking it here: 
https://code.google.com/p/android/issues/detail?id=173919
The current AS target for the fix is set to v1.4

If you run your test via the command line you should see that skipped test no 
longer treated as failures ( adb shell am instrument -w 
<test_package_name>/android.support.test.runner.AndroidJUnitRunner )

Original comment by nkors...@google.com on 20 Jul 2015 at 4:51

GoogleCodeExporter commented 9 years ago
#7: If you're really stuck, here is a horrifying workaround I came up with 
cobbling things together: 
https://gist.github.com/designatednerd/153e4545af912aeed1ff

If you are not *really* stuck, I do not advise using that. It works, but it's 
an unmaintainable hot mess. 

Original comment by designat...@gmail.com on 20 Jul 2015 at 4:52