Unit tests Flashcards
Why use unit tests?
Unit tests allow you to quickly catch bugs & errors that were introduced by a change in the code.
They will test the functionality of a specific piece of code, the smaller the unit the better as this allows for precise identification of the bug.
What are local tests?
Unit tests that only run on your machine, using the Java Virtual Machine (JVM). These tests shouldn’t test android objects, only kotlin/java objects.
We use local tests for business logic. JUnit is often use for these tests.
What are instrumented tests?
Unit tests that run on an android device or emulator. They have access to instrumentation information like the context of an activity. We use these tests to test android code.
What is Mockito used for?
For creating mock objects instead of having a unit test call a remote server for a response.
What are UI tests?
Simulates a person using the app, where a robot will interact with the widgets on the screen. Expresso is commonly used for these types of tests.
Should you test external libraries in your unit tests?
No, external libraries can change and should not be included in unit tests.
What experience have you had with Unit tests?
I’ve created NUnit tests (which is a unit testing framework for .NET) to test the business logic of the RSH app.
Example: Unit test for testing an email validation method.