中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

網(wǎng)站規(guī)劃書(shū)包括哪些方面公司官網(wǎng)怎么制作

網(wǎng)站規(guī)劃書(shū)包括哪些方面,公司官網(wǎng)怎么制作,用c 做網(wǎng)站設(shè)計(jì)系統(tǒng)的項(xiàng)目作業(yè),邯鄲建設(shè)信息網(wǎng)站前言 在編寫(xiě)自動(dòng)化測(cè)試用例的時(shí)候經(jīng)常會(huì)遇到需要編寫(xiě)流程性測(cè)試用例的場(chǎng)景,一般流程性的測(cè)試用例的測(cè)試步驟比較多,我們?cè)跍y(cè)試用例中添加詳細(xì)的步驟會(huì)提高測(cè)試用例的可閱讀性。 allure提供的裝飾器allure.step()是allure測(cè)試報(bào)告框架非常有用的功能&am…

前言

在編寫(xiě)自動(dòng)化測(cè)試用例的時(shí)候經(jīng)常會(huì)遇到需要編寫(xiě)流程性測(cè)試用例的場(chǎng)景,一般流程性的測(cè)試用例的測(cè)試步驟比較多,我們?cè)跍y(cè)試用例中添加詳細(xì)的步驟會(huì)提高測(cè)試用例的可閱讀性。

allure提供的裝飾器@allure.step()是allure測(cè)試報(bào)告框架非常有用的功能,它能幫助我們?cè)跍y(cè)試用例中對(duì)測(cè)試步驟進(jìn)行詳細(xì)的描述。

@allure.step的使用例子:

實(shí)現(xiàn)一個(gè)購(gòu)物的場(chǎng)景:1.登錄;2.瀏覽商品;3.將商品加入到購(gòu)物車(chē)中;4.下單;5.支付訂單;

# file_name: test_allure_step.pyimport pytest
import allure@allure.step
def login():"""執(zhí)行登錄邏輯:return:"""print("執(zhí)行登錄邏輯")@allure.step
def scan_good():"""執(zhí)行瀏覽商品邏輯:return:"""print("執(zhí)行瀏覽商品邏輯")@allure.step
def add_good_to_shopping_car():"""將商品添加到購(gòu)物車(chē):return:"""print("將商品添加到購(gòu)物車(chē)")@allure.step
def generator_order():"""生成訂單:return:"""print("生成訂單")@allure.step
def pay():"""支付訂單:return:"""print("支付訂單")def test_buy_good():"""測(cè)試購(gòu)買(mǎi)商品:步驟1:登錄步驟2:瀏覽商品步驟3:將商品加入到購(gòu)物車(chē)中步驟4:下單步驟5:支付:return:"""login()scan_good()add_good_to_shopping_car()generator_order()pay()with allure.step("斷言"):assert 1if __name__ == '__main__':pytest.main(['-s', 'test_allure_step.py'])

執(zhí)行命令:

> pytest test_allure_step.py --alluredir=./report/result_data> allure serve ./report/result_data

查看測(cè)試報(bào)告展示效果:

image

從報(bào)告中可以看到,我們事先通過(guò)@allure.step()定義好的步驟都展示在測(cè)試用例test_buy_good()下了。

@allure.step支持嵌套,step中調(diào)用step

# file_name: steps.pyimport allure@allure.step
def passing_step_02():print("執(zhí)行步驟02")pass

測(cè)試用例:

# file_name: test_allure_step_nested.pyimport pytest
import allurefrom .steps import passing_step_02  # 從外部模塊中導(dǎo)入@allure.step
def passing_step_01():print("執(zhí)行步驟01")pass@allure.step
def step_with_nested_steps():"""這個(gè)步驟中調(diào)用nested_step():return:"""nested_step()@allure.step
def nested_step_with_arguments(arg1, arg2):pass@allure.step
def nested_step():"""這個(gè)步驟中調(diào)用nested_step_with_arguments(),并且傳遞參數(shù):return:"""nested_step_with_arguments(1, 'abc')def test_with_imported_step():"""測(cè)試@allure.step()支持調(diào)用從外部模塊導(dǎo)入的step:return:"""passing_step_01()passing_step_02()def test_with_nested_steps():"""測(cè)試@allure.step()支持嵌套調(diào)用step:return:"""passing_step_01()step_with_nested_steps()passing_step_02()if __name__ == '__main__':pytest.main(['-s', 'test_allure_step_nested.py'])

執(zhí)行命令:

pytest test_allure_step_nested.py --alluredir=./report/result_dataallure serve ./report/result_data

查看測(cè)試報(bào)告展示效果:

image

從上面的結(jié)果中可以看到:

  • @step可以先保存到其他模塊中,在測(cè)試用例中需要用到的時(shí)候?qū)刖涂梢粤?#xff1b;
  • @step也支持在一個(gè)step中嵌套調(diào)用其他的step;嵌套的形式在測(cè)試報(bào)告中以樹(shù)形展示出來(lái)了;

@allure.step支持添加描述且通過(guò)占位符傳遞參數(shù)

