Uninstall the application before starting the test

We are trying to write InstrumentTest for our application.

For example, I want to write a test for authorization / registration.

However, before each test I want to be unauthorized? so i need to clear all data, delete db etc.

So, is there a way to delete application or application data before each test?

+3
source share
2 answers

Use annotations, for example:

@BeforeEach

and put your clearing code here.

+1
source

Using Android studio, you can create a test configuration that first removes your application before running the test.

Create a new external tool.

  • "" → " ".
  • "+", .
  • " myApp" ( )
  • " " ( )
  • "adb"
  • "".

, , "" → " " → " myApp" .

2. .

  • " ".
  • Android Tests, .
  • " :..." "+".
  • " ".
  • " myApp" .
  • , Gradle -aware Make.
  • "".

, , , .

+8

Source: https://habr.com/ru/post/1627832/


All Articles