Android unit testing, says I have no tests inside my class, although I have 1

rosu alin

This is how my ApplicationTest class looks like:

  /**
 * <a href="http://d.android.com/tools/testing/testing_android.html">Testing 
Fundamentals</a>
 */
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ApplicationTest {
@Rule
public ActivityTestRule mActivityRule =
        new ActivityTestRule(VMBaseActivity.class,
                false /* Initial touch mode */, false /*  launch activity */) {

            @Override
            protected void afterActivityLaunched() {
                // Enable JavaScript.
                Log.i("","activity has been started");
            }
        };

@Test
public void enterPin() {
    // Type text and then press the button.
    onView(withId(R.id.button0)).perform(click());
    onView(withId(R.id.button0)).perform(click());
    onView(withId(R.id.button0)).perform(click());
    onView(withId(R.id.button0)).perform(click());
}
}

I have this in my build.gradle

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

But when I run I get this error:

 Client not ready yet..
 Started running tests

 junit.framework.AssertionFailedError: No tests found in com.vidyo.vidyomod.ApplicationTest
 at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
 at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
 at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
 at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1893)

 Tests ran to completion.

Why doesn't the app find my tests?

Gabor

Add the following line to your app.gradle:

defaultConfig { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Unit testing (java): Will I have to write public methods to expose data to unit tests?

Javascript says a member of my class isn't a function, yet I have defined it

This parser generator says that this grammar isn't LR(1) but I have my doubts

I have https on my page but Chrome says it is not secure

CakePHP unit tests only work once, then I have to reset database

I have written a code in python of multiple functions. I'm unit testing my code but the main function is repeating itself

Have I used the this keyword correctly in my class?

Ionic 4 Running on Device: "Could not find an installed version of Gradle either on Android Studio or in System" Although I have it on my system

Why Should I Write Unit Tests if I have UI Automation Tests

Android Code: I have coded for YouTube URL but I can't play videos inside my app

I'm plotting my data in R but the legend is not there although I have typed in the command lines

Why do I get a null object reference on my RealtiveLayout.setBackgroundColor although I have initialized it

Why is my test suite not running any of the tests I have?

Hello, I have a problem with my code in Eclipse for Selenium testing

Should I have failing tests?

why print(x) from class although I have not made an instance of the class?

npm says I have unmet request dependencies

Logging into my desktop from SSH says I have no updates, but I do

Problem when I press the button I have an error in the console log which says my function is not defined

Have an a tag with a link to another website inside my data.jsx array but it says link not found when I try to visit it on my local dev

I have a class and I want to know When my classes are deactivating?

react js Axios 401 Unauthorized although i have my Bearer String correct

Why does my systemd timer show in the inactive timers although I have enbled it?

Why do I have Wayland packages installed although my system is not using Wayland?

Why my after update trigger is executing on insert although I have separate trigger for insert as well

I am new to REACT, I have to call a function resetArray which is inside my sorting class component from another file onClick of a button

How do I distinguish between Unit Tests and Integration Tests inside a test class?

Why Don't I have 'this' context inside of a .then() in my Ember component

How to check if I have a specific value inside my localStorage?