Creates a test case by including or excluding all elements within the case element.
SUT test cases can be nested, resulting in multiple test cases run from the outside in. If an outer test case fails, then all inner test cases are automatically failed since their result is no longer relevant.
An empty test case element is allowed.
A test case can be the document root.
Attribute | Description | Required |
test | If with , include all nested elements that do not
belong to the SUT namespace. If without , exclude all nested
elements. |
Yes |
result | If If omitted, then this test case is not executed. This is usually because the id attribute has been specified and this test is referenced by another test (that is, this test is not a complete, independent, test). |
No |
desc | The test name or description. | Yes, unless the result attribute is omitted. |
id | Identifies this test so it can be included into another test
using the ref tag. |
No |
ref | Identifies a test (via the id attribute) that
is included into this test. That is, the referenced test case is activated when
this test case is the current test. Test case referencing is not recursive.
Reference multiple tests using nested ref elements. |
No |
<items xmlns:test="http://www.powerware.com/nz/XMLSchemaUnitTest"> <test:case test="with" result="pass" desc="items element can be empty" /> <test:case test="with" result="pass" desc="items entry can contain an item"> <item partNum="123-AB"> <productName>TestProductName</productName> <test:case id="quantity" test="without" result="fail" desc="item must have a quantity"> <quantity>1</quantity> </test:case> <test:case ref="quantity" test="with" result="pass" desc="item quantity can be 99"> <quantity>99</quantity> </test:case> <USPrice>0.00</USPrice> </item> </test:case> </items>
This creates four test cases:
<items />
<items> <item partNum="123-AB"> <productName>TestProductName</productName> <quantity>1</quantity> <USPrice>0.00</USPrice> </item> </items>
<items> <item partNum="123-AB"> <productName>TestProductName</productName> <USPrice>0.00</USPrice> </item> </items>
<items> <item partNum="123-AB"> <productName>TestProductName</productName> <quantity>99</quantity> <USPrice>0.00</USPrice> </item> </items>