北京/上海/◆办英国剑桥文理学院毕业证/CATS Cambridge学位证/1比1定制

本地办理〖1比1定制十Q/微 9307 9292】◆办英国剑桥文理学院毕业证/CATS Cambridge学位证【留信网认证&博士&硕士&海归&本科&排名&成绩单】制作国外(海外)澳洲英国、加拿大、韩国、美国、新西兰等各大学毕业证,认证,文凭,diploma,degree 真实认。海外回囯的同学定制毕业证、学位证书、使馆公证、囯外真实学位认证。

pytest是一个十分成熟的全功用的Python测试框架 用例设计准绳 谨记:当我们运用pytest框架写case的时分,一定要拿它的命令标准去case,这样框架才干辨认到哪些case需求执行,哪些不需求执行

文件名以test_.py文件和_test.py

以Test开头的类

以test_开头的函数

以test_开头的办法

运转方式

能够经过pycharm里的终端命令,也能够pytest.main()运转(主推)

@pytest.fixture() 即测试用例执行的环境准备和清算,相当于unittest的setup()和teardown()

上面装饰器,下面函数名

定义fixture跟定义普通函数差不多,独一区别就是在函数上加个装饰器@pytest.fixture(),fixture命名不要以test开头,跟用例辨别开。

fixture是有返回值得,没有返回值默许为None。用例调用fixture的返回值,直接就是把fixture标志的函数称号当做变量称号传进去。

那么在一个fixture 内部如何辨别环境准备、环境清算呢

环境清算没有特地的装饰器,还是在fixture装饰器函数内运用yield 关键字

yield 关键字以后得代码,就是环境清算的代码,即在测试用例执行完成之后会执行的代码

fixture的作用范围

fixture里面有个scope参数能够控制fixture的作用范围:session>module>class>function

-function:每一个函数或办法都会调用(默许就是function)

-class:每一个类调用一次,一个类中能够有多个办法

-module:每一个.py文件调用一次,该文件内又有多个function和class

-session:是多个文件调用一次,能够跨.py文件调用,每个.py文件就是module

conftest.py配置

应用场景:上面一个案例是在同一个.py文件中,多个用例调用一个登陆功用,假如有多个.py的文件都需求调用这个登陆功用(fixtrue函数)的话,那就不能把登陆(fixtrue)写到用例里面去了。

此时应该要有一个配置文件,单独管理一些预置的操作场景,pytest里面默许读取conftest.py里面的配置

conftest.py配置需求留意以下点:

conftest.py配置脚本称号是固定的,不能改称号

conftest.py与运转的用例要在同一个pakage下,并且有__init__.py文件

不需求import导入 conftest.py,pytest用例会自动查找

Listening to Meiyun's words, Zhang Yun nodded.In my mind, I think of two other things about Blue Nurse in this dormitory. 'Ah! I've been here all the time. Do you two roommates have any objections? Listening to Zhang Yun's words, Meiyun and Meiqing secretly laughed in their mouths.'Husband! You're silly. You're still a fool.' 'Mei Qing and I are pink nurses, and you are a doctor in VIP ward. As such, they are two little blue nurses. Dare to have an opinion?' 'If you stay in our dormitory for one night, they can only

recognize it. Mei Qing and I don't call them, they dare not come back.' Listening to Meiyun's words, Zhang Yun knew in his heart. The importance of hierarchical status in hospitals. 'Oh...' Meiyun and Meiqing are two young women's sisters.Let Zhang Yun feel comfortable.Sitting on the sofa in the room, he lit a cigarette and smoked. Meiyun and Meiqing tidied up a little in bed. Dressed neatly, he got out of bed. Xu Yiyi, too, dressed up and walked

down.Accompanied by Zhang Yun. Xu 11 knelt at Zhang Yun's feet and pinched Zhang Yun's thighs.I don't know what's on my face, and I'm blushing.Meiyun looked at her husband and stayed here, reluctant to leave for the time being. 'Hello, friends, long time no see! A year ago, I worked with Jackie Chan in action movies! The director asked me if I could change my hair, so now I see my hair is very long and crazy! Now I want to shoot a new action movie. The director asked me if I could change my hair, so now I want to cut my hair short! My role is a secret! I can't tell you about my role. But I can

allow you to see what I look like after cutting my hair! Goodbye! Friends, look at me now, my hair is getting shorter! This is my hairstyle, maybe I will do a new hairstyle in the future! But now I feel the same, I am very excited now, because my hair is very comfortable now! Not crazy! Goodbye! “

迸侨辖步撂胃拓牌

加入外籍者涉嫌骗取中国护照 驻英领馆:已处理;三问“爱心妈妈”李利娟事件:为何就涉嫌犯罪了?;人民日报:寅吃卯粮 美国经济蕴含风险;农业农村部发布非洲猪瘟预警 沈阳暂停生猪外运;美媒:白宫或没想到 与中国打贸易战还将失去盟友;英拍卖行回应中国文物局:符合英国法律 17点开拍;英金融专家:贸易战对美负面影响 2020年将见分晓;中国应用如何走出去?在中东我们有了不错的经验;

https://www.cnblogs.com/sgsga/p/12561608.html;

https://www.cnblogs.com/sgsga/p/12561621.html;

https://www.cnblogs.com/sgsga/p/12561641.html;

https://www.cnblogs.com/sgsga/p/12561653.html;

https://www.cnblogs.com/sgsga/p/12561663.html;

https://www.cnblogs.com/sgsga/p/12561673.html;

https://www.cnblogs.com/sgsga/p/12561687.html;

https://www.cnblogs.com/sgsga/p/12561707.html;

猜你喜欢

转载自www.cnblogs.com/sgsga/p/12561719.html