首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PySys。关于从pysystest.xml读取数据(+在其上添加新属性)(v0.9.2)

PySys。关于从pysystest.xml读取数据(+在其上添加新属性)(v0.9.2)
EN

Stack Overflow用户
提问于 2016-05-13 07:27:10
回答 1查看 31关注 0票数 0

我想读取每个测试用例具有的pysystest.xml文件中的所有数据集。以下是此类文件的一个示例:

代码语言:javascript
复制
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <pysystest state="runnable" type="auto">
        <description>
            <title>My testcase title</title>
            <purpose><![CDATA[My testcase description is this]]>
            </purpose>
        </description>
        <classification>
            <groups>
                <group>UAT</group>
            </groups>
        </classification>
        <data>
            <class module="run" name="PySysTest"></class>
        </data>
        <traceability>
            <requirements>
                <requirement></requirement>
            </requirements>
        </traceability>
    </pysystest>

框架中是否有API以使读取更容易,还是我必须解析整个XML文件?

我还想在它们上添加一些自定义属性,以便为它们的执行提供一些特定于测试案例的细节.框架是否支持这些文件上的属性添加功能?

事先谢谢你的帮助。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-13 08:39:20

pysys.py启动程序的打印助手允许您打印详细信息;

代码语言:javascript
复制
C:\pysys.py print -h

PySys System Test Framework (version 1.1.0): Console print test helper

Usage: pysys.py print [option]* [tests]*
    where options include;
       -h | --help                 print this message
       -f | --full                 print full information
       -g | --groups               print test groups defined
       -d | --modes                print test modes defined
       -r | --requirements         print test requirements covered
       -m | --mode      STRING     print tests that run in user defined mode
       -a | --type      STRING     print tests of supplied type (auto or manual, default all)
       -t | --trace     STRING     print tests which cover requirement id
       -i | --include   STRING     print tests in included group (can be specified multiple times)
       -e | --exclude   STRING     do not print tests in excluded group (can be specified multiple times)

   and where [tests] describes a set of tests to be printed to the console. Note that multiple test
   sets can be specified, and where none are given all available tests will be run. If an include
   group is given, only tests that belong to that group will be printed. If an exclude group is given,
   tests in the group will not be run. The following syntax is used to select a test set;

       test1    - a single testcase with id test1
       :test2   - upto testcase with id test2
       test1:   - from testcase with id test1 onwards
       id1:id2  - all tests between tests with ids test1 and test2

   e.g.
       pysys.py -i group1 -e group2 --full test1:test3

因此,如果您执行pysys.py打印-f,则会将全部信息输出到stdout。然后,您还可以打印范围内的测试,或分组中定义的测试,或者涵盖特定需求等的测试。如果希望以编程方式解析描述符,可以在pysys.xml包中使用pysys.xml类。使用文件名创建,然后该类中有访问器来检索值。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37203796

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档