Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Error message ArrayIndexOutOfBounds with Clover for Android

Hello,

I am trying to use the Clover-for-Android plugin in Eclipse for my Test setup. I followed the instructions on:

https://confluence.atlassian.com/display/CLOVER/Clover-for-Android

Running the App Project on the device works, code coverage can be viewed after manually using the app. When I run the TestProject with "Run as Android JUnit Test" the tests fail with:

java.lang.ArrayIndexOutOfBoundsException

at com.cenqua.clover.PerTestRecorder$One.set(PerTestRecorder.java:219)

at com.cenqua.clover.PerTestRecorder$ThreadVisibilityStrategy$SingleThreaded.set(PerTestRecorder.java:152)

at com.cenqua.clover.GrowableCoverageRecorder$FixedProxy.inc(GrowableCoverageRecorder.java:228)

at eu.fpetersen.robobrain.behavior.BehaviorFactory.getInstance(BehaviorFactory.java:52)

at eu.fpetersen.robobrain.behavior.test.BehaviorFactoryTest.__CLR3_1_7ramiuiez(BehaviorFactoryTest.java:50)

at eu.fpetersen.robobrain.behavior.test.BehaviorFactoryTest.testBehaviorCreation(BehaviorFactoryTest.java:47)

at java.lang.reflect.Method.invokeNative(Native Method)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)

at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)

at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)

at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)

The App-Project is set in the BuildPath of the Test-Project and it is exported. The files are successfully created in the data folder on the device. I have no idea what to do to solve this issue.

Do you have any ideas? Feel free to ask for more information about my setup. I don't know what else is worth sharing right here.

Thanks in advance,

Frederik P.

7 answers

1 accepted

1 vote
Answer accepted

I found a bug - it's reported in CLOV-1194. As a workaround, disable per-test instrumentation:

  • open Project Properties dialog > Clover page > Test Classes tab
  • select "Don't look for tests, assume everything is application source" option

Regards
Marek

I should add, that I found out that some tests run successfully. They also use the MainApp's code and I can't really find a big difference to those methods that fail. The Errors in the different tests do not originate from the same line of my code but it's always the same line of the clover code that throws the exception. As seen above.

if you would like to have a peak into the source code, feel free to do so:

http://server.fpetersen.eu/gitweb/?p=robobrain.git;a=tree

MainApp: RoboBrain

TestProject: RoboBrainTest

0 votes

Hi Frederik,

1) Does this exception occur every time you run your tests?

2) Does it happen also when tests are launched first time after a full rebuild (full workspace clean + removal of clover database + removal of coverage files)?

3) How large is your project (number of statements)?

0 votes

Clover for Android is using a coverage recorder with a dynamically resizable buffer with an initial capacity of 1 million elements (statements + branches + methods). I suspect that your project has exceeded initial buffer size. It can happen also when actual code base is smaller, because every time class is recompiled it adds new data to clover.db database. So the point 2) should help.

Hi Marek,

thanks for your answers. I'll answer your 3 questions:

1) Yes it does occur every time. Some tests run through, most don't.

2) Yes it happens everytime. I did clean up everything several times, did a full rebuild and still it fails.

3) It has only 1,207(App) + 443(Tests) statements according to the clover coverage explorer. The project is really small, I can't imagine that its size could be a problem..

So I just tried removing the clover databases again, removing the coverage files, rebuilding everything, and running the tests again. No luck. It still fails with the stack trace above.

Thanks again for your help!

0 votes

Hi Frederik,

Could you try the following workaround:

  • open Project Properties dialog > Clover page > Test Classes tab
  • select "Don't look for tests, assume everything is application source" option

This will disable per-test coverage so exception should disappear. (Unfortunately Test Contributions and Test Run Explorer will be empty).

Cheers
Marek

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Opsgenie

Investigate deployment-related incidents with Bamboo and Opsgenie together

Back in April of last year one of the major product announcements from Opsgenie was the launch of the Incident investigation view which created a deep connection between Bitbucket and Opsgenie, empow...

90 views 1 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you