O'Reilly logo

Android Application Testing Guide by Diego Torres Milano

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a test case

As described before, we are creating our test cases in the src folder of the Test project.

In this particular case, we are creating a unit test using JUnit TestCase. Eclipse provides a wizard to help us (File | New... | Junit Test Case).

We are selecting the main project's Activity as the class under test; however this is not relevant in this example.

These are the values that we should enter when we create the test case:

Junit:

Junit 3

Source folder:

MyFirstProjectTest/src

Package:

com.example.aatg.myfirstproject.test

Name:

MyFirstProjectTests

Superclass:

junit.framework.TestCase

Which method stubs would you like to create?

setUp(), tearDown(), constructor

Class under test:

com.example.aatg.myfirstproject.MyFirstProjectActivity ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required