Site Loader
Auckland, New Zealand
This post is more like a solution for the problem I faced while automating android application. Since I am very familiar with Selenium with TestNG, I thought of implementing the same concept in Android automation as well, I thought it’s going to be straight forward to implement, but at the end it’s NOT.

What I tried to establish

I tried to implement TestNG in Android Test project, as I did previously in Selenium

What really happened?

TestNG in Android Test Project didn’t worked!!! I got exception as
Couldn't contact the RemoteTestNG client. Make 
sure you don't have an older version of testng.jar on your class path. 
Timeout while trying to contact RemoteTestNG
As you could see the exception message reported by debugger doesn’t make any sense

What was the Issue?

Not sure, but for now, TestNG with Android Test Project will not run L

What might be the possible reason for issue?

Well I think the issue really makes sense. As you could see, while creating an Android Test Project, we are actually creating a project which built with JUnit as you could see the screenshot   We also discussed about this in our previous post on Android testing fundamentals the Android testing API is built with JUnit framework and has extended the Instrumentation framework and Android specific classes. While this is the case, both the TestNG and JUnit are altogether a different testing framework and running a framework within framework might be the possible reason for the issue.

Then what I did?

Well, I wrote my custom execution engine which will do the execution of specified method from an Excel sheet. I hope this post will give you all an idea of how not to break head in trying to implement Android test project with TestNG. Thanks, Karthik KK

Post Author: Karthik kk

5 Replies to “Can I run test using TestNG in Android Test Project ?”

    1. Actually, the topic discusses how you cannot use TestNG in Android Test project, thus you cannot use context object as well.

      Karthik KK

Leave a Reply

Your email address will not be published. Required fields are marked *