Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of @SmallTest, @MediumTest, and @LargeTest annotations in Android?

I'm new to Android and I've seen example code using these annotations. For example:

@SmallTest public void testStuff() {     TouchUtils.tapView(this, anEditTextView);     sendKeys("H E L P SPACE M E PERIOD");     assertEquals("help me.", anEditTextView.getText().toString()); } 

What does that annotation accomplish?

like image 433
Eric Palakovich Carr Avatar asked Jan 12 '11 17:01

Eric Palakovich Carr


1 Answers

This blog post explains it best. Basically, it is the following:

testing chart

  1. Small: this test doesn't interact with any file system or network.
  2. Medium: Accesses file systems on box which is running tests.
  3. Large: Accesses external file systems, networks, etc.

Per the Android Developers blog, a small test should take < 100ms, a medium test < 2s, and a large test < 120s.

See this page (search for "@SmallTest") on how to specify which tests get run.

like image 136
David Weiser Avatar answered Oct 11 '22 14:10

David Weiser