提交 2c8758ac authored 作者: 彭甘宇's avatar 彭甘宇

1.处理代码路径变更导致无法检索用例问题;

2.增加错误日志打印和执行报错校验;
上级 916bca30
......@@ -4,6 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="7af2ddda-4337-4bd9-adfd-87ab868c08f9" name="更改" comment="修正提交" />
<list default="true" id="7af2ddda-4337-4bd9-adfd-87ab868c08f9" name="更改" comment="重新提交运维相关脚本代码">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/运维集控/项目测试/运维标准版/cases/05区域功能/01新增区域功能.py" beforeDir="false" afterPath="$PROJECT_DIR$/运维集控/项目测试/运维标准版/cases/05区域功能/01新增区域功能.py" afterDir="false" />
......@@ -24,12 +25,14 @@
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
<option name="UPDATE_TYPE" value="REBASE" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 6
}</component>
<component name="ProjectId" id="2qefK5jFULEB70ZGZl73iacPsCN" />
<component name="ProjectLevelVcsManager">
<OptionsSetting value="false" id="Update" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
......@@ -118,7 +121,15 @@
<option name="project" value="LOCAL" />
<updated>1735028100490</updated>
</task>
<option name="localTasksCounter" value="2" />
<task id="LOCAL-00002" summary="修正提交">
<option name="closed" value="true" />
<created>1735111241853</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1735111241853</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
......@@ -148,6 +159,7 @@
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="重新提交运维相关脚本代码" />
<option name="LAST_COMMIT_MESSAGE" value="重新提交运维相关脚本代码" />
<MESSAGE value="修正提交" />
<option name="LAST_COMMIT_MESSAGE" value="修正提交" />
</component>
</project>
\ No newline at end of file
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
# def suite_setup():
# wd = GSTORE['wd']
def suite_teardown():
INFO('进行清除操作')
wd = GSTORE['wd']
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class user_login_001:
name = 'login_test_01'
def teststeps(self):
wd = GSTORE['wd']
STEP(1, '用户登录')
user_login("admin@pgy", "ub@123456", "csba")
# run_login_tests()
# 读取 CSV 文件
csv_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'testdata', '01登录模块', '登录信息.csv'))
STEP(2, '验证是否登录成功')
get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
)
get_menu1 = get_menu.text
CHECK_POINT('检查是否出现弹窗', get_menu1 == "操作成功!")
def suite_teardown():
wd.quit()
with open(csv_path, newline='', encoding='utf-8') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
username = row['username']
password = row['password']
captcha = row['captcha']
STEP(1, f'用户 {username} 登录')
user_login(username, password, captcha)
# class user_login_002:
# name = 'login_test_02'
#
# def teststeps(self):
# STEP(1, '打开网页')
#
# wd = GSTORE['wd']
#
# STEP(2, '用户登录')
# user_login("admin@pgy", "ub@123456", "csba")
# # run_login_tests()
#
# STEP(3, '验证是否登录成功')
# get_menu = WebDriverWait(wd, 10).until(
# EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
# )
# get_menu1 = get_menu.text
# CHECK_POINT('检查是否出现弹窗', get_menu1 == "操作成功!")
#
# STEP(4, '清除数据')
#
# def suite_teardown():
# INFO('进行清除操作')
# wd.quit()
STEP(2, '验证是否登录成功')
try:
get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
)
get_menu1 = get_menu.text
CHECK_POINT('检查是否出现弹窗', get_menu1 == "操作成功!")
except Exception as e:
print(f"登录失败,原因是: {get_menu1}")
\ No newline at end of file
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class UserAdd001:
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class Userquery001:
name = 'user_query_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class UserModify001:
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class Userdelete001:
name = 'user_delete_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
def suite_setup():
wd = GSTORE['wd']
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class AreagroupAdd001:
name = 'Areagroup_add_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class AreagroupMod001:
name = 'Areagroup_modify_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class AreagroupDel001:
name = 'Areagroup_delete_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
def suite_setup():
wd = GSTORE['wd']
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class AreatypeAdd001:
name = 'Areatype_add_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class AreatypeMod001:
name = 'Areatype_mod_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class AreatypeDel001:
name = 'Areatype_del_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
def suite_setup():
wd = GSTORE['wd']
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class AreafuntionAdd001:
name = 'Areafuntion_add_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class areafuntionMod001:
name = 'areafuntion_mod_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
class areafuntionDel001:
name = 'areafuntion_del_001'
......
from lib.login import *
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
def suite_setup():
wd = GSTORE['wd']
......
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..')))
# 确保项目根目录被添加到模块搜索路径中
from lib.login import *
from 运维集控.项目测试.运维标准版.lib.base import *
def suite_setup():
wd = GSTORE['wd']
......
......@@ -11,6 +11,7 @@ import base64
import time
import logging
from hytest import *
import pandas as pd
from selenium import webdriver
from datetime import datetime
from urllib.parse import urlencode
......@@ -39,21 +40,21 @@ def open_browser():
def user_login(username, password, captcha):
wd = GSTORE['wd']
INFO('输入登录账号')
INFO(f'输入登录账号: {username}')
username_input = WebDriverWait(wd, 3).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='请输入登录账号']"))
)
username_input.clear()
username_input.send_keys(username)
INFO('输入登录密码')
INFO(f'输入登录密码: {password}')
password_input = WebDriverWait(wd, 3).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='请输入登录密码']"))
)
password_input.clear()
password_input.send_keys(password)
INFO('输入验证码')
INFO(f'输入验证码:{captcha}')
captcha_input = WebDriverWait(wd, 3).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='请输入验证码(区分大小写)']"))
)
......
=== [ 收集测试用例 ] ===
== cases\__st__.py
== cases\__init__.py
** no cases in this file, skip it.
== cases\01登录模块\__st__.py
== cases\01登录模块\__init__.py
** no cases in this file, skip it.
== cases\01登录模块\管理员登录.py
** no cases in this file , skip it.
== cases\02用户管理\__st__.py
== cases\02用户管理\01新增用户.py
** no cases in this file , skip it.
== cases\02用户管理\02查询用户.py
** no cases in this file , skip it.
== cases\02用户管理\03编辑用户.py
** no cases in this file , skip it.
== cases\02用户管理\04删除用户.py
** no cases in this file , skip it.
== cases\02用户管理\__init__.py
** no cases in this file, skip it.
== cases\03区域分组\__st__.py
== cases\03区域分组\01新增区域分组.py
** no cases in this file , skip it.
== cases\03区域分组\02编辑区域分组.py
** no cases in this file , skip it.
== cases\03区域分组\03删除区域分组.py
** no cases in this file , skip it.
== cases\03区域分组\__init__.py
** no cases in this file, skip it.
== cases\04区域类型\__st__.py
== cases\04区域类型\01新增区域类型.py
** no cases in this file , skip it.
== cases\04区域类型\02编辑区域类型.py
** no cases in this file , skip it.
== cases\04区域类型\03删除区域类型.py
** no cases in this file , skip it.
== cases\04区域类型\__init__.py
** no cases in this file, skip it.
== cases\05区域功能\__st__.py
== cases\05区域功能\01新增区域功能.py
** no cases in this file , skip it.
== cases\05区域功能\02编辑区域功能.py
** no cases in this file , skip it.
== cases\05区域功能\03删除区域功能.py
** no cases in this file , skip it.
== cases\05区域功能\__init__.py
** no cases in this file, skip it.
== cases\06区域管理\01新增区域.py
** no cases in this file, skip it.
== cases\06区域管理\02编辑区域.py
** no cases in this file, skip it.
== cases\06区域管理\03删除区域.py
** no cases in this file, skip it.
== cases\06区域管理\__init__.py
** no cases in this file, skip it.
== cases\07类型标签\__init__.py
** no cases in this file, skip it.
== cases\08协议管理\__init__.py
** no cases in this file, skip it.
== cases\09设备管理\__init__.py
** no cases in this file, skip it.
== cases\10数据类型\__init__.py
** no cases in this file, skip it.
== cases\11联动动作\__init__.py
** no cases in this file, skip it.
=== [ 执行测试用例 ] ===
!! 没有可以执行的测试用例
username,password,captcha
test_user1,ub@1234567,csba
test_user1,ub@123,csba
test_user1,,csba
test_user1,ub@1234567,
test_user2,ub@123,csba
test_user3,,csba
test_user4,ub@1234567,
,ub@1234567,csba
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论