测试目标

  • 保证代码质量,确保基础功能的实现,可以有效地保证代码的可靠性,让模块在与别的模块整合时出现更少的错误,减少最终测试时查找困难无方向。

UI测试

登录过程

  • 模拟登录过程,密码正确与密码错误的情况

测试代码

package com.example.asdf.test;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class loginTest {
@Rule
public ActivityTestRule<login> mActivityRule = new ActivityTestRule<>(
login.class);
@Test
public void sayHello(){
onView(withId(R.id.account)).perform(typeText("1234567890"), closeSoftKeyboard());
onView(withId(R.id.password)).perform(typeText("1234567890"),closeSoftKeyboard());
onView(withId(R.id.login)).perform(click());
}
}

测试结果

密码错误



密码正确

用户信息修改

  • 模拟用户信息修改过程,修改成功

测试代码

public class modifyInformation {

@Rule
public ActivityTestRule<modifyinformation> mActivityRule = new ActivityTestRule<>(
modifyinformation.class); @Test
public void modify(){
onView(withId(R.id.newusername)).perform(typeText("fire"), closeSoftKeyboard());
onView(withId(R.id.newintroduce)).perform(typeText("233"),closeSoftKeyboard());
onView(withId(R.id.newsubmit)).perform(click());
}
}

测试结果

测试总结

  • 测试通过。由于app含有涉及到从服务器获取图片信息的功能模块与获取验证码功能,无法通过espresso进行UI自动化测试,只能进行登录过程测试展示。

旅图——UI测试的更多相关文章

  1. 旅图beta版 asp.net web api 单元测试

    旅图 beta版 asp.net web api 单元测试 测试接口:http://120.27.7.115:1010/Help 测试目的 对每个接口单元进行测试,保证每个接口的可靠性. 单元描述 注 ...

  2. 使用Visual Studio 2013对windows应用商店应用进行编码的UI测试

    之前进行了一次实验,实验内容是对windows应用商店应用进行编码的UI测试,下面对实验步骤进行详细说明: 1.为 Windows 应用商店应用创建新编码的 UI 测试项目,选择Visual C##→ ...

  3. H5测试点总结-UI测试、功能测试、兼容性测试、体验相关(弱网、资源、手机操作等)、安全性测试、性能测试

    一.概述 1.1 什么是H5 H5 即 HTML5,是最新的 Web 端开发语言版本,现如今,大多数手机 APP 页面会用 H5 实现,包括 PC Web 站点也会用它开发实现.所以 Web 的通用测 ...

  4. Google+ 团队的 Android UI 测试

    https://github.com/bboyfeiyu/android-tech-frontier/tree/master/android-blog/Google%2B%20%E5%9B%A2%E9 ...

  5. 《软件测试自动化之道》读书笔记 之 基于反射的UI测试

    <软件测试自动化之道>读书笔记 之 基于反射的UI测试 2014-09-24 测试自动化程序的任务待测程序测试程序  启动待测程序  设置窗体的属性  获取窗体的属性  设置控件的属性  ...

  6. 《软件测试自动化之道》读书笔记 之 基于Windows的UI测试

    <软件测试自动化之道>读书笔记 之 基于Windows的UI测试 2014-09-25 测试自动化程序的任务待测程序测试程序  启动待测程序  获得待测程序主窗体的句柄  获得有名字控件的 ...

  7. 《软件测试自动化之道》读书笔记 之 底层的Web UI 测试

    <软件测试自动化之道>读书笔记 之 底层的Web UI 测试 2014-09-28 测试自动化程序的任务待测程序测试程序  启动IE并连接到这个实例  如何判断待测web程序完全加载到浏览 ...

  8. 一种新的自动化 UI 测试解决方案 Airtest Project

    今天分享一个自动化UI测试工具airtest——一款网易出品的基于图像识别面向游UI测试的工具,也支持原生Android App基于元素识别的UI自动化测试.主要包含了三部分:Airtest IDE. ...

  9. iOS 单元测试和UI测试教程

    原文:iOS Unit Testing and UI Testing Tutorial 作者:Audrey Tam 译者:kmyhy 编写测试不是为了追求刺激,测试是为了避免你崭新的 App 变成了充 ...

随机推荐

  1. 如何在Vue2中实现组件props双向绑定

    Vue学习笔记-3 前言 Vue 2.x相比较Vue 1.x而言,升级变化除了实现了Virtual-Dom以外,给使用者最大不适就是移除的组件的props的双向绑定功能. 以往在Vue1.x中利用pr ...

  2. C#访问Azure的资源

    官方参考资料在这里:https://msdn.microsoft.com/en-us/library/azure/dn722415.aspx,本文放一些重点及遇到的坑的解决办法. 身份验证 不是说,我 ...

  3. .Net相关

    Lucene 全文搜索 http://lucenenet.apache.org/ Memcached 分布式缓存 http://memcached.org/ selenium UI自动化测试 http ...

  4. j-link或者swd调试

    两种 一.JTAG调试(5针), 二.SWD调试(2针), 在JTAG/SWD模式设置库函数 (在文件stm32f10x_gpio.c中): void GPIO_PinRemapConfig(uint ...

  5. SqlServer中——查找杀死阻塞进程

    查找阻塞进程: SELECT blocking_session_id '阻塞进程的ID', wait_duration_ms '等待时间(毫秒)', session_id '(会话ID)' FROM ...

  6. Excel——将内容导出

    using (FileStream fsRead = File.OpenRead("111.xls")) { IWorkbook wk = new HSSFWorkbook(fsR ...

  7. 【Spring3.0系列】---Bean不同配置方式比较 和适用场合

    Bean不同配置方式比较1.基于XML配置定义:在XML文件中通过<bean>元素定义Bean,例如<bean class="com.bbt.UserDao"/& ...

  8. HashTable、HashMap、HashSet

    1. HashMap 1)  hashmap的数据结构 Hashmap是一个数组和链表的结合体(在数据结构称“链表散列“),如下图示: 当我们往hashmap中put元素的时候,先根据key的hash ...

  9. linux 常用命令总结

    PS命令: 1.命令格式: ps[参数] 2.命令功能: 用来显示当前进程的状态 3.命令参数: a  显示所有进程 -a 显示同一终端下的所有程序 -A 显示所有进程 c  显示进程的真实名称 -N ...

  10. C# 属性、索引

    属性(property): public string Name { get { return _name; } set { _name = value; } } 简写为: public string ...