Saturday, 10 September 2016

How to Configure Junit with Android Studio

We have seen how to Install and create a project in Android Studio. Before starting automation testing we need to configure Junit Testing framework with Android Studio. Junit Testing Framework helps us define flow of execution. Let us learn more about Junit.

What is Junit?

Junit is widely used testing framework along with Java Programming Language. You can use this automation framework for both unit testing and UI testing.It helps us define the flow of execution of our code with different Annotations. Junit is built on idea of "first testing and then coding" which helps us to increase productivity of test cases and stability of the code.

Important Features of Junit Testing - 

1. It is open source testing framework allowing users to write and run test cases effectively.
2. Provides various types of annotations to identify test methods.
3. Provides different Types of Assertions  to verify the results of test case execution.
4. It also gives test runners for running tests effectively.
5. It is very simple and hence saves time.
6. It provides ways to organize your test cases in form of test suits.
7. It gives test case results in simple and elegant way.
8. You can integrate Jnuit with Eclipse ,Android Studio,Maven & Ant

Junit With Android Studio

1. Create a new Android Studio Project or Open your existing project.
2. Go to App -> Build.gradle.

3. In the file add the line of code as shown in below screenshot.

4. click on sync.

5. Once you get Buid Successful Message then your Junit Setup is ready for use.


  1. 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..
    Mobile App Development Company
    Mobile App Development Company
    Mobile app Development Companies

  2. The blog gave me idea to configure Junit with android My sincere Thanks for sharing this post and please continue share to Share this post
    Software Testing Training in Chennai

  3. This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.
    Java Training in Chennai
    Best Java Training Institutes in Chennai

  4. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.Nice article i was really impressed by seeing this article, it was very interesting and it is very useful for me.

    SeleniumTraining in Chennai

  5. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. 
    Six Sigma Certification Training in Chennai | Linux Certification Training in Chennai | Microsoft Certification Training in Chennai

  6. I like your post. It really useful with me. Thanks for sharing these useful information!
    Android Project Center in Chennai | Android Project Center in Velachery

  7. I feel Happy to read your Blog,its really amazing with useful information.keep updating.
    Cloud Computing Project Center in Chennai | Cloud Computing Projects in Velachery