我创建了一个小应用程序来检查使用espresso的测试。在一个测试类中运行多个测试时,我观察到每次测试都会暂停并重新创建活动。我不认为这是正常的行为。
下面是我测试类的代码:
@RunWith(AndroidJUnit4.class)
@LargeTest
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MyTestClass {
@Rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule(MainActiv
我的项目结构如下:
模块-app
androidTest //Espresso tests covers classes from login and registration
main //Contains UI and business logic
test
模块-登录
androidTest //No tests written
main //Contains UI and business logic
test //Only unit tests
module-registration
androidTest //No tests written
main //Contains UI
我想在我的安卓应用程序中测试我的MainActivity。因此,我创建了第一个测试用例来测试按钮的功能。如果用户单击此特定按钮,则应打开一个新活动。
这是我的代码:
@RunWith(AndroidJUnit4.class)
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void sta
我有一个Selenium项目,它在我的本地机器上运行得很好,但在由Hudson运行时出现了问题。问题是它不会在每次测试结束时关闭打开的驱动程序。
先决条件:该项目由Hudson在Selenium网格服务器上运行。(我还在我的本地机器上的Selenium网格服务器上运行了它,并且没有出现问题)
因此,我有一个由每个测试类实现的BeforeAndAfter类。
在BeforeAndAfter内部,我有一个@BeforeClass方法,它启动一个新的驱动程序: driver = new ( new url(RemoteWebDriver),capability);还有一个@AfterClass方法,
在试图发布我的应用程序以供生产时,发布前的报告通知我Pixel 2 Android预览设备上的一个错误。该错误与我所拥有的一条自定义土司消息有关,该消息说视图“已添加到窗口管理器中”:
java.lang.IllegalStateException: View android.support.constraint.ConstraintLayout{efbeb21 V.E...... ......ID 0,0-788,1124 #7f0900db app:id/toast_correct_container} has already been added to the window manage
我的android espresso单元测试被阻止了,因为一些后台线程没有空闲。我如何确定哪个线程阻塞了我的应用程序的执行?
android.support.test.espresso.AppNotIdleException: Looped for 246 iterations over 60 SECONDS. The following Idle Conditions failed ASYNC_TASKS_HAVE_IDLED.
at dalvik.system.VMStack.getThreadStackTrace(Native Method)