0
0
Testing Fundamentalstesting~20 mins

Authentication testing in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Authentication Testing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the primary goal of authentication testing?
Choose the best description of what authentication testing aims to verify in a software system.
ATo test if the system can handle multiple users simultaneously without crashing.
BTo check if the system correctly identifies and verifies users before granting access.
CTo verify that the system encrypts all user data during transmission.
DTo ensure the system's user interface is easy to navigate.
Attempts:
2 left
💡 Hint
Think about what authentication means in everyday life, like showing an ID to prove who you are.
Predict Output
intermediate
2:00remaining
What is the output of this authentication check code?
Given the following Python code simulating a simple authentication check, what will be printed?
Testing Fundamentals
def authenticate(user, password):
    valid_users = {'alice': 'pass123', 'bob': 'qwerty'}
    if user in valid_users and valid_users[user] == password:
        return 'Access granted'
    else:
        return 'Access denied'

print(authenticate('bob', 'qwerty'))
AAccess denied
BKeyError
CAccess granted
DNone
Attempts:
2 left
💡 Hint
Check if the username and password match the dictionary entries.
assertion
advanced
2:00remaining
Which assertion correctly tests failed login attempt?
You want to write a test to check that a login function returns False when given wrong credentials. Which assertion is correct?
Testing Fundamentals
def login(user, password):
    return user == 'admin' and password == 'secret'

# Choose the correct assertion to test login('admin', 'wrongpass')
Aassert login('admin', 'wrongpass') == False
Bassert login('admin', 'wrongpass') != False
Cassert login('admin', 'wrongpass') is None
Dassert login('admin', 'wrongpass') == True
Attempts:
2 left
💡 Hint
Think about what the function returns when credentials are incorrect.
🔧 Debug
advanced
2:00remaining
Identify the bug in this authentication test code
This test is supposed to check that a user cannot login with an empty password. What is the bug?
Testing Fundamentals
def test_empty_password():
    result = login('user1', '')
    assert result == True
AThe assertion expects True but should expect False for empty password.
BThe login function is missing a return statement.
CThe test function name should start with 'test_' to run.
DThe password parameter should be None, not empty string.
Attempts:
2 left
💡 Hint
Think about what should happen if the password is empty.
framework
expert
2:00remaining
Which test framework feature best supports authentication testing with multiple user roles?
You want to test authentication for different user roles (admin, guest, user) with various credentials. Which feature of a test framework helps organize and run these tests efficiently?
ASnapshot testing to compare UI changes after login.
BMocking external services to simulate network delays.
CCode coverage reports to measure tested code percentage.
DParameterized tests that run the same test logic with different inputs.
Attempts:
2 left
💡 Hint
Think about running the same test with different usernames and passwords.