Sample questions
Sd Test Data ManagementDifficulty 1
In test automation, what is a "fixture" most fundamentally used for?
- aCompiling the test suite into a single executable binary
- bSetting up known test data or state before the test✓
- cMeasuring how long each test takes to execute
- dFormatting the final test report into HTML
Explanation:A fixture sets up the known data or state a test needs before it runs (e.g. a user record, a populated database row), which is exactly (b). Compilation (a), timing (c) and report formatting (d) are unrelated concerns handled elsewhere.
Sd Test Data ManagementDifficulty 1
What is the main purpose of a "factory" (as in a test data factory) in test code?
- aTo generate valid test objects with sensible defaults✓
- bTo connect the test process to the production database
- cTo automatically retry a flaky test until it passes
- dTo compress test report files before uploading them to CI
Explanation:A factory builds valid test objects with sensible default values, and a test only overrides the specific fields relevant to what it is checking, which is (a). Connecting to production (b), retry logic (c) and report compression (d) are unrelated to what a factory does.
Sd Test Data ManagementDifficulty 1
What does "test data teardown" refer to?
- aWriting the assertions that check the expected output of a test
- bChoosing which browser a UI test should run in
- cRemoving or resetting the data a test created afterward✓
- dSelecting which tests run first based on their execution time
Explanation:Teardown is the cleanup step that removes or resets data created during a test, preventing leftover state from affecting later tests, which matches (c). Assertions (a), browser selection (b) and test ordering (d) are separate concerns.
Sd Test Data ManagementDifficulty 1
Why is "deterministic" test data generation preferred over fully random data in most automated tests?
- aRandom data always executes faster than fixed data
- bDeterministic data automatically encrypts itself for security
- cRandom data cannot be stored in a database
- dIt makes a failing test's outcome reproducible✓
Explanation:Deterministic data means the same input is used every run, so a failing test reproduces reliably and can be debugged, which is (d). Speed (a), self-encryption (b) and storage limitations (c) are not real properties tied to determinism.
Sd Test Data ManagementDifficulty 2
A test suite relies on a single shared "admin" user row that many tests read and modify. What is the main risk of this approach?
- aThe database will run out of disk space faster
- bShared rows always violate database foreign key constraints
- cThe application under test will compile more slowly
- dTests can interfere via the shared row's state✓
Explanation:When multiple tests read and write the same shared row, one test's change can alter the state another test depends on, causing order-dependent failures and flakiness, which is (d). Disk usage (a), compile speed (c) and foreign key violations (b) are not the inherent risk of sharing data.
Sd Test Data ManagementDifficulty 2
What is a key advantage of using a database transaction that is rolled back at the end of each test, instead of truncating tables between tests?
- aIt is typically faster since it avoids re-inserting baseline data✓
- bIt permanently deletes the table schema after every test
- cIt guarantees the test will pass regardless of the assertions
- dIt removes the need to write any assertions in the test
Explanation:Wrapping a test in a transaction and rolling it back avoids the overhead of truncating tables and re-inserting baseline/seed data for the next test, making it considerably faster in most cases, which is (a). The other options describe things a rollback strategy does not do.