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?
You can also annotate POJO unit tests with
@Category(MediumTest.class)
or@Category(LargeTest.class)
, etc. by defining your own Categories - see the test-categories repo for an exampleAs an addition to Davidann's answer and mainly OP's question in the comment:
You can run a group of tests annotated with specific annotation.
From AndroidJUnitRunner documentation:
You may also setup those params through gradle:
See this blog post for more details.
This blog post explains it best. Basically, it is the following:
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.