当前位置:网站首页>Unittest attempt
Unittest attempt
2022-07-03 06:33:00 【Bobo AI leaves work】
1. Inheritance class
import unittest
class TestApi(unittest.TestCase):
def test_01_login(self):
print(" Test landing ")
def test_02_login(self):
print(" Test registration ")
2. Usage of test suite unittest.main(defaultTest="suite")
import unittest
from test_apis.test_api import TestApi
if __name__ == '__main__':
suite = unittest.TestSuite()
suite.addTest(TestApi("test_01_login"))
# Add a set of test cases
testcases=[TestApi("test_01_login"),TestApi("test_02_login")]
suite.addTests(testcases)
unittest.main(defaultTest="suite")
3. Through the loader TestLoader load
import unittest
from test_apis.test_api import TestApi
if __name__ == '__main__':
suite=unittest.defaultTestLoader.discover("./",pattern="test_*.py")
unittest.main(defaultTest="suite")
Assert whether the titles are equal :
import unittest
from selenium import webdriver
class Test_Bai(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
driver=webdriver.Chrome()
driver.get("http://www.baidu.com")
title=driver.title
print(title)
return title
def test_assert_title(self):
self.assertEqual(self.setUpClass()," use Baidu Search , You will know ")
if __name__ == '__main__':
unittest.main
边栏推荐
- Nacos service installation
- POI dealing with Excel learning
- Cesium entity (entities) entity deletion method
- About the difference between count (1), count (*), and count (column name)
- [open source project recommendation colugomum] this group of undergraduates open source retail industry solutions based on the domestic deep learning framework paddlepadddle
- Project summary --2 (basic use of jsup)
- Mysql5.7 group by error
- Oauth2.0 - user defined mode authorization - SMS verification code login
- opencv鼠标键盘事件
- 2022 cisp-pte (III) command execution
猜你喜欢

轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷

使用 Abp.Zero 搭建第三方登录模块(一):原理篇

ruoyi接口权限校验

Project summary --04

GPS坐标转百度地图坐标的方法

Zhiniu stock project -- 05

Yolov1 learning notes
![[open source project recommendation colugomum] this group of undergraduates open source retail industry solutions based on the domestic deep learning framework paddlepadddle](/img/f8/0e3fbfd13bf06291a73200552ff17a.png)
[open source project recommendation colugomum] this group of undergraduates open source retail industry solutions based on the domestic deep learning framework paddlepadddle

JMeter performance automation test

Zhiniu stock project -- 04
随机推荐
Scripy learning
Kubesphere - Multi tenant management
The mechanical hard disk is connected to the computer through USB and cannot be displayed
Request weather interface format, automation
2022 CISP-PTE(三)命令执行
Numerical method for solving optimal control problem (I) -- gradient method
How to scan when Canon c3120l is a network shared printer
【无标题】
Click cesium to obtain three-dimensional coordinates (longitude, latitude and elevation)
Opencv mouse and keyboard events
JMeter linked database
2022 cisp-pte (III) command execution
Yolov1 learning notes
第8章、MapReduce 生产经验
error C2017: 非法的转义序列
代码管理工具
使用conda创建自己的深度学习环境
IE browser flash back, automatically open edge browser
Chapter 8. MapReduce production experience
认识弹性盒子flex