0
0
Testing Fundamentalstesting~10 mins

Automation maintenance challenges in Testing Fundamentals - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to identify the main cause of flaky tests.

Testing Fundamentals
if test_result == 'intermittent failure':
    cause = '[1]'
else:
    cause = 'stable failure'
Drag options to blanks, or click blank then click option'
Acorrect assertion
Bconsistent network
Cfixed test data
Denvironment instability
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing stable or consistent options that do not cause flakiness.
2fill in blank
medium

Complete the code to update a locator when the UI changes.

Testing Fundamentals
def update_locator():
    locator = '[1]'
    return locator
Drag options to blanks, or click blank then click option'
A//button[@id='submit']
Bdiv#header
Cbutton.submit-btn
Dinput[type='text']
Attempts:
3 left
💡 Hint
Common Mistakes
Using an id that might change frequently.
3fill in blank
hard

Fix the error in the test code that causes maintenance issues.

Testing Fundamentals
def test_login():
    username = 'user1'
    password = '[1]'
    assert login(username, password) == True
Drag options to blanks, or click blank then click option'
Aenv.get('PASSWORD')
Bhardcoded_password
Cpassword123
D12345
Attempts:
3 left
💡 Hint
Common Mistakes
Hardcoding passwords that may change or cause security risks.
4fill in blank
hard

Fill both blanks to create a robust test that handles UI changes and waits for elements.

Testing Fundamentals
def click_button(driver):
    driver.implicitly_wait([2])
    button = driver.find_element_by_[1]('submit-btn')
    button.click()
Drag options to blanks, or click blank then click option'
Acss_selector
Bid
C5
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using less stable locators or too short wait times.
5fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters test cases by status.

Testing Fundamentals
filtered_tests = {test: status[1] 'passed' for test, status in test_results.items() if status [2] 'passed'}
Drag options to blanks, or click blank then click option'
A:
B==
C!=
D->
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong operators or symbols that break dictionary syntax.