appium+python自动化项目实战(一):引入nose和allure框架
生活随笔
收集整理的這篇文章主要介紹了
appium+python自动化项目实战(一):引入nose和allure框架
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本文將介紹一套比較完整的appium自動化框架,以python為編寫腳本語言,是因為python有強大的庫,同時易學易懂。
最終的測試框架代碼,將在jenkins項目中一鍵構建,執行自動化測試用例,并輸出展現形式豐富的測試報告。
appium及python的環境,自行安裝和配置,本人使用pycharam進行自動化開發。
一、安裝nose及依賴庫
- pip install nose
- pip install nose-allure-plugin
- pip install nose-html-reporting
- pip install nose-ittr
- pip install nosehtmlouput-2
二、安裝allure及依賴庫
- pip install allure-behave
- pip install allure-python-commons
三、編寫測試用例
import unittest import nose from nose.tools import * import logging from page.common.tab_bar_page import TabBarPage from page.video.video_tab_bar_page import VideoTabBarPage from common.common_operate import *class TestVideoTabBar(unittest.TestCase):log = logging.getLogger(__name__)@classmethoddef setUpClass(cls):cls.tab_bar = TabBarPage()cls.tab_bar.click_vedio_tab_bar()cls.video_tab_bar = VideoTabBarPage()def setUp(cls):pass# 點擊視頻文章標題@nose.allure.feature('視頻Tab')@nose.allure.story('點擊標題-查看視頻文章')def test_01_click_video_title(self):try:self.video_tab_bar.click_video_title(0)assert_true(is_visibility(self.video_tab_bar.video_article_comments_btn_loc))except TimeoutException as e:take_screenShot(u"點擊標題-查看視頻文章'")logging.error(e)assert_false(True)# 點擊視頻預覽圖@nose.allure.feature('視頻Tab')@nose.allure.story('點擊視頻預覽圖-查看視頻文章')def test_02_video_preview(self):try:self.video_tab_bar.click_video_preview(0)assert_true(is_visibility(self.video_tab_bar.video_article_list_comments_btn_loc))except TimeoutException as e:take_screenShot(u"點擊視頻預覽圖-查看視頻文章'")logging.error(e)assert_false(True)def tearDown(cls):get_press_keycode(4)@classmethoddef tearDownClass(cls):time.sleep(3)get_press_keycode(4)?
這里先貼一下測試用例腳本,后面會介紹自動化項目代碼、設計、運行原理等。
轉載于:https://www.cnblogs.com/luihengk/p/11413940.html
總結
以上是生活随笔為你收集整理的appium+python自动化项目实战(一):引入nose和allure框架的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 方舟php服务器控制,方舟基本管理命令代
- 下一篇: 查看tomcat目前用的jdk版本