本文介绍了找不到测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写单元测试.我正在从ActivityInstrumentationTestCase2扩展单元测试类.我正在很好地运行测试.但是我不知道发生了什么.现在,当我在运行单元测试时,它没有运行,并且抛出了以下异常
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`
请帮助.
这是我的单元测试课
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();
}
推荐答案
您是否正在使用 JUnit3
?为什么 setup()
和 tearDown()
方法受保护
?他们不应该公开
吗?
Are you using JUnit3
? Whysetup()
and tearDown()
methods are protected
? Shouldn't they be public
?
这篇关于找不到测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!