Android native automation testing
Appfigurate can change the configuration of an Android app being automation tested using using Espresso.
An example UI automation test using Espresso is available in AppfigurateExample. To test, ensure MainActivityTest is selected as the Run Configuration, then tap the run button.

Ensure allowInvalidSignatures returns true
In your nz.co.electricbolt.appfiguratelibrary.Configuration subclass, ensure that your allowInvalidSignatures method returns true when running automation tests.
Test setup
Before each test, call the automationReset method to ensure the app's configuration is reset to factory defaults.
private var config: ExampleConfiguration? = null
@Before
fun setUp() {
config = Configuration.sharedConfiguration() as ExampleConfiguration
config?.automationReset()
}private ExampleConfiguration config;
@Before
public void setUp() {
config = (ExampleConfiguration) Configuration.sharedConfiguration();
config.automationReset();
}Applying configuration to an automation test
In your test method, set your configuration properties to the values you require, then call the automationApply method.
@Test
fun yourTest() {
config?.bool = false
config?.string_Textfield = "thursday"
config?.automationApply()
...@Test
public void yourTest() {
config.bool = false;
config.string_Textfield = "thursday";
config.automationApply();
...Additional automation launch methods
See also automationAction method of nz.co.electricbolt.appfiguratelibrary.Configuration
Applying configuration at runtime to the app under test
Last updated