简体   繁体   English

是否可以从Espresso测试项目生成.apk

[英]Is it possible to generate an .apk from an Espresso test project

I am fairly new to android development, so please be patient. 我是android开发的新手,所以请耐心等待。

I want to create an automated test for an application and run it via adb The test case that I generated does simple actions (such as clicking buttons) however I can't find a way to simply run this test without having to use Android studio 我想为应用程序创建一个自动化测试并通过adb运行它。我生成的测试用例执行简单的操作(例如单击按钮),但是我找不到一种无需使用Android Studio即可简单运行此测试的方法

   @Test
    public void mainActivityTest() {
        ViewInteraction switch_ = onView(
                allOf(withId(R.id.switch1), withText("Switch"), isDisplayed()));
        switch_.perform(click());

Is there a way to take the package generated by espresso and run it directly from adb, without having to open the source code and android studio (since it takes a lot of resources ) ? 有没有办法获取espresso生成的程序包并直接从adb运行它,而无需打开源代码和android studio(因为它需要很多资源)?

If not, is there some kind of independent automation tool that would generate a test file and that test would be ran from an ADB shell. 如果没有,是否有某种独立的自动化工具可以生成测试文件,并且可以从ADB Shell运行该测试。

您可以使用Gradle任务(例如, connectedAndroidTest从命令行运行检测测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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