Systers Community

Setup Mockito for writing local unit tests for anyone activity

For running tests on a local development machine, mocking framework like Mockito is used. This testing approach is efficient because it helps to avoid the overhead of loading the target app and unit test code onto a physical device or emulator every time your test is run. Consequently, the execution time for running your unit test is greatly reduced.

Prerequisite:

  • Setup Powerup Android using the instructions given here.

Steps:

  • Include the Mockito library dependency in your build.gradle file, as described [here] (http://site.mockito.org/#how)
  • Write a mockito unit test for anyone activity mentioned here
  • Execute code and verify if application is working correctly.
  • If necessary, use Powermock to mock the bundle class using base mockito.

Resources

Work Submission:

  • Submit screenshots highlighting the end result of the test.
  • Submit copy of your test file.

Task tags

  • mockito
  • testing

Students who completed this task

Fidella, Valentun, Boluwatife Tejumola, Siddharth Venu

Task type

  • done_all Quality Assurance
close

2017