How to run android unit test project

I know this is a stupid question, but I was just stuck with this:

1. I have one main project called MainProject. 2. Inside there is one test project that has its own source and manifest file, and in the manifest file I have added everything necessary to make it a test project as follows:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app.tests" android:versionCode="1" android:versionName="1.0"> <application> <uses-library android:name="android.test.runner" /> </application> <uses-sdk android:minSdkVersion="3" /> <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.example.app" android:label="Tests for My App" /> </manifest> 

Now I right-click on it, going to “Run As” and “Run Configuration” and select “Android JUnit Test”, but it shows an error:

MainProject does not indicate the android.test.InstrumentationTestRunner toolkit or declare the use of-library android.test.runner in its AndroidManifest.xml

Any help plz?

There is one @Lucifer video link below which is useful, as well as my own answer, to which you can check the link, which is also useful.

+4
source share
3 answers

Robotium is an Android testing automation platform that fully supports native and hybrid applications. Robotium makes it easy to create powerful and reliable black box automated test boxes. With Robotium support, test developers can write scripts for functional, system, and acceptance testing, covering several Android activities.

  • You can develop powerful test cases with minimal knowledge of the application under test.
  • The system automatically processes several Android actions.
  • The minimum time required to write solid test cases.
  • Reading test cases has improved significantly compared to standard instrumental tests.
  • Tests are more reliable due to the binding of runtime to GUI components.
  • Fast test case execution.
  • Integrates seamlessly with Maven or Ant to run tests as part of continuous integration.
+9
source
  • select File / new / project

  • select android test project

  • give the project a name

  • select the test object as another project that you already have in your publication above "MainProject"

  • select the target platform i.e. Android 4.0

  • and the test project is carried out

  • add classes to src in a test project that extend one of the android.test classes

+1
source

I give an answer to my question, rather this is not an answer, this is a link that you can find, which is very nice and easy to understand how you can use android unit test with Robotium

Here is the link: LINK

+1
source

Source: https://habr.com/ru/post/1392629/


All Articles