0

I am new in android test cases. i want to write test case for SQLite database. How can i write test cases and how to check that one. please any one help me. Is is possible or not?

In android using Robotium we can test the application, but here can check table created into sqlite, and insert data into database like this type mean how will write testcase for android database connection.

selva
  • 1,503
  • 3
  • 17
  • 24

2 Answers2

1

This is not very well put and I can justify the downvote you received.

However if I get you correctly you deal with one big issue in the Android testing: you will not be able to mock the database (as well as the private file storage). The InstrumentationTestCase allow you to use special Context and use the test project's asset and raw folders, but does not define private file storage and database.

Some time ago I was fighting with this issue and could not solve it. Finally I turned out to be using the real application's database and making sure all the test data is eventually deleted. Ugly unstable and hard to maintain, but there was no other option.

Boris Strandjev
  • 46,145
  • 15
  • 108
  • 135
  • http://stackoverflow.com/questions/3096378/testing-database-on-android-providertestcase2-or-renamingdelegatingcontext – selva Apr 20 '12 at 11:21
  • What @selva is getting at is to use `RenamingDelegatingContext` which allows for test files & test databases as per that linked question. – Richard Le Mesurier Mar 06 '14 at 13:43
0

You have to know the app clearly to write test cases. No one can help you to write test case without knowing the system. See this for an example test case. You can use Robotium to automate your android test case execution.

orchidrudra
  • 1,172
  • 1
  • 12
  • 30