Wednesday, June 2, 2010

[android-developers] Failing JUnit tests, not breaking my Ant script like I expect?

My continuous integration server runs an Ant script, which calls
something like:
/tests/ant run-tests

My JUnit tests run, but with errors:
run-tests:
[echo] run-tests-helper.
[echo] Running tests ...
[exec]
[exec] com.zedray.stuff.FooBarTest:....
[exec] com.zedray.stuff.FooBarTest:.....INSTRUMENTATION_RESULT:
shortMsg=Some error in your code.
[exec] INSTRUMENTATION_RESULT:
longMsg=java.security.InvalidParameterException: Some error in your
code
[exec] INSTRUMENTATION_CODE: 0

The errors are OK, but my build script keeps going (eventually
publishing my broken app to my testers - bad!). What I would expect
is for the instrimentaiton to throw a build error, so my continuous
integration server (TeamCity in this case) realises that something has
gone wrong and reports a broken build. The "failonerror" is already
set in the relevant macrodef, so I'm not sure what else I can do?

#### /tests/build.xml ####
<macrodef name="run-tests-helper">
<attribute name="emma.enabled" default="false" />
<element name="extra-instrument-args" optional="yes" />
<sequential>
<echo>Running tests ...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="shell" />
<arg value="am" />
<arg value="instrument" />
<arg value="-w" />
<arg value="-e" />
<arg value="coverage" />
<arg value="@{emma.enabled}" />
<extra-instrument-args />
<arg value="${manifest.package}/${test.runner}" />
</exec>
</sequential>
</macrodef>

Any ideas/suggestions on how to fix this?

Regards
Mark

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment