Commit 381eba5b by Administrator

2.19提交

parent ff54ef25
...@@ -13,11 +13,15 @@ import logging ...@@ -13,11 +13,15 @@ import logging
# from common.utils import DriverTools # from common.utils import DriverTools
class BasePage: class BasePage:
def __init__(self): def __init__(self):
self.driver = DriverUtils.get_web_driver() self.driver = DriverUtils.get_web_driver()
self.logger = None
self.set_logger() self.set_logger()
# 查找元素 # 查找元素
def find_el(self, loc, time=10, fre=0.5): def find_el(self, loc, time=10, fre=0.5):
ele = WebDriverWait(self.driver, time, fre).until(lambda x: x.find_element(*loc)) ele = WebDriverWait(self.driver, time, fre).until(lambda x: x.find_element(*loc))
...@@ -85,21 +89,36 @@ class BasePage: ...@@ -85,21 +89,36 @@ class BasePage:
# 设置日志记录器 # 设置日志记录器
def set_logger(self): def set_logger(self):
# 检查记录器是否已经存在,如果存在,则直接返回
if self.logger:
return
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)
# 创建一个处理程序,用于输出到控制台 # 创建一个处理程序,用于输出到控制台
console_handler = logging.StreamHandler() console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO) console_handler.setLevel(logging.INFO)
# 创建一个处理程序,用于输出到文件 # 创建一个处理程序,用于输出到文件
file_handler = logging.FileHandler('business_knowledge1.log') self.file_handler = logging.FileHandler('business_knowledge1.log', encoding='utf-8')
file_handler.setLevel(logging.INFO) self.file_handler.setLevel(logging.INFO)
# 创建一个格式化器,用于设置日志格式 # 创建一个格式化器,用于设置日志格式
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# 将格式化器添加到处理程序 # 将格式化器添加到处理程序
console_handler.setFormatter(formatter) console_handler.setFormatter(formatter)
file_handler.setFormatter(formatter) self.file_handler.setFormatter(formatter)
# 将处理程序添加到记录器 # 先清空已有的处理程序
self.logger.handlers.clear()
# 检查记录器中是否已经存在相同类型的处理程序,如果不存在,则添加
if console_handler not in self.logger.handlers:
self.logger.addHandler(console_handler) self.logger.addHandler(console_handler)
self.logger.addHandler(file_handler) if self.file_handler not in self.logger.handlers:
self.logger.addHandler(self.file_handler)
print(len(self.logger.handlers))
def log_info(self, message):
self.logger.info(message)
#
def close_logger(self):
self.file_handler.close()
- username: 17373027967
password: 3149390154Li
- username: 17373027968
password: 3149390154Li
...@@ -14,7 +14,7 @@ class HomePage(BasePage): ...@@ -14,7 +14,7 @@ class HomePage(BasePage):
super().__init__() super().__init__()
self.createBook=(By.XPATH, "//*[@id='App']/div/div/div[2]/ul/li[2]/ul/li[1]") self.createBook=(By.XPATH, "//*[@id='App']/div/div/div[2]/ul/li[2]/ul/li[1]")
self.bookSort=(By.XPATH,'//*[@id="App"]/div/section/div[1]/div[2]/div/div[2]/div/form/div[1]/div/div[2]/div/div/div') self.bookSort=(By.XPATH,'//*[@id="App"]/div/section/div[1]/div[2]/div/div[2]/div/form/div[1]/div/div[2]/div/div/div')
self.bookLabel=(By.XPATH,'') # self.bookLabel=(By.XPATH,'')
# def createBook(self): # def createBook(self):
# # 点击创建书刊 # # 点击创建书刊
......
...@@ -28,6 +28,7 @@ class LoginPage(BasePage): ...@@ -28,6 +28,7 @@ class LoginPage(BasePage):
time.sleep(10) time.sleep(10)
if __name__ == '__main__': if __name__ == '__main__':
driver = DriverUtils.get_web_driver() driver = DriverUtils.get_web_driver()
driver.get('https://rays7.raysgo.com/login') driver.get('https://rays7.raysgo.com/login')
......
import pytest import pytest
import time
import yaml
from Pages.login_page import LoginPage from Pages.login_page import LoginPage
from Util.Util import DriverUtils from Util.Util import DriverUtils
from loguru import logger
class TestLogin: class TestLogin:
@pytest.fixture() def setup_class(self):
def setup(self): # 在所有的测试用例脚本之前执行一次
print("\nSetup - Before Test") # 完成公共部分初始化
# 进行一些初始化工作
self.driver = DriverUtils.get_web_driver() self.driver = DriverUtils.get_web_driver()
self.driver.get('https://rays7.raysgo.com/login')
self.login_page = LoginPage() self.login_page = LoginPage()
# 如果有返回值,测试函数可以使用这个返回值
yield "Setup data"
# 后置条件 - 在测试运行后执行
print("\nTeardown - After Test")
# 进行一些清理工作
def teardown_class(self):
# 在所有的测试用例脚本之后执行一次
self.driver.quit()
pass
def setup_method(self):
# 在每个测试用例脚本之前执行一次
self.driver.get('https://rays7.raysgo.com/login')
time.sleep(3)
def teardown_method(self):
# 在每个测试用例脚本之后执行一次
pass
# @pytest.fixture(scope="module")
# def login_credentials(self):
# with open("../Data/login_credentials.yml", "r") as f:
# credentials = yaml.safe_load(f)
# return credentials
@pytest.mark.run
def test_case01(self, setup): @pytest.mark.run(order=1)
def test_login_success_case001(self):
self.login_page.login_username(username="17373027967", password="3149390154Li") self.login_page.login_username(username="17373027967", password="3149390154Li")
# 断言 登陆成功后的页面跳转
logger.info("登陆成功")
assert "https://rays7.raysgo.com/rays7/home" == self.driver.current_url
# 断言用户信息是否正确显示
def test_login_invalid_username(self):
self.login_page.login_username(username="173730279678",password="3149390154Li") # 账号不存在
# 断言登录失败后页面是否停留在登录页面
assert "https://rays7.raysgo.com/login" == self.driver.current_url
def test_login_invalid_password(self):
self.login_page.login_username(username="173730279678", password="3149390150Li") # 密码不正确
# 断言登录失败后页面是否停留在登录页面
assert "https://rays7.raysgo.com/login" == self.driver.current_url
...@@ -5,3 +5,5 @@ PO设计模式-UI自动化 ...@@ -5,3 +5,5 @@ PO设计模式-UI自动化
业务逻辑层Pages 业务逻辑层Pages
数据层Data-数据库操作 数据层Data-数据库操作
测试用例层TestCases 测试用例层TestCases
输出层:日志+HTML报告-output层
工具层:util
\ No newline at end of file
# 这是一个示例 Python 脚本。 # 这是一个示例 Python 脚本。
import pytest import pytest
from loguru import logger
from Util.handle_path import log_path
import subprocess
# 按 Shift+F10 执行或将其替换为您的代码。 # 配置日志输出格式和文件
# 按 双击 Shift 在所有地方搜索类、文件、工具窗口、操作和设置。 logger.add(sink=log_path,encoding="UTF-8",level="INFO",rotation="10MB",retention=20,format="{time} - {level} - {message}")
pytest.main(['-s','-v']) # 主函数
\ No newline at end of file pytest.main(['-v',"--alluredir=output/allure_report","--clean-alluredir"])
# 生成 HTML 报告
subprocess.call('allure generate output/allure_report -o output/allure_report_html --clean', shell=True)
\ No newline at end of file
{"uuid": "9cdca5b0-43f5-4490-b4cd-a0c893e18580", "children": ["01148645-cb03-4b27-b761-f58e26ac96bc", "9a784c51-3cc7-49ae-b7a1-47ba1ab5801c", "f0ce8e48-e670-4d6b-a167-ac34a4a102ad"], "befores": [{"name": "_xunit_setup_class_fixture_TestLogin", "status": "passed", "start": 1708290024155, "stop": 1708290025706}], "afters": [{"name": "_xunit_setup_class_fixture_TestLogin::0", "status": "passed", "start": 1708290083429, "stop": 1708290085603}], "start": 1708290024155, "stop": 1708290085603}
\ No newline at end of file
{"uuid": "db984f55-55de-405a-aad6-e62985dab687", "children": ["f0ce8e48-e670-4d6b-a167-ac34a4a102ad"], "befores": [{"name": "_xunit_setup_method_fixture_TestLogin", "status": "passed", "start": 1708290063469, "stop": 1708290073140}], "afters": [{"name": "_xunit_setup_method_fixture_TestLogin::0", "status": "passed", "start": 1708290083429, "stop": 1708290083429}], "start": 1708290063469, "stop": 1708290083429}
\ No newline at end of file
{"uuid": "e09211e3-c560-4847-91a0-0cf323623294", "children": ["01148645-cb03-4b27-b761-f58e26ac96bc"], "befores": [{"name": "_xunit_setup_method_fixture_TestLogin", "status": "passed", "start": 1708290025706, "stop": 1708290034849}], "afters": [{"name": "_xunit_setup_method_fixture_TestLogin::0", "status": "passed", "start": 1708290045142, "stop": 1708290045142}], "start": 1708290025706, "stop": 1708290045142}
\ No newline at end of file
{"uuid": "2c3178de-0c2e-4686-9420-93021eb1c688", "children": ["9a784c51-3cc7-49ae-b7a1-47ba1ab5801c"], "befores": [{"name": "_xunit_setup_method_fixture_TestLogin", "status": "passed", "start": 1708290045147, "stop": 1708290053182}], "afters": [{"name": "_xunit_setup_method_fixture_TestLogin::0", "status": "passed", "start": 1708290063469, "stop": 1708290063469}], "start": 1708290045147, "stop": 1708290063469}
\ No newline at end of file
{"name": "test_login_invalid_username", "status": "passed", "start": 1708290053182, "stop": 1708290063469, "uuid": "9a784c51-3cc7-49ae-b7a1-47ba1ab5801c", "historyId": "26544122cf70e22e96bace727415c5ce", "testCaseId": "26544122cf70e22e96bace727415c5ce", "fullName": "TestCases.test_login.TestLogin#test_login_invalid_username", "labels": [{"name": "parentSuite", "value": "TestCases"}, {"name": "suite", "value": "test_login"}, {"name": "subSuite", "value": "TestLogin"}, {"name": "host", "value": "DCG027335"}, {"name": "thread", "value": "3052-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "TestCases.test_login"}]}
\ No newline at end of file
2024-02-19 05:00:45.136 | INFO  | test_login:test_login_success_case001:43 - 登陆成功
{"name": "test_login_success_case001", "status": "passed", "attachments": [{"name": "stdout", "source": "84f172c5-fcb9-457a-8ab5-97db524038fb-attachment.txt", "type": "text/plain"}, {"name": "stderr", "source": "9a7c91d1-29fd-45b1-a969-773ff62ce369-attachment.txt", "type": "text/plain"}], "start": 1708290034849, "stop": 1708290045141, "uuid": "01148645-cb03-4b27-b761-f58e26ac96bc", "historyId": "5452e80e131503044fb24882c5820a04", "testCaseId": "5452e80e131503044fb24882c5820a04", "fullName": "TestCases.test_login.TestLogin#test_login_success_case001", "labels": [{"name": "tag", "value": "run(order=1)"}, {"name": "parentSuite", "value": "TestCases"}, {"name": "suite", "value": "test_login"}, {"name": "subSuite", "value": "TestLogin"}, {"name": "host", "value": "DCG027335"}, {"name": "thread", "value": "3052-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "TestCases.test_login"}]}
\ No newline at end of file
{"name": "test_login_invalid_password", "status": "passed", "start": 1708290073140, "stop": 1708290083429, "uuid": "f0ce8e48-e670-4d6b-a167-ac34a4a102ad", "historyId": "bf01a7f441fea677280889d0ba346cc6", "testCaseId": "bf01a7f441fea677280889d0ba346cc6", "fullName": "TestCases.test_login.TestLogin#test_login_invalid_password", "labels": [{"name": "parentSuite", "value": "TestCases"}, {"name": "suite", "value": "test_login"}, {"name": "subSuite", "value": "TestLogin"}, {"name": "host", "value": "DCG027335"}, {"name": "thread", "value": "3052-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "TestCases.test_login"}]}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
2024-02-19 05:00:45.136 | INFO  | test_login:test_login_success_case001:43 - 登陆成功
"Epic","Feature","Story","FAILED","BROKEN","PASSED","SKIPPED","UNKNOWN"
"","","","0","0","3","0","0"
{"uid":"b1a8273437954620fa374b796ffaacdd","children":[{"name":"test_login_success_case001","uid":"ef580f8a535da18e","parentUid":"b1a8273437954620fa374b796ffaacdd","status":"passed","time":{"start":1708290034849,"stop":1708290045141,"duration":10292},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":["run(order=1)"]},{"name":"test_login_invalid_username","uid":"5f69d1be31b5ea2d","parentUid":"b1a8273437954620fa374b796ffaacdd","status":"passed","time":{"start":1708290053182,"stop":1708290063469,"duration":10287},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]},{"name":"test_login_invalid_password","uid":"c0c32a357b6b4017","parentUid":"b1a8273437954620fa374b796ffaacdd","status":"passed","time":{"start":1708290073140,"stop":1708290083429,"duration":10289},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]}],"name":"behaviors"}
\ No newline at end of file
{"uid":"4b4757e66a1912dae1a509f688f20b0f","children":[],"name":"categories"}
\ No newline at end of file
{"uid":"83edc06c07f9ae9e47eb6dd1b683e4e2","children":[{"name":"TestCases.test_login","children":[{"name":"test_login_success_case001","uid":"ef580f8a535da18e","parentUid":"5b9bff3cc878bfbc7326d20d4563c3d2","status":"passed","time":{"start":1708290034849,"stop":1708290045141,"duration":10292},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":["run(order=1)"]},{"name":"test_login_invalid_username","uid":"5f69d1be31b5ea2d","parentUid":"5b9bff3cc878bfbc7326d20d4563c3d2","status":"passed","time":{"start":1708290053182,"stop":1708290063469,"duration":10287},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]},{"name":"test_login_invalid_password","uid":"c0c32a357b6b4017","parentUid":"5b9bff3cc878bfbc7326d20d4563c3d2","status":"passed","time":{"start":1708290073140,"stop":1708290083429,"duration":10289},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]}],"uid":"TestCases.test_login"}],"name":"packages"}
\ No newline at end of file
"Status","Start Time","Stop Time","Duration in ms","Parent Suite","Suite","Sub Suite","Test Class","Test Method","Name","Description"
"passed","Mon Feb 19 05:00:34 CST 2024","Mon Feb 19 05:00:45 CST 2024","10292","TestCases","test_login","TestLogin","","","test_login_success_case001",""
"passed","Mon Feb 19 05:01:13 CST 2024","Mon Feb 19 05:01:23 CST 2024","10289","TestCases","test_login","TestLogin","","","test_login_invalid_password",""
"passed","Mon Feb 19 05:00:53 CST 2024","Mon Feb 19 05:01:03 CST 2024","10287","TestCases","test_login","TestLogin","","","test_login_invalid_username",""
{"uid":"98d3104e051c652961429bf95fa0b5d6","children":[{"name":"TestCases","children":[{"name":"test_login","children":[{"name":"TestLogin","children":[{"name":"test_login_success_case001","uid":"ef580f8a535da18e","parentUid":"156334d8d56ad3e60f17bab8a0cb7a59","status":"passed","time":{"start":1708290034849,"stop":1708290045141,"duration":10292},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":["run(order=1)"]},{"name":"test_login_invalid_username","uid":"5f69d1be31b5ea2d","parentUid":"156334d8d56ad3e60f17bab8a0cb7a59","status":"passed","time":{"start":1708290053182,"stop":1708290063469,"duration":10287},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]},{"name":"test_login_invalid_password","uid":"c0c32a357b6b4017","parentUid":"156334d8d56ad3e60f17bab8a0cb7a59","status":"passed","time":{"start":1708290073140,"stop":1708290083429,"duration":10289},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]}],"uid":"156334d8d56ad3e60f17bab8a0cb7a59"}],"uid":"ee33cb4c057a9d7ca1eec0eaa23a4bee"}],"uid":"0408d924bc3d43de55080f45620fd22e"}],"name":"suites"}
\ No newline at end of file
{"uid":"5f69d1be31b5ea2d","name":"test_login_invalid_username","fullName":"TestCases.test_login.TestLogin#test_login_invalid_username","historyId":"26544122cf70e22e96bace727415c5ce","time":{"start":1708290053182,"stop":1708290063469,"duration":10287},"status":"passed","flaky":false,"newFailed":false,"newBroken":false,"newPassed":false,"retriesCount":0,"retriesStatusChange":false,"beforeStages":[{"name":"_xunit_setup_class_fixture_TestLogin","time":{"start":1708290024155,"stop":1708290025706,"duration":1551},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0},{"name":"_xunit_setup_method_fixture_TestLogin","time":{"start":1708290045147,"stop":1708290053182,"duration":8035},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0}],"afterStages":[{"name":"_xunit_setup_method_fixture_TestLogin::0","time":{"start":1708290063469,"stop":1708290063469,"duration":0},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0},{"name":"_xunit_setup_class_fixture_TestLogin::0","time":{"start":1708290083429,"stop":1708290085603,"duration":2174},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0}],"labels":[{"name":"parentSuite","value":"TestCases"},{"name":"suite","value":"test_login"},{"name":"subSuite","value":"TestLogin"},{"name":"host","value":"DCG027335"},{"name":"thread","value":"3052-MainThread"},{"name":"framework","value":"pytest"},{"name":"language","value":"cpython3"},{"name":"package","value":"TestCases.test_login"},{"name":"resultFormat","value":"allure2"}],"parameters":[],"links":[],"hidden":false,"retry":false,"extra":{"severity":"normal","retries":[],"categories":[],"tags":[]},"source":"5f69d1be31b5ea2d.json","parameterValues":[]}
\ No newline at end of file
{"uid":"c0c32a357b6b4017","name":"test_login_invalid_password","fullName":"TestCases.test_login.TestLogin#test_login_invalid_password","historyId":"bf01a7f441fea677280889d0ba346cc6","time":{"start":1708290073140,"stop":1708290083429,"duration":10289},"status":"passed","flaky":false,"newFailed":false,"newBroken":false,"newPassed":false,"retriesCount":0,"retriesStatusChange":false,"beforeStages":[{"name":"_xunit_setup_class_fixture_TestLogin","time":{"start":1708290024155,"stop":1708290025706,"duration":1551},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0},{"name":"_xunit_setup_method_fixture_TestLogin","time":{"start":1708290063469,"stop":1708290073140,"duration":9671},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0}],"afterStages":[{"name":"_xunit_setup_method_fixture_TestLogin::0","time":{"start":1708290083429,"stop":1708290083429,"duration":0},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0},{"name":"_xunit_setup_class_fixture_TestLogin::0","time":{"start":1708290083429,"stop":1708290085603,"duration":2174},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0}],"labels":[{"name":"parentSuite","value":"TestCases"},{"name":"suite","value":"test_login"},{"name":"subSuite","value":"TestLogin"},{"name":"host","value":"DCG027335"},{"name":"thread","value":"3052-MainThread"},{"name":"framework","value":"pytest"},{"name":"language","value":"cpython3"},{"name":"package","value":"TestCases.test_login"},{"name":"resultFormat","value":"allure2"}],"parameters":[],"links":[],"hidden":false,"retry":false,"extra":{"severity":"normal","retries":[],"categories":[],"tags":[]},"source":"c0c32a357b6b4017.json","parameterValues":[]}
\ No newline at end of file
{"uid":"ef580f8a535da18e","name":"test_login_success_case001","fullName":"TestCases.test_login.TestLogin#test_login_success_case001","historyId":"5452e80e131503044fb24882c5820a04","time":{"start":1708290034849,"stop":1708290045141,"duration":10292},"status":"passed","flaky":false,"newFailed":false,"newBroken":false,"newPassed":false,"retriesCount":0,"retriesStatusChange":false,"beforeStages":[{"name":"_xunit_setup_class_fixture_TestLogin","time":{"start":1708290024155,"stop":1708290025706,"duration":1551},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0},{"name":"_xunit_setup_method_fixture_TestLogin","time":{"start":1708290025706,"stop":1708290034849,"duration":9143},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0}],"testStage":{"status":"passed","steps":[],"attachments":[{"uid":"d0eba53c6f8e8917","name":"stdout","source":"d0eba53c6f8e8917.txt","type":"text/plain","size":2},{"uid":"b5413ff7ef187aa3","name":"stderr","source":"b5413ff7ef187aa3.txt","type":"text/plain","size":146}],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":true,"shouldDisplayMessage":false,"attachmentsCount":2},"afterStages":[{"name":"_xunit_setup_method_fixture_TestLogin::0","time":{"start":1708290045142,"stop":1708290045142,"duration":0},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0},{"name":"_xunit_setup_class_fixture_TestLogin::0","time":{"start":1708290083429,"stop":1708290085603,"duration":2174},"status":"passed","steps":[],"attachments":[],"parameters":[],"stepsCount":0,"attachmentStep":false,"hasContent":false,"shouldDisplayMessage":false,"attachmentsCount":0}],"labels":[{"name":"tag","value":"run(order=1)"},{"name":"parentSuite","value":"TestCases"},{"name":"suite","value":"test_login"},{"name":"subSuite","value":"TestLogin"},{"name":"host","value":"DCG027335"},{"name":"thread","value":"3052-MainThread"},{"name":"framework","value":"pytest"},{"name":"language","value":"cpython3"},{"name":"package","value":"TestCases.test_login"},{"name":"resultFormat","value":"allure2"}],"parameters":[],"links":[],"hidden":false,"retry":false,"extra":{"severity":"normal","retries":[],"categories":[],"tags":["run(order=1)"]},"source":"ef580f8a535da18e.json","parameterValues":[]}
\ No newline at end of file
{"uid":"ab17fc5a4eb3bca4b216b548c7f9fcbc","children":[{"name":"DCG027335","children":[{"name":"3052-MainThread","children":[{"name":"test_login_invalid_password","uid":"c0c32a357b6b4017","parentUid":"ec32863d7e138ca66b7ede8dc3241556","status":"passed","time":{"start":1708290073140,"stop":1708290083429,"duration":10289},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]},{"name":"test_login_invalid_username","uid":"5f69d1be31b5ea2d","parentUid":"ec32863d7e138ca66b7ede8dc3241556","status":"passed","time":{"start":1708290053182,"stop":1708290063469,"duration":10287},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]},{"name":"test_login_success_case001","uid":"ef580f8a535da18e","parentUid":"ec32863d7e138ca66b7ede8dc3241556","status":"passed","time":{"start":1708290034849,"stop":1708290045141,"duration":10292},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":["run(order=1)"]}],"uid":"ec32863d7e138ca66b7ede8dc3241556"}],"uid":"af897ab2d016d3a8f594a655b977be16"}],"name":"timeline"}
\ No newline at end of file
launch_status failed=0 1708290086000000000
launch_status broken=0 1708290086000000000
launch_status passed=3 1708290086000000000
launch_status skipped=0 1708290086000000000
launch_status unknown=0 1708290086000000000
launch_time duration=48580 1708290086000000000
launch_time min_duration=10287 1708290086000000000
launch_time max_duration=10292 1708290086000000000
launch_time sum_duration=30868 1708290086000000000
launch_retries retries=0 1708290086000000000
launch_retries run=3 1708290086000000000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Allure Report summary mail</title>
</head>
<body>
Mail body
</body>
</html>
launch_status_failed 0
launch_status_broken 0
launch_status_passed 3
launch_status_skipped 0
launch_status_unknown 0
launch_time_duration 48580
launch_time_min_duration 10287
launch_time_max_duration 10292
launch_time_sum_duration 30868
launch_retries_retries 0
launch_retries_run 3
[{"data":{}}]
\ No newline at end of file
[{"data":{"duration":48580}}]
\ No newline at end of file
[{"data":{"failed":0,"broken":0,"skipped":0,"passed":3,"unknown":0,"total":3}}]
\ No newline at end of file
{"5452e80e131503044fb24882c5820a04":{"statistic":{"failed":0,"broken":0,"skipped":0,"passed":1,"unknown":0,"total":1},"items":[{"uid":"ef580f8a535da18e","status":"passed","time":{"start":1708290034849,"stop":1708290045141,"duration":10292}}]},"26544122cf70e22e96bace727415c5ce":{"statistic":{"failed":0,"broken":0,"skipped":0,"passed":1,"unknown":0,"total":1},"items":[{"uid":"5f69d1be31b5ea2d","status":"passed","time":{"start":1708290053182,"stop":1708290063469,"duration":10287}}]},"bf01a7f441fea677280889d0ba346cc6":{"statistic":{"failed":0,"broken":0,"skipped":0,"passed":1,"unknown":0,"total":1},"items":[{"uid":"c0c32a357b6b4017","status":"passed","time":{"start":1708290073140,"stop":1708290083429,"duration":10289}}]}}
\ No newline at end of file
[{"data":{"run":3,"retry":0}}]
\ No newline at end of file
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<title>Allure Report</title>
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="stylesheet" type="text/css" href="plugin/screen-diff/styles.css">
</head>
<body>
<div id="alert"></div>
<div id="content">
<span class="spinner">
<span class="spinner__circle"></span>
</span>
</div>
<div id="popup"></div>
<script src="app.js"></script>
<script src="plugin/behaviors/index.js"></script>
<script src="plugin/packages/index.js"></script>
<script src="plugin/screen-diff/index.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FVWC4GKEYS"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-FVWC4GKEYS', {
'allureVersion': 'dev',
'reportUuid': 'f51dee26-670e-4134-a740-6a3970590928',
'single_file': false
});
</script>
</body>
</html>
'use strict';
allure.api.addTranslation('en', {
tab: {
behaviors: {
name: 'Behaviors'
}
},
widget: {
behaviors: {
name: 'Features by stories',
showAll: 'show all'
}
}
});
allure.api.addTranslation('ru', {
tab: {
behaviors: {
name: 'Функциональность'
}
},
widget: {
behaviors: {
name: 'Функциональность',
showAll: 'показать все'
}
}
});
allure.api.addTranslation('zh', {
tab: {
behaviors: {
name: '功能'
}
},
widget: {
behaviors: {
name: '特性场景',
showAll: '显示所有'
}
}
});
allure.api.addTranslation('de', {
tab: {
behaviors: {
name: 'Verhalten'
}
},
widget: {
behaviors: {
name: 'Features nach Stories',
showAll: 'Zeige alle'
}
}
});
allure.api.addTranslation('nl', {
tab: {
behaviors: {
name: 'Functionaliteit'
}
},
widget: {
behaviors: {
name: 'Features en story’s',
showAll: 'Toon alle'
}
}
});
allure.api.addTranslation('he', {
tab: {
behaviors: {
name: 'התנהגויות'
}
},
widget: {
behaviors: {
name: 'תכונות לפי סיפורי משתמש',
showAll: 'הצג הכול'
}
}
});
allure.api.addTranslation('br', {
tab: {
behaviors: {
name: 'Comportamentos'
}
},
widget: {
behaviors: {
name: 'Funcionalidades por história',
showAll: 'Mostrar tudo'
}
}
});
allure.api.addTranslation('ja', {
tab: {
behaviors: {
name: '振る舞い'
}
},
widget: {
behaviors: {
name: 'ストーリー別の機能',
showAll: '全て表示'
}
}
});
allure.api.addTranslation('es', {
tab: {
behaviors: {
name: 'Funcionalidades'
}
},
widget: {
behaviors: {
name: 'Funcionalidades por Historias de Usuario',
showAll: 'mostrar todo'
}
}
});
allure.api.addTranslation('kr', {
tab: {
behaviors: {
name: '동작'
}
},
widget: {
behaviors: {
name: '스토리별 기능',
showAll: '전체 보기'
}
}
});
allure.api.addTranslation('fr', {
tab: {
behaviors: {
name: 'Comportements'
}
},
widget: {
behaviors: {
name: 'Thèmes par histoires',
showAll: 'Montrer tout'
}
}
});
allure.api.addTranslation('pl', {
tab: {
behaviors: {
name: 'Zachowania'
}
},
widget: {
behaviors: {
name: 'Funkcje według historii',
showAll: 'pokaż wszystko'
}
}
});
allure.api.addTranslation('az', {
tab: {
behaviors: {
name: 'Davranışlar'
}
},
widget: {
behaviors: {
name: 'Hekayələr üzrə xüsusiyyətlər',
showAll: 'hamısını göstər'
}
}
});
allure.api.addTab('behaviors', {
title: 'tab.behaviors.name', icon: 'fa fa-list',
route: 'behaviors(/)(:testGroup)(/)(:testResult)(/)(:testResultTab)(/)',
onEnter: (function (testGroup, testResult, testResultTab) {
return new allure.components.TreeLayout({
testGroup: testGroup,
testResult: testResult,
testResultTab: testResultTab,
tabName: 'tab.behaviors.name',
baseUrl: 'behaviors',
url: 'data/behaviors.json',
csvUrl: 'data/behaviors.csv'
});
})
});
allure.api.addWidget('widgets', 'behaviors', allure.components.WidgetStatusView.extend({
rowTag: 'a',
title: 'widget.behaviors.name',
baseUrl: 'behaviors',
showLinks: true
}));
'use strict';
allure.api.addTranslation('en', {
tab: {
packages: {
name: 'Packages'
}
}
});
allure.api.addTranslation('ru', {
tab: {
packages: {
name: 'Пакеты'
}
}
});
allure.api.addTranslation('zh', {
tab: {
packages: {
name: '包'
}
}
});
allure.api.addTranslation('de', {
tab: {
packages: {
name: 'Pakete'
}
}
});
allure.api.addTranslation('nl', {
tab: {
packages: {
name: 'Packages'
}
}
});
allure.api.addTranslation('he', {
tab: {
packages: {
name: 'חבילות'
}
}
});
allure.api.addTranslation('br', {
tab: {
packages: {
name: 'Pacotes'
}
}
});
allure.api.addTranslation('ja', {
tab: {
packages: {
name: 'パッケージ'
}
}
});
allure.api.addTranslation('es', {
tab: {
packages: {
name: 'Paquetes'
}
}
});
allure.api.addTranslation('kr', {
tab: {
packages: {
name: '패키지'
}
}
});
allure.api.addTranslation('fr', {
tab: {
packages: {
name: 'Paquets'
}
}
});
allure.api.addTranslation('pl', {
tab: {
packages: {
name: 'Pakiety'
}
}
});
allure.api.addTranslation('az', {
tab: {
packages: {
name: 'Paketlər'
}
}
});
allure.api.addTab('packages', {
title: 'tab.packages.name', icon: 'fa fa-align-left',
route: 'packages(/)(:testGroup)(/)(:testResult)(/)(:testResultTab)(/)',
onEnter: (function (testGroup, testResult, testResultTab) {
return new allure.components.TreeLayout({
testGroup: testGroup,
testResult: testResult,
testResultTab: testResultTab,
tabName: 'tab.packages.name',
baseUrl: 'packages',
url: 'data/packages.json'
});
})
});
(function () {
var settings = allure.getPluginSettings('screen-diff', { diffType: 'diff' });
function renderImage(src) {
return (
'<div class="screen-diff__container">' +
'<img class="screen-diff__image" src="' +
src +
'">' +
'</div>'
);
}
function findImage(data, name) {
if (data.testStage && data.testStage.attachments) {
var matchedImage = data.testStage.attachments.filter(function (attachment) {
return attachment.name === name;
})[0];
if (matchedImage) {
return 'data/attachments/' + matchedImage.source;
}
}
return null;
}
function renderDiffContent(type, diffImage, actualImage, expectedImage) {
if (type === 'diff') {
if (diffImage) {
return renderImage(diffImage);
}
}
if (type === 'overlay' && expectedImage) {
return (
'<div class="screen-diff__overlay screen-diff__container">' +
'<img class="screen-diff__image" src="' +
expectedImage +
'">' +
'<div class="screen-diff__image-over">' +
'<img class="screen-diff__image" src="' +
actualImage +
'">' +
'</div>' +
'</div>'
);
}
if (actualImage) {
return renderImage(actualImage);
}
return 'No diff data provided';
}
var TestResultView = Backbone.Marionette.View.extend({
regions: {
subView: '.screen-diff-view',
},
template: function () {
return '<div class="screen-diff-view"></div>';
},
onRender: function () {
var data = this.model.toJSON();
var testType = data.labels.filter(function (label) {
return label.name === 'testType';
})[0];
var diffImage = findImage(data, 'diff');
var actualImage = findImage(data, 'actual');
var expectedImage = findImage(data, 'expected');
if (!testType || testType.value !== 'screenshotDiff') {
return;
}
this.showChildView(
'subView',
new ScreenDiffView({
diffImage: diffImage,
actualImage: actualImage,
expectedImage: expectedImage,
}),
);
},
});
var ErrorView = Backbone.Marionette.View.extend({
templateContext: function () {
return this.options;
},
template: function (data) {
return '<pre class="screen-diff-error">' + data.error + '</pre>';
},
});
var AttachmentView = Backbone.Marionette.View.extend({
regions: {
subView: '.screen-diff-view',
},
template: function () {
return '<div class="screen-diff-view"></div>';
},
onRender: function () {
jQuery
.getJSON(this.options.sourceUrl)
.then(this.renderScreenDiffView.bind(this), this.renderErrorView.bind(this));
},
renderErrorView: function (error) {
console.log(error);
this.showChildView(
'subView',
new ErrorView({
error: error.statusText,
}),
);
},
renderScreenDiffView: function (data) {
this.showChildView(
'subView',
new ScreenDiffView({
diffImage: data.diff,
actualImage: data.actual,
expectedImage: data.expected,
}),
);
},
});
var ScreenDiffView = Backbone.Marionette.View.extend({
className: 'pane__section',
events: function () {
return {
['click [name="screen-diff-type-' + this.cid + '"]']: 'onDiffTypeChange',
'mousemove .screen-diff__overlay': 'onOverlayMove',
};
},
initialize: function (options) {
this.diffImage = options.diffImage;
this.actualImage = options.actualImage;
this.expectedImage = options.expectedImage;
this.radioName = 'screen-diff-type-' + this.cid;
},
templateContext: function () {
return {
diffType: settings.get('diffType'),
diffImage: this.diffImage,
actualImage: this.actualImage,
expectedImage: this.expectedImage,
radioName: this.radioName,
};
},
template: function (data) {
if (!data.diffImage && !data.actualImage && !data.expectedImage) {
return '';
}
return (
'<h3 class="pane__section-title">Screen Diff</h3>' +
'<div class="screen-diff__content">' +
'<div class="screen-diff__switchers">' +
'<label><input type="radio" name="' +
data.radioName +
'" value="diff"> Show diff</label>' +
'<label><input type="radio" name="' +
data.radioName +
'" value="overlay"> Show overlay</label>' +
'</div>' +
renderDiffContent(
data.diffType,
data.diffImage,
data.actualImage,
data.expectedImage,
) +
'</div>'
);
},
adjustImageSize: function (event) {
var overImage = this.$(event.target);
overImage.width(overImage.width());
},
onRender: function () {
const diffType = settings.get('diffType');
this.$('[name="' + this.radioName + '"][value="' + diffType + '"]').prop(
'checked',
true,
);
if (diffType === 'overlay') {
this.$('.screen-diff__image-over img').on('load', this.adjustImageSize.bind(this));
}
},
onOverlayMove: function (event) {
var pageX = event.pageX;
var containerScroll = this.$('.screen-diff__container').scrollLeft();
var elementX = event.currentTarget.getBoundingClientRect().left;
var delta = pageX - elementX + containerScroll;
this.$('.screen-diff__image-over').width(delta);
},
onDiffTypeChange: function (event) {
settings.save('diffType', event.target.value);
this.render();
},
});
allure.api.addTestResultBlock(TestResultView, { position: 'before' });
allure.api.addAttachmentViewer('application/vnd.allure.image.diff', {
View: AttachmentView,
icon: 'fa fa-exchange',
});
})();
.screen-diff__switchers {
margin-bottom: 1em;
}
.screen-diff__switchers label + label {
margin-left: 1em;
}
.screen-diff__overlay {
position: relative;
cursor: col-resize;
}
.screen-diff__container {
overflow-x: auto;
}
.screen-diff__image-over {
top: 0;
left: 0;
bottom: 0;
background: #fff;
position: absolute;
overflow: hidden;
box-shadow: 2px 0 1px -1px #aaa;
}
.screen-diff-error {
color: #fd5a3e;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{"total":3,"items":[]}
\ No newline at end of file
[{"data":{}}]
\ No newline at end of file
{"total":0,"items":[]}
\ No newline at end of file
[{"data":{"duration":48580}}]
\ No newline at end of file
[{"uid":"ef580f8a535da18e","name":"test_login_success_case001","time":{"start":1708290034849,"stop":1708290045141,"duration":10292},"status":"passed","severity":"normal"},{"uid":"c0c32a357b6b4017","name":"test_login_invalid_password","time":{"start":1708290073140,"stop":1708290083429,"duration":10289},"status":"passed","severity":"normal"},{"uid":"5f69d1be31b5ea2d","name":"test_login_invalid_username","time":{"start":1708290053182,"stop":1708290063469,"duration":10287},"status":"passed","severity":"normal"}]
\ No newline at end of file
[{"data":{"failed":0,"broken":0,"skipped":0,"passed":3,"unknown":0,"total":3}}]
\ No newline at end of file
[{"data":{"run":3,"retry":0}}]
\ No newline at end of file
[{"uid":"5f69d1be31b5ea2d","name":"test_login_invalid_username","time":{"start":1708290053182,"stop":1708290063469,"duration":10287},"status":"passed","severity":"normal"},{"uid":"c0c32a357b6b4017","name":"test_login_invalid_password","time":{"start":1708290073140,"stop":1708290083429,"duration":10289},"status":"passed","severity":"normal"},{"uid":"ef580f8a535da18e","name":"test_login_success_case001","time":{"start":1708290034849,"stop":1708290045141,"duration":10292},"status":"passed","severity":"normal"}]
\ No newline at end of file
[{"uid":"ef580f8a535da18e","name":"test_login_success_case001","time":{"start":1708290034849,"stop":1708290045141,"duration":10292},"status":"passed","severity":"normal"},{"uid":"c0c32a357b6b4017","name":"test_login_invalid_password","time":{"start":1708290073140,"stop":1708290083429,"duration":10289},"status":"passed","severity":"normal"},{"uid":"5f69d1be31b5ea2d","name":"test_login_invalid_username","time":{"start":1708290053182,"stop":1708290063469,"duration":10287},"status":"passed","severity":"normal"}]
\ No newline at end of file
{"total":1,"items":[{"uid":"0408d924bc3d43de55080f45620fd22e","name":"TestCases","statistic":{"failed":0,"broken":0,"skipped":0,"passed":3,"unknown":0,"total":3}}]}
\ No newline at end of file
{"reportName":"Allure Report","testRuns":[],"statistic":{"failed":0,"broken":0,"skipped":0,"passed":3,"unknown":0,"total":3},"time":{"start":1708290034849,"stop":1708290083429,"duration":48580,"minDuration":10287,"maxDuration":10292,"sumDuration":30868}}
\ No newline at end of file
2024-02-19T04:24:38.779826+0800 - INFO - 登陆成功
2024-02-19T04:39:04.340853+0800 - INFO - 登陆成功
2024-02-19T04:43:35.680381+0800 - INFO - 登陆成功
2024-02-19T04:58:18.926796+0800 - INFO - 登陆成功
2024-02-19T05:00:45.136661+0800 - INFO - 登陆成功
2024-02-19T05:12:21.817077+0800 - INFO - 此时菜单点击的为:文档解读
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment