• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Failing Tests to Report as Failed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I asked this question on SO but haven't had much luck there. So I'll ask it here again.

I've written a unit test that simply extends TestCase and I have the following:


When I run my tests using ant test or adb shell am instrument I get the following results:



I'd expect to see a failure on the command line.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The failure should appear in LogCat:
12-18 15:21:47.751: I/TestRunner(1343): junit.framework.AssertionFailedError: What does fail look like?
12-18 15:21:47.751: I/TestRunner(1343): at junit.framework.Assert.fail(Assert.java:50)
12-18 15:21:47.751: I/TestRunner(1343): at com.mycompany.myapp.test.FailTest.testFail(FailTest.java:23)

This was for this code:


I also had that verbose message posted, but I didn't paste verbosely here (too... verbose ;).

Note: this was an Android JUnit project, run in Eclipse using the Android JUnit Test run configuration, and an emulator to run the test on. There is also a view in eclipse which shows the number of runs, successes, and failures, which shows 1 run and 1 failure. I expect running from the command line adb will cause the LogCat output but obviously not the report in Eclipse.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Steve. I'm not using Eclipse. I'm using IntelliJ but it is basically doing the same thing. I'll take a look at the logs when I get home and can get back on this bit of work. The problem, however, is still that Jenkins will not be running these tests with Eclipse. If it isn't exiting with a non 0 error code, I'm not sure how to automate this stuff so that it gets reported correctly.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I just ran it with the adb tool from the SDK manually, and it did report out to the command line:


<note: the command is all on one line (the -w is not separated on a new line, but I formatted it to fit better in the code tags)>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic