Python内嵌的UnitTest简介

UI自动化测试框架:UnitTest简介

1:整体用了一个思维导图模式显示

在这里插入图片描述

关于生成文本版测试报告的备注补充:

这里的jd_testcase是写在testcase里面的测试脚本文件名
verbosity=2,这里有0、1、2三种填法,0是就显示结果,1比较精简,2是详细
生成的测试报告放在report文件夹下面
测试报告是先生成,然后再跑测试用例,进行测试报告的填写,然后完成操作

2:整个项目的框架样式一览

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Python Appium unittest is a testing framework used to automate mobile application testing using Python programming language. It is built on top of the unittest module and provides a set of methods and assertions to test mobile applications. To use Python Appium unittest, you need to have Appium installed on your machine and a mobile device or emulator to test your application on. You also need to have the Appium Python Client installed in your Python environment. Here is an example of a Python Appium unittest script: ``` import unittest from appium import webdriver class TestApp(unittest.TestCase): def setUp(self): desired_caps = { 'platformName': 'Android', 'deviceName': 'Android Emulator', 'appPackage': 'com.example.myapp', 'appActivity': 'MainActivity' } self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) def tearDown(self): self.driver.quit() def test_login(self): email_field = self.driver.find_element_by_id('email') email_field.send_keys('testuser@example.com') password_field = self.driver.find_element_by_id('password') password_field.send_keys('password123') login_button = self.driver.find_element_by_id('login_button') login_button.click() assert 'Welcome' in self.driver.page_source if __name__ == '__main__': unittest.main() ``` In this example, we are testing a login functionality of an Android application. We first set up the desired capabilities for our test, which include the platform name, device name, app package, and app activity. We then initialize the Appium webdriver with these capabilities. In the `test_login` method, we find the email and password fields and enter test data. We then find the login button and click on it. Finally, we assert that the word 'Welcome' is present in the page source after successful login. To run this test, you can simply execute the script in your terminal using the command `python test_app.py`.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值