51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2283|回复: 1
打印 上一主题 下一主题

[讨论] Native App 测试用例原则

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2018-4-3 14:24:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
上篇提到了 Web 测试的几个原则,其中 用例原子性 在 Native 测试过程同样需要遵循。以 Macaca 官方提供
的样版应用为例,在用例组织会以如下方式组织:

保证每个 case 流程都能够单独运行
每次运行完成后恢复到初始状态,如果有使用 DataHub 做数据驱动模式,DataHub 也需要 reset 到默认数据场景。
  1. describe('macaca-test/mobile-app-sample.test.js', function() {
  2.   before(function() {
  3.     return driver
  4.       .init()
  5.       .sleep(10 * 1000);
  6.   });

  7.   after(function() {
  8.     return driver
  9.       .sleep(1000)
  10.       .quit();
  11.   });

  12.   beforeEach(() => {
  13.     return driver
  14.       .getWindowSize()
  15.       .then(size => {
  16.         console.log(`current window size ${JSON.stringify(size)}`);
  17.       })
  18.       .appLogin('中文+Test+12345678', '111111');
  19.   });

  20.   afterEach(function() {
  21.     return driver
  22.       .customSaveScreenshot(this)
  23.       .changeToNativeContext()
  24.       .waitForElementByName('PERSONAL')
  25.       .click()
  26.       .sleep(1000)
  27.       .waitForElementByName('Logout')
  28.       .click()
  29.       .sleep(1000);
  30.   });

  31.   describe('home page test', function() {
  32.     it('should display home', function() {
  33.     });

  34.     it('should goto tableview', function() {
  35.     });
  36.   });

  37.   describe('webview page test', function() {
  38.     it('should go into webview', function() {
  39.     });

  40.     it('should open remote url', function() {
  41.     });
  42.   });
  43. });
复制代码


自己试试?

$ git clone https://github.com/macaca-sample/sample-nodejs.git --depth=1
$ npm i
$ npm run test:ios

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-9-28 06:30 , Processed in 0.077909 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表