Creates a test case by adding, modifying or deleting an attribute in the containing element.
Attribute | Description | Required |
name | The name of the attribute being added, modified or deleted to form the test case. | Yes |
value | The value of the attribute for the test case. If absent, the attribute is deleted. | No |
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"> <item partNum="123-AB"> <test:attribute id="partnum" name="partNum" result="fail" desc="item must have a partNum attribute" /> <test:attribute name="partNum" value="12A-AB" result="fail" desc="item must have a well formed partNum attribute" /> <test:attribute ref="partnum" name="productName" value="TestProductName" result="fail" desc="item cannot have a productName attribute instead of a partNum"/> <productName>TestProductName</productName> <quantity>1</quantity> <USPrice>0.00</USPrice> </item> </items>
This creates three test cases:
<items> <item> <productName>TestProductName</productName> <quantity>1</quantity> <USPrice>0.00</USPrice> </item> </items>
<items> <item partNum="12A-AB"> <productName>TestProductName</productName> <quantity>1</quantity> <USPrice>0.00</USPrice> </item> </items>
<items> <item productName="TestProductName"> <productName>TestProductName</productName> <quantity>1</quantity> <USPrice>0.00</USPrice> </item> </items>
Note that in these examples, there is no test case that partNum
can equal 123-AB
. It is usual for attribute
elements
to be nested inside case
elements.