GithubHelp home page GithubHelp logo

Cafe测试方法传递参数 about cafe HOT 6 OPEN

baidu avatar baidu commented on August 16, 2024
Cafe测试方法传递参数

from cafe.

Comments (6)

luxiaoyu avatar luxiaoyu commented on August 16, 2024

有啊,只是我一直没写到文档里。。
adb shell am instrument -e custom "你的参数" -w $test_package/com.zutubi.android.junitreport.JUnitReportTestRunner
在testcase中JUnitReportTestRunner.mCustom这个类成员变量就是你传进去的参数:D

from cafe.

salomon1184 avatar salomon1184 commented on August 16, 2024

只能加一个? 不太灵活啊, 如果我想传递账户名和密码,肯定想这么写 -e user “fdaf” - password "kkk“ ,如果你这样只能-e custom ”fdaf--kkk“, 最后收到再处理了,如果参数更多那就是噩梦了,BTW, 源码里只看见你往JunitReportTestRunner中增了这个参数处理,但没有见到把这个参数最终传递给testcase,这个在测试类里怎么得到这个参数?getParams().getString("custom"); ???

from cafe.

salomon1184 avatar salomon1184 commented on August 16, 2024

如果不限制传参个数,最好把整个Bundle传递给TestCase是吧,但是这样JunitReportTestRunner里用于控制生成xml格式的参数也传递进去了,筛选出来用户自定义的new一个Bundle然后再传递个TestCase?

from cafe.

luxiaoyu avatar luxiaoyu commented on August 16, 2024

多谢好建议,我已经改成支持多个参数的形式了。调用方式为local.getStringFromArguments("username"),启动时-e username就可以了。
代码改动见7568cb1
由于github取消了download page,我把编译产出放在https://github.com/BaiduQA/Cafe/tree/master/out
请下载试用:D

from cafe.

salomon1184 avatar salomon1184 commented on August 16, 2024

谢谢啊,但是大哥,上个问题也给解决一下呗?难道是我手机的问题?那好歹也保证hirerachyviewer能获取property的情况下, Cafe也照样能获得啊,还有就是在文档或者程序Log里能不能把Cafe不适用的情况重点提一下,这样可以保证后续试用者不会犯跟我一样的疑惑

from cafe.

zhaoyunyun avatar zhaoyunyun commented on August 16, 2024

请问有cafe源码的jar包么?我一直没有找到呢?

from cafe.

Related Issues (20)

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.