简体   繁体   中英

No test were found

I am writing unit tests. I am extending the unit tests classes from ActivityInstrumentationTestCase2. I was running tests finely. But I don't know what happened. Now when I am running unit test are not running and it throws following exception

`No tests were found`

Please Help.

Here is my unit test class

public class UnitTest extends ActivityInstrumentationTestCase2<TREResults> {
    TREResults trainingReinforcementResults;

    public UnitTest(Class<TREResults>activityClass) {
        super(activityClass);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        trainingReinforcementResults= getActivity();
    }
    public void testDownLoadTRESetting(){
    String userId = trainingReinforcementResults.getUS_USER_ID();
    Realm realm = 
    RealmSaveRestoreHelper.initRealm(trainingReinforcementResults);
    TRESettingsModelTest treSettings = 
    realm.where(TRESettingsModelTest.class).contains("userId", 
    userId).findFirst();`
    realm.beginTransaction();
    treSettings = realm.createObject(TRESettingsModelTest.class);
    treSettings.userId = userId;
    realm.commitTransaction();


}
    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
    }

Are you using JUnit3 ? Why setup() and tearDown() methods are protected ? Shouldn't they be public ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM