I am using Android-UiAutomator / Espresso for automating Android app. For web automation i used selenium and for data parameterization used excel sheet and used Apache POI jars to read data.
i just want to know is there any way we can use the excel sheet or can implement data parameterization in Android-UiAutomator/ Espresso ? Right now i am using Spoon framework for reports and execution. Is there any feasibility in spoon framework for this feature.
Appreciate your response.
There isn't an out-of-the-box solution to import data from excel, but you can create parameterized tests using JUnit4.
The Parameterized runner allows you to do this. For example:
@RunWith(Parameterized.class)
public class MyParameterizedTest {
@Parameter
public String mTextToFind;
private UiDevice mDevice;
@Parameters
public static Iterable<? extends Object> data() {
return Arrays.asList("foo", "bar", "baz");
}
@Before
public void setUp() {
Instrumentation instr = InstrumentationRegistry.getInstrumentation();
mDevice = UiDevice.getInstance(instr);
}
@Test
public void testHasText() {
// Make sure the text is on the screen
Assert.assertTrue(mDevice.hasObject(By.text(mTextToFind));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With