I 've got a Quiz app using Realm db. Every time the user selects an answer she clicks a button and new text for Question appears. Thats it until she reaches the end where I start a new Activity and display a score based on correct answers.
How should I start/test ( with Espresso I guess ) that activity without having to enter manually every time all the answers and click the button after each answer until I reach the last one?
What I need is to pass some mock data to a variable and make an Intent but I dont know how and cant find anything related with this in Espresso
First, see this question : Android Monkey Runner
Then you can see these guides :Monkey Runner
It makesyou usePython to test your android activity outside of your source. So, you can trigger things and get to specific activitiesl like this :
save it and then run :
monkeyrunner test.py
You can use the intent to launch dialer activity using below code.
For more detailed description refer my blog post - http://qaautomated.blogspot.in/2016/02/how-to-test-dialer-activity-with.html
You can launch your next activity with a custom intent like this:
Full example: https://github.com/chiuki/android-test-demo
Blog post: http://blog.sqisland.com/2015/04/espresso-21-activitytestrule.html