0
0
Testing Fundamentalstesting~20 mins

Automation maintenance challenges in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Automation Maintenance Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Common cause of flaky automated tests

Which of the following is the most common cause of flaky automated tests that sometimes pass and sometimes fail without code changes?

ATests run only on local machines without parallel execution
BTests use hardcoded wait times that are always sufficient
CTests depend on external systems or network calls that are unstable
DTests use fixed data that never changes
Attempts:
2 left
💡 Hint

Think about what can cause unpredictable delays or failures outside the test code.

assertion
intermediate
2:00remaining
Assertion to detect UI element disappearance

You want to verify that a loading spinner disappears after a page finishes loading in an automated UI test. Which assertion best checks this?

Aassert element.is_displayed() == True
Bassert element.is_displayed() == False
Cassert element.exists() == True
Dassert element.text == 'Loading'
Attempts:
2 left
💡 Hint

The spinner should not be visible after loading completes.

🔧 Debug
advanced
2:00remaining
Debugging intermittent test failure due to timing

Given this test code snippet, what is the most likely cause of intermittent failure?

Testing Fundamentals
button.click()
assert message.text == 'Success'
AThe test does not wait for the message to update after clicking the button
BThe assertion syntax is incorrect and causes a syntax error
CThe button variable is not defined before clicking
DThe message element is not visible on the page
Attempts:
2 left
💡 Hint

Think about what happens immediately after clicking a button in UI tests.

framework
advanced
2:00remaining
Best practice for test data management in automation

Which approach is best to maintain test data for automated tests to reduce maintenance effort?

AStore test data externally in files or databases and load it dynamically during tests
BHardcode all test data directly inside test scripts
CManually update test data in each test script whenever requirements change
DUse random data generation without control or tracking
Attempts:
2 left
💡 Hint

Think about how to avoid changing many test scripts when data changes.

Predict Output
expert
3:00remaining
Output of test retry logic with flaky function

What is the output of this Python test retry code when the flaky_function fails the first time and passes the second time?

Testing Fundamentals
def flaky_function():
    flaky_function.counter += 1
    if flaky_function.counter < 2:
        raise Exception('Fail')
    return 'Pass'

flaky_function.counter = 0

for attempt in range(3):
    try:
        result = flaky_function()
        print(f'Attempt {attempt+1}: {result}')
        break
    except Exception as e:
        print(f'Attempt {attempt+1}: {e}')
else:
    print('All attempts failed')
AAll attempts failed
BAttempt 1: Pass
C
Attempt 1: Fail
Attempt 2: Fail
Attempt 3: Pass
D
Attempt 1: Fail
Attempt 2: Pass
Attempts:
2 left
💡 Hint

Count how many times flaky_function raises an exception before returning 'Pass'.