MB-500 · Question #163
Drag and Drop Question A company uses Dynamics 365 Finance. The company wants to create test cases by using the SysTest framework. You need to select the appropriate TestTransactionMode option for…
The correct answer is LegacyRollback; AutoRollback. SysTest Framework: TestTransactionMode Options Background The SysTest framework in Dynamics 365 Finance uses TestTransactionMode to control how database transactions are handled during test execution. The goal is usually to isolate test data so it doesn't pollute the database…
Question
Exhibit
Answer Area
Drag items
Correct arrangement
- LegacyRollback
- AutoRollback
Explanation
SysTest Framework: TestTransactionMode Options
Background
The SysTest framework in Dynamics 365 Finance uses TestTransactionMode to control how database transactions are handled during test execution. The goal is usually to isolate test data so it doesn't pollute the database.
The Four Options Explained
| Option | Behavior |
|---|---|
| None | No automatic rollback. Test data persists in the database after the test runs. |
| AutoRollback | Wraps the entire test in a transaction that is automatically rolled back after the test completes. Modern, clean approach. |
| LegacyRollback | Uses the older rollback mechanism. Suitable for tests that contain ttsbegin/ttscommit blocks internally, since AutoRollback cannot nest inside an already-open transaction. |
| LegacyRollbackWithUpdateTracking | Like LegacyRollback, but additionally tracks which records were updated, allowing more granular rollback control. |
Why This Arrangement
Position 1 → LegacyRollback
This is the correct choice when the test contains its own ttsbegin/ttscommit transaction blocks. AutoRollback wraps the test in an outer transaction - if the test then opens its own inner transaction, D365 Finance will throw an error because nested transaction commits are not permitted in this context. LegacyRollback sidesteps this by using a rollback mechanism that is compatible with tests that manage their own transactions internally.
Position 2 → AutoRollback
This is the correct choice for standard tests that do not open their own transactions. The framework automatically wraps the test method in a transaction and rolls it back upon completion, leaving the database in its original state with zero manual cleanup required. This is the recommended default for most modern unit tests.
Common Mistakes and Misconceptions
- Using
AutoRollbackwhen the test has its ownttsbegin/ttscommit: This causes a runtime error. The outer AutoRollback transaction conflicts with the inner one. - Using
Nonethinking it is "simpler": This pollutes the database with test data and makes tests non-repeatable. - Confusing
LegacyRollbackWithUpdateTrackingas always better thanLegacyRollback: The update tracking variant adds overhead and is only needed when you specifically need to track which records changed - not a general-purpose substitute. - Assuming
AutoRollbackis always the right modern answer: It is only correct when the test itself does not manage transactions.
Quick Rule of Thumb
Test manages its own transactions (
ttsbegin/ttscommitinside) →LegacyRollbackTest does NOT manage its own transactions →
AutoRollback
Topics
Community Discussion
No community discussion yet for this question.
