I'd like to read all the data set at the pysystest.xml
file each testcase has. The following is an example of such files:
<?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>
Is there an API from the framework for make easier this reading or do I have to parse the entire XML file?
I've also interested in adding some custom properties on them in order to provide some testcase-specific details for their executions... Does the framework supports a property-addition functionality on such files?
Thank you, in advance, for your help.
The print helper to the pysys.py launcher allows you to print the details;
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
So if you do a pysys.py print -f you will output the full information to stdout. You can then also print tests in ranges, or those defined in groups, or those that cover particular requirements etc. If you want to parse the descriptor programmatically you can use the XMLDescriptorParser class in the pysys.xml package. Create with the filename and then there are accessors in that class to retrieve the values.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.