Tuesday, 19 January 2016

How to Setup Espresso for functional Testing?

You are reading this post because you want to go with Espresso Framework for your functional testing.The framework is very flexible and allows you to test different functionality with ease and accuracy.Let us get to the point and start configuring your project with espresso.
To configure Espresso within your Android Project is very simple and quick. By the end of this post you will be able to start writing your tests. In case you face any issues post it here.

Introduction to Espresso Video Tutorial -

Espresso Setup Step by Step Video Tutorial -

1.Espresso works in the same project where your app is build, so first step is to open your project.

2. Open file build.gradle inside- project -> App -> build.gradle and add below line of code at the end.


dependencies {
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    androidTestCompile 'com.android.support.test:runner:0.5',{
        exclude group: 'com.android.support', module: 'support-annotations'
android {
    defaultConfig {
        testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'

3. Then click on sync gradle, once the build is successful you are all set to write Espresso test cases. 

Note - 
add below code the defaultConfig before running the test case -

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Note - Learn More About Android Studio HERE 
I hope this post helps you find your code coverage for your test suit :)
Please Share your feedback in comments section below and follow QA Automated to get latest post update.Happy Testing :-)


  1. Will this Espresso works on existing APK files? Like I want to test the Gmail app. Is it possible to test the app without having the code of Gmail app?

    1. The Espresso is integrated with app's code and so it is not possible to use Espresso without app code.

  2. Excellent read. Thanks for sharing information software testing. Now Indium software hiring Mobile App Testing Engineers (while you can)

  3. Thanks for your effort very good information, it is very useful everyone.
    In my project after gradle sync i am getting this error "Error:Failed to resolve: org.ccil.cowan.tagsoup:tagsoup:1.2" please help you to fix this issue.

  4. Hi,

    Thanks for visiting my blog. I feel this error is due to other dependency in ur project. try to use multidexenabled true

    Thanks & Regards,

    1. Hi Anuja

      I would like to learn espresso for industry purpose. Can you share me the links on my mailid (nikhilmit.k@gmail.com), from where could i learn it.

      Nikhil Mittal

  5. This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things...
    Mobile App Development Company
    Mobile App Development Companies

  6. Thanks for posting useful information.You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...Really it was an awesome article...very interesting to read..
    please sharing like this information......
    Android training in chennai
    Ios training in chennai


  7. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
    Android App Development Company

  8. it is really amazing...thanks for sharing....provide more useful information...
    Mobile app development company

  9. I am looking for some good blog sites for studying. I was searching over search engines and found your blog site. Well i like your high quality blog site design plus your posting abilities. Keep doing it.

    PSD to Wordpress
    wordpress website development

  10. This comment has been removed by the author.

  11. I am happy to find this post Very useful for me, as it contains lot of information

    Selenium Courses in Chennai

    Selenium training Chennai

  12. Thanks for sharing this wonderful blog. Helpful article ! Kindly visit us @ Chocolate gift box

  13. Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live. I have bookmarked more article from this website. Such a nice blog you are providing ! Kindly Visit Us @ Best Travels in Madurai | Tours and Travels in Madurai | Madurai Travels

  14. Really nice topics you had discussed above. I am much impressed. Thank you for providing this nice information here.
    Mobile Game Testing

    Gameplay Testing

    Switch Game Testing

  15. First time getting to know about Espresso Framework and really happy to see such information which helpful for me to know more about testing process
    great work

  16. Great blog thanks for sharing Searching for a SEO company in Chennai that can bring your brand to the top results page on Google? Look no further - Adhuntt Media, with their team of SEO experts, can make it happen that too for the best value.
    digital marketing company in chennai
    seo service in chennai
    web designing company in chennai
    social media marketing company in chennai

  17. Nice blog thanks for sharing It’s time you got the number 1 gardening service in Chennai. Find exotic plants and aromatic flowers at the best price at Karuna Nursery Gardens - the home for high quality organic greenery.
    plant nursery in chennai
    rental plants in chennai
    corporate gardening service in chennai

  18. Excellent blog thanks for sharing Setting up a successful salon means that you need the best wholesale cosmetics suppliers in Chennai to back up your brand. With hundreds of exclusive international brands and down to earth service, Pixies Beauty Shop is your destination to success.
    Cosmetics Shop in Chennai

  19. Very useful blog thanks for sharing IndPac India the German technology Packaging and sealing machines in India is the leading manufacturer and exporter of Packing Machines in India.

  20. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic Software Testing Training in Chennai | Software Testing Training in Anna Nagar | Software Testing Training in OMR | Software Testing Training in Porur | Software Testing Training in Tambaram | Software Testing Training in Velachery

  21. Very interesting blog post. Quite informative and very helpful.This indeed is one of the recommended blog for learners. Thank you for providing such nice piece of article. I’m glad to leave a comment. Expect more articles in future Software Testing Training in Chennai | Software Testing Training in Anna Nagar | Software Testing Training in OMR | Software Testing Training in Porur | Software Testing Training in Tambaram | Software Testing Training in Velachery