2

I have developed some app when I was a beginner, I was doing manual testing. Should I go for unit testing or instrumentation testing?

2
  • definitely ! :) Commented Dec 7, 2016 at 14:12
  • Take a look on TDD "Test-driven development", Commented Dec 7, 2016 at 14:15

2 Answers 2

4

Yes you should do it. There is no excuse to let it slide since Android is providing a nice UI Test Framework Espresso

With simple code like this e.g.

onView(withId(R.id.my_view))            // withId(R.id.my_view) is a ViewMatcher
        .perform(click())               // click() is a ViewAction
        .check(matches(isDisplayed())); // matches(isDisplayed()) is a ViewAssertion

and with the new Espresso Test Recorder you can even record your test cases. It's still in beta, but it creates a handy code snippet which you can base your tests on.

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

Comments

0

Unit test only use for method or class test. Thats are invisible items on Ui. But you will use espresso or ui automator test. Espresso depends on your ui code. Uiautomator never needs your ui code only use accessibility api and perform actions via this api.

Comments

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.