You can use a <transaction>
tag to group a set of test operation tags. A <transaction>
tag takes no attributes. If a <transaction>
tag appears inside of another transaction, the outer transaction is suspended while the inner transaction occurs, and is resumed again at the end of the inner transaction.
Note that <add-item>
tags in this element are processed one at a time. They cannot make forward references to other items and no attempt is made to satisfy database integrity constraints (beyond that automatically done with the cascade operator). Use the <import-items>
tag if you want to load in items with forward references.
All test operation tags are enclosed in a single transaction by default, so you do not need a <transaction>
tag. However, to avoid possible database deadlocks, you should place all test operation tags inside <transaction>
tags. For example:
For example, suppose you have this pattern:
<add-item item-descriptor="foo" id="1"/> <transaction> <print-item item-descriptor="foo" id="1"/> </transaction>
The <print-item>
tag will not find item 1 because that item has not been committed yet. In addition, you can run into deadlocks with this pattern if you try to access or modify items that may be locked by operations in the outer tag. Instead, you should typically use a pattern like:
<transaction> <add-item item-descriptor="foo" id="1"/> </transaction> <transaction> <print-item item-descriptor="foo" id="1"/> </transaction>
transaction Child Tags
Child Tag | How many? |
---|---|
add-item | zero or more |
export-items | zero or more |
print-item | zero or more |
query-items | zero or more |
remove-all-items | zero or more |
remove-item | zero or more |
rollback-transaction | zero or more |
transaction | zero or more |
update-item | zero or more |