Passing Variables via command line with Spoon/Espresso (android-test-kit)

981 views Asked by At

I am running Espresso test with Spoon. How can I pass a value in to my test at runtime? I have done things like this before, but I do not have an onCreate in my Espresso test. So, how should I pass them in?


Currently I am running my test via command:

gradle spoon

1

There are 1 answers

0
quickdraw mcgraw On BEST ANSWER

Have you thought about using a response file which is deployed to each of the test devices, or accessible via a central network location?

The response file could be read in and parsed in the setUp() method in your Espresso test to configure any parameters that you require for individual tests.

The format of the response file could be plain text or XML formatted.

If you have many test case classes for example ActivityInstrumentationTestCase2() you could create a base class that implements the parameter parsing and derive all your test classes from that.