1

I'm developing an Android application with database storage.

I want to test some classes that I use to access database.

I've found ActivityInstrumentationTestCase2 to test Activities but I haven't found anything to test classes.

How can I do that? I haven't used jUnit before.

Thanks.

1 Answer 1

2

I always use AndroidTestCases when writing unit tests for the Android platform. They provide access to a Context instance (if required), but otherwise work like the standard JUnit test class. You may also need to look at AndroidTestRunner to test your classes. There are some good tutorials out there; now that you know what to look for, I'm sure you can find them. Happy hunting! :D

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. I asked this question a month ago, and at the end I have finished using the same classes to say in your reply.
I'm sorry to hear that it took this long to receive a reply on what should be an easily answerable question. Hopefully the next time you ask something you get an answer sooner!
Can someone throw up some sample code to show how to setup a test case that uses a data base? I seem to be having Accessor Exceptions when doing so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.