Auty自动化测试框架第二篇——读取与执行脚本列表

简介: [本文出自天外归云的博客园] 在Auty中的文件结构,lib目录下的read_selection.py和execute_selection.py文件: 其中read_selection.py文件的功能是把selection.

[本文出自天外归云的博客园]

在Auty中的文件结构,lib目录下的read_selection.py和execute_selection.py文件:

其中read_selection.py文件的功能是把selection.txt文件中的可执行脚本列表读取并返回:

# -*- coding: utf-8 -*-
import sys
import os

def read_selection():
    path = os.path.abspath(os.path.dirname(__file__))
    parentPath = os.path.dirname(path)
    selectionFilePath = os.path.join(parentPath,'scripts','selection.txt')
    selection = []
    for line in open(selectionFilePath):
        selection.append(line.replace('\n',''))
    return selection

而execute_selection.py文件的功能是把read_selction.py文件返回的列表中包含的脚本在命令行中执行:

# -*- coding: utf-8 -*-
from .read_selection import read_selection
import os

def execute_selection():
    selection = read_selection()
    for scriptPath in selection:
        os.system('python '+scriptPath)

至此就可以在根目录的start.py脚本中执行execute_selection方法来执行所有的脚本文件了:

# -*- coding: utf-8 -*-
from lib.execute_selection import execute_selection

if __name__ == '__main__':
    execute_selection()

一个自动化测试框架至此已经有了骨架,接下来要完善日志收集、生成测试结果文件等功能。

 
相关文章
|
7月前
|
测试技术 Linux
VPS一键测试脚本,无痕体验+自动导出,服务器测试更轻松
NodeQuality 是一款整合 Yabs、IPQuality、NetQuality 等主流 VPS 测试脚本的全能工具,支持一键测试硬件性能、IP属性、网络质量,并新增分享与导出功能。其“无痕测试”设计不安装依赖、不留残留,兼容性强;测试结果自动排版、截图并生成分享链接,极大提升效率。适合需要全面、快速、干净测试 VPS 的用户,是运维和测评的高效利器。
605 3
|
8月前
|
Web App开发 人工智能 JavaScript
主流自动化测试框架的技术解析与实战指南
本内容深入解析主流测试框架Playwright、Selenium与Cypress的核心架构与适用场景,对比其在SPA测试、CI/CD、跨浏览器兼容性等方面的表现。同时探讨Playwright在AI增强测试、录制回放、企业部署等领域的实战优势,以及Selenium在老旧系统和IE兼容性中的坚守场景。结合六大典型场景,提供技术选型决策指南,并展望AI赋能下的未来测试体系。
|
6月前
|
SQL 安全 Linux
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
327 1
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
|
6月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
627 1
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
|
7月前
|
安全 Linux 网络安全
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
465 2
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
|
7月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
525 1
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
|
7月前
|
安全 Linux 网络安全
Metasploit Framework 6.4.88 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.88 (macOS, Linux, Windows) - 开源渗透测试框架
645 0
|
6月前
|
人工智能 监控 Kubernetes
77_自动化脚本:Makefile与Airflow
在当今AI大模型时代,高效的工作流管理对于模型训练、推理和部署至关重要。随着大模型规模的不断增长和复杂度的提升,传统的手动脚本管理方式已无法满足需求。自动化脚本和工作流调度系统成为构建健壮、可重复、可扩展的LLM Pipeline的关键工具。其中,Makefile作为经典的自动化构建工具,与Airflow作为现代工作流调度平台的结合,为LLM开发团队提供了强大的工作流管理能力。
202 0
|
7月前
|
存储 测试技术 API
数据驱动开发软件测试脚本
今天刚提交了我的新作《带着ChatGPT玩转软件开发》给出版社,在写作期间跟着ChatGPT学到许多新知识。下面分享数据驱动开发软件测试脚本。
285 0
下一篇
开通oss服务