我想读取每个测试用例具有的pysystest.xml文件中的所有数据集。以下是此类文件的一个示例:
<?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文件?
我还想在它们上添加一些自定义属性,以便为它们的执行提供一些特定于测试案例的细节.框架是否支持这些文件上的属性添加功能?
事先谢谢你的帮助。
发布于 2016-05-13 08:39:20
pysys.py启动程序的打印助手允许您打印详细信息;
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类。使用文件名创建,然后该类中有访问器来检索值。
https://stackoverflow.com/questions/37203796
复制相似问题