jeudi 15 septembre 2016

Share test classes between test and androidTest

I have android app project, working in Android Studio. My application files are in the my.package package My unit tests are in my.package.unittest package And my espresso tests are in my.package.androidtest package

In one of my espresso tests I need to use one class that I have under the unittest package, but I am not able to.

Unittest class, that I need to use is located in app/src/test/java folder:

package my.package.unittest;
public class HelperClass {
...
}

And the file I am trying to use it in is in app/src/androidTest/java folder:

package my.package.androidtest;

import static my.package.unittest.*;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class AppTest {
    HelperClass.staticMethod();
}

The error I get is: cannot resolve symbol HelperClass

Additional info:

import my.package.unittest.HelperClass;

This itself gives "cannot resolve symbol" error.

What is the correct way to use this HelperClass from my UnitTests in my Espresso tests.

Aucun commentaire:

Enregistrer un commentaire