Coder Social home page Coder Social logo

andtoolstest's Introduction

扩展基于robotium的测试框架, 重写InstrumentationTestRunner实现报告输出、android aap形式管理和执行case,解决权限操作等问题;

AndToolsTest:

配置:

当需要针对自己的APK或者工程进行测试的时候,修改AndToolsTest工程中的AndroidManifest.xml

    <instrumentation
        android:name="com.auto.tools.instrumentation.AndToolsInstrumentationTestRunner"
        android:label="AndToolsTest"
        android:targetPackage="com.example.android.actionbarcompat" />

android:targetPackage修改成自己测试对象的包名即可;

指定执行case

编辑AndToolsTest工程assets目录下面的testcases.json文件:

[
    {
        "class": "com.auto.test.SmokeMAutoTest",
        "testsuite": [
            {
                "name": "testDemo1",
                "description": "测试示例1",
                "isrun": "false"
            },
            {
                "name": "testDemo2",
                "description": "测试示例2",
                "isrun": "true"
            }
        ]
    },
    {
        "class": "com.auto.test.SmokeAutoTest",
        "testsuite": [
            {
                "name": "testDebug",
                "description": "调试专用",
                "isrun": "true"
            }
        ]
    }
]

报告输出(XML)

<testsuite>
  <testcase classname="com.auto.test.SmokeAutoTest" name="testDebug" time="13.99">
    <failure>
Failure in testDebug:
junit.framework.AssertionFailedError: Text string: 'test' is not found!
        at com.robotium.solo.Clicker.clickOnText(Clicker.java:451)
        at com.robotium.solo.Solo.clickOnText(Solo.java:1473)
        at com.auto.test.SmokeAutoTest.testDebug(SmokeAutoTest.java:77)
        at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
        at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
        at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
        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:1944)
</failure>
  </testcase>

管理界面:

image

andtoolstest's People

Contributors

haosplus avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.