• Tkinter生成界面--生成robot运行命令后,调命令行运行


    1、使用tkinter,生成界面,进行文件选则,参数选择;并且最后拼接生成robotframework的pabot命令。调动命令行工具,运行命令。

    from tkinter import *
    from tkinter import filedialog
    import subprocess
    import sys
    import configparser
    import os.path
    
    
    class ReadConfig:
        def __init__(self, file_name):
            self.cf = configparser.ConfigParser()
            self.read = self.cf.read(file_name, encoding="utf-8")
    
        def get_config(self, section, option):
            res = self.cf.get(section, option)
            return res
    
    
    def select_file(file):
        select_file_path = filedialog.askopenfilename()
        file.set(select_file_path)
    
    
    def select_directory():
        select_dir = filedialog.askdirectory()
        project_path.set(select_dir)
    
    
    def generate_cmd(kind):
        if flag.get() == 0:
            exclude_flag = "False"
        else:
            exclude_flag = "True"
        x_path = select_xml_path.get()
        e_path = select_export_path.get()
        if kind == "pabot":
            cmd = r"pabot --processes 3 --testlevelsplit -v ReplaceTestCase:True" + " -v OUTPUT_XML_FILEPATH:" + x_path +  \
              " -v ReplaceFilePath:" + e_path + " -v ExcludeFlag:" + exclude_flag + " -d reports Testcase\RegressionCase.robot"
            pabot_cmd.set(cmd)
        else:
            cmd = r"robot -v ReplaceTestCase:True" + " -v OUTPUT_XML_FILEPATH:" + x_path + \
                  " -v ReplaceFilePath:" +
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
  • 相关阅读:
    Sed流编辑器总结
    springboot - 2.7.3版本 - (一)简单web应用
    静态代码块Vs构造代码块
    Linux学习-40-格式化分区mkfs、mke2fs命令用法
    LINUX初级 总结
    每日三题 10.20
    ARP协议,ARP攻击和ARP欺骗
    Sui基金会举办了仪式并于9月底成功启动zkLogin
    【LeetCode】链表OJ题
    nfs 网络文件系统
  • 原文地址:https://blog.csdn.net/weixin_31315135/article/details/127603175