# file_name: test_allure_step_with_placeholder.pyimport pytest
import allure@allure.step('這是一個(gè)帶描述語(yǔ)的step,并且通過(guò)占位符傳遞參數(shù):positional = "{0}",keyword = "{key}"')
def step_title_with_placeholder(arg1, key=None):passdef test_step_with_placeholder():step_title_with_placeholder(1, key="something")step_title_with_placeholder(2)step_title_with_placeholder(3, key="anything")if __name__ == '__main__':pytest.main(['-s', 'test_allure_step_with_placeholder.py'])

執(zhí)行命令:

pytest test_allure_step_with_placeholder.py --alluredir=./report/result_dataallure serve ./report/result_data

查看測(cè)試報(bào)告展示效果:

image

從上面的執(zhí)行結(jié)果中可以看到,@allure.step()是支持輸入描述的,并且支持通過(guò)占位符向描述中傳遞參數(shù)。

在conftest.py文件中定義@allure.step

conftest.py文件:

# file_name: conftest.pyimport pytest
import allure@pytest.fixture()
def fixture_with_conftest_step():conftest_step()@allure.step("這是一個(gè)在conftest.py文件中的step")
def conftest_step():pass

測(cè)試用例:

# file_name: test_allure_step_in_fixture_from_conftest.pyimport pytest
import allure@allure.step
def passed_step():passdef test_with_step_in_fixture_from_conftest(fixture_with_conftest_step):passed_step()if __name__ == '__main__':pytest.main(['-s', 'test_allure_step_in_fixture_from_conftest.py'])

執(zhí)行命令:

pytest test_allure_step_in_fixture_from_conftest.py --alluredir=./report/result_dataallure serve ./report/result_data

查看測(cè)試報(bào)告展示效果:

從運(yùn)行結(jié)果中可以看到,在fixture中定義的step會(huì)在setup和teardown單獨(dú)以樹(shù)形結(jié)構(gòu)展示出來(lái)。

這可能是B站最詳細(xì)的pytest自動(dòng)化測(cè)試框架教程,整整100小時(shí),全程實(shí)戰(zhàn)!!!

http://www.risenshineclean.com/news/45458.html

相關(guān)文章:

  • 教務(wù)系統(tǒng)網(wǎng)站怎么做南寧網(wǎng)站seo外包
  • 中企動(dòng)力制作的網(wǎng)站后臺(tái)怎樣搭建自己的網(wǎng)站
  • 做網(wǎng)站一個(gè)月30ip網(wǎng)絡(luò)推廣是網(wǎng)絡(luò)營(yíng)銷(xiāo)的基礎(chǔ)
  • 做cpa能用什么網(wǎng)站seo怎么優(yōu)化簡(jiǎn)述
  • 怎么創(chuàng)建網(wǎng)站論壇重慶seo公司
  • 網(wǎng)站建設(shè)企業(yè)的未來(lái)發(fā)展計(jì)劃十大少兒編程教育品牌
  • 網(wǎng)頁(yè)設(shè)計(jì)代碼模板海賊王網(wǎng)站優(yōu)化排名提升
  • 牛商網(wǎng)營(yíng)銷(xiāo)型網(wǎng)站建設(shè)廈門(mén)百度廣告開(kāi)戶
  • 網(wǎng)站建設(shè)免費(fèi)教程我是seo關(guān)鍵詞
  • 佛山建網(wǎng)站建網(wǎng)站找哪個(gè)公司
  • 業(yè)余學(xué)做衣服上哪個(gè)網(wǎng)站軟文網(wǎng)站大全
  • 廈門(mén)國(guó)外網(wǎng)站建設(shè)公司排名下載百度app最新版到桌面
  • 微信商城怎么進(jìn)鎮(zhèn)江交叉口優(yōu)化
  • 大連模板網(wǎng)站制作公司廣州網(wǎng)絡(luò)推廣外包
  • 上海最新傳染病疫情今天在線seo外鏈工具
  • 哪個(gè)網(wǎng)站可以做練習(xí)題百度收錄排名
  • 零售網(wǎng)站有哪些平臺(tái)信息流廣告代理商排名
  • 東莞網(wǎng)站seo推廣優(yōu)化網(wǎng)站統(tǒng)計(jì)哪個(gè)好用
  • 南陽(yáng)網(wǎng)站公司簡(jiǎn)短的軟文范例
  • 用bootstrap基礎(chǔ)教程做的網(wǎng)站百度熱詞指數(shù)
  • html5農(nóng)業(yè)網(wǎng)站模板搜索引擎營(yíng)銷(xiāo)的手段包括
  • 簡(jiǎn)述網(wǎng)站的創(chuàng)建流程百度推廣工具有哪些
  • 網(wǎng)站建設(shè)的業(yè)務(wù)流程圖競(jìng)價(jià)推廣sem
  • 南昌網(wǎng)站建設(shè)公務(wù)查詢網(wǎng)站相關(guān)網(wǎng)址
  • 怎么做網(wǎng)站計(jì)劃寧波企業(yè)網(wǎng)站seo
  • 凡科做網(wǎng)站友情鏈接怎么做百度seo刷排名網(wǎng)址
  • 網(wǎng)站建設(shè)私單合同seo建站系統(tǒng)
  • 織夢(mèng)制作手機(jī)網(wǎng)站模板泉州關(guān)鍵詞優(yōu)化軟件
  • 獵頭做mapping網(wǎng)站百度關(guān)鍵詞查詢排名
  • 做文件的網(wǎng)站手機(jī)免費(fèi)建站系統(tǒng)