当前位置: 首页 > news >正文

涉县企业做网站推广品牌建设表态发言

涉县企业做网站推广,品牌建设表态发言,试题wordpress的特点,公司网站建设记哪个科目Robotium的测试类ActivityInstrumentationTestCase2是继承于Junit3的TestCase类#xff0c;所以并没有提供Junit4的特性.如网上总结说的 不能通过annotate的方式来识别子类的新特征#xff0c;如不能实现beforeclass#xff0c;afterclass等特征。只能通过写setup和teardown…Robotium的测试类ActivityInstrumentationTestCase2是继承于Junit3的TestCase类所以并没有提供Junit4的特性.如网上总结说的 不能通过annotate的方式来识别子类的新特征如不能实现beforeclassafterclass等特征。只能通过写setup和teardownTestCase只能以test开头进行测试case书写。那么有时我们并不想每次开始/完成一个case的时候都做一些重复的动作也就是要实现Junit4的beforeclass和afterclass该怎么办呢 以SDK自带的Notepad测试用例作为例子假如现在我们需要实现两个测试用例 testAddNoteCNTittle:创建一个中文标题的笔记testAddNoteEngTitle:创建一个英文标题的笔记根据实例提供的代码在setup里面会初始化solo而在teardown里面会关闭所有打开的activities也就是说每执行一个case都会重新初始化一次solo和关闭所有的activities Overridepublic void setUp() throws Exception {//setUp() is run before a test case is started. //This is where the solo object is created.super.setUp();this.activity this.getActivity();this.solo new Solo(getInstrumentation(), getActivity());}Overridepublic void tearDown() throws Exception {//tearDown() is run after a test case has finished. //finishOpenedActivities() will finish all the activities that have been opened during the test execution.solo.finishOpenedActivities();}但事实上我们在这个脚本只是去创建两个Note并不需要每执行完一个case都要去初始化solo和关闭所有activities。google后没有发现有现成的取代beforeclass和aferclass的方法。 以下本人的实现方法 pre namecode classjavapackage com.example.android.notepad.test;import com.robotium.solo.Solo;import android.test.ActivityInstrumentationTestCase2; import android.app.Activity;SuppressWarnings(rawtypes) public class TCCreateNote extends ActivityInstrumentationTestCase2{private static Solo solo null;public Activity activity;span stylewhite-space:pre /spanprivate static final int NUMBER_TOTAL_CASES 2;private static int run 0;private static Class? launchActivityClass;//对应re-sign.jar生成出来的信息框里的两个值private static String mainActiviy com.example.android.notepad.NotesList;private static String packageName com.example.android.notepad;static {try {launchActivityClass Class.forName(mainActiviy);} catch (ClassNotFoundException e) {throw new RuntimeException(e);}}SuppressWarnings(unchecked)public TCCreateNote() {super(packageName, launchActivityClass);}Overridepublic void setUp() throws Exception {//setUp() is run before a test case is started. //This is where the solo object is created.super.setUp(); span stylewhite-space:pre /span//The variable solo has to be static, since every time after a cases finished, this class TCCreateNote would be re-instantiated// which would lead to soto to re-instantiated to be null if its not set as staticif(solo null) {TCCreateNote.solo new Solo(getInstrumentation(), getActivity());}}Overridepublic void tearDown() throws Exception {//Check whether its the last case executed.run countTestCases();if(run NUMBER_TOTAL_CASES) {solo.finishOpenedActivities();}}public void testAddNoteCNTitle() throws Exception {solo.clickOnMenuItem(Add note);solo.enterText(0, 中文标签笔记);solo.clickOnMenuItem(Save);solo.clickInList(0);solo.clearEditText(0);solo.enterText(0, Text 1);solo.clickOnMenuItem(Save);solo.assertCurrentActivity(Expected NotesList Activity, NotesList);solo.clickLongOnText(中文标签笔记);solo.clickOnText(Delete);}public void testAddNoteEngTitle() throws Exception {solo.clickOnMenuItem(Add note);solo.enterText(0, English Title Note);solo.clickOnMenuItem(Save);solo.clickInList(0);solo.clearEditText(0);solo.enterText(0, Text 1);solo.clickOnMenuItem(Save);solo.assertCurrentActivity(Expected NotesList Activity, NotesList);solo.clickLongOnText(English Title Note);solo.clickOnText(Delete);} } Item Description Warning 作者 天地会珠海分舵转载请注明出处 服务平台 自主博客:http://techgogogo.comCSDN博客 http://blog.csdn.net/zhubaitian 微信公众号 请搜索TechGoGoGo 或扫描  转载于:https://www.cnblogs.com/techgogogo/p/4284801.html
http://www.yutouwan.com/news/310283/

相关文章:

  • 网站设计计划书的要求郑州网站建设模板制作
  • 建设外贸网站网站建设语音
  • 建设银行网站怎么登陆不百度查重软件
  • php做网站示例招聘网站排行榜2021
  • 淮阳住房和城乡建设局网站万网网站购买
  • 用dw制作做网站需要钱吗wordpress 分类seo
  • 做第三方seo优化网站网站建设及推广费记什么科目
  • 注册网站可以注销嘛网站提现功能开发
  • 租网站服务器网页设计师培训大全
  • 网站的页面布局房屋设计网站推荐
  • 做自己的游戏网站濮阳网站推广
  • 国家住房和城乡建设局网站首页第一家中文商务网站
  • 积玉桥网站建设站长工具海角
  • 海口网站建设高端想做游戏推广怎么找游戏公司
  • 做ppt找图片的网站网络营销考试题及答案
  • 专业网站制作企业建设网站硬件需要
  • 牡丹江在哪个城市百度快速seo优化
  • python3 网站建设湘潭网站建设问下磐石网络
  • 做外贸重新设计网站景区网站建设的好处
  • 网站建设源程序滁州项目建设公示在哪个网站
  • 必须做网站等级保护南京网站搜索引擎优化
  • 深圳龙岗做网站公司做外贸c2c网站有哪些
  • 深圳网站建设公司为什搜索引擎优化自然排名
  • 网站开发需要数据库com网站建设中
  • 江西网站开发费用wordpress文字模板
  • 国外设计类网站wordpress多说加载慢
  • 公司网站设计很好的影视公司组织架构
  • 简约的网站西安网站优化
  • 永久免费自助建站一个网站做数据维护3天正常吗
  • 成都网站网络建设东莞市seo网络推广哪家好