0
0
Testing Fundamentalstesting~10 mins

Tester mindset and thinking in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test simulates a tester approaching a simple login form to verify if the login button is enabled only when both username and password fields are filled. It checks the tester's mindset of exploring positive and negative scenarios.

Test Code - Selenium with unittest
Testing Fundamentals
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import unittest

class TestLoginButton(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.get('https://example.com/login')

    def test_login_button_enabled_only_with_input(self):
        driver = self.driver
        wait = WebDriverWait(driver, 10)

        username = wait.until(EC.presence_of_element_located((By.ID, 'username')))
        password = wait.until(EC.presence_of_element_located((By.ID, 'password')))
        login_button = wait.until(EC.presence_of_element_located((By.ID, 'login-btn')))

        # Initially, login button should be disabled
        self.assertFalse(login_button.is_enabled(), 'Login button should be disabled initially')

        # Enter username only
        username.send_keys('user1')
        self.assertFalse(login_button.is_enabled(), 'Login button should remain disabled with only username')

        # Enter password
        password.send_keys('pass1')
        self.assertTrue(login_button.is_enabled(), 'Login button should be enabled when both fields are filled')

    def tearDown(self):
        self.driver.quit()

if __name__ == '__main__':
    unittest.main()
Execution Trace - 6 Steps
StepActionSystem StateAssertionResult
1Test starts and browser opens ChromeChrome browser window opens and navigates to https://example.com/login-PASS
2Waits until username input field is presentLogin page loaded with username, password fields and login button visibleUsername field is presentPASS
3Checks that login button is initially disabledLogin button is visible but disabledAssert login button is not enabledPASS
4Enters 'user1' into username fieldUsername field contains 'user1', password field empty, login button still disabledAssert login button remains disabledPASS
5Enters 'pass1' into password fieldBoth username and password fields filled, login button enabledAssert login button is enabledPASS
6Test ends and browser closesBrowser window closes-PASS
Failure Scenario
Failing Condition: Login button remains disabled even after both username and password are entered
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify about the login button initially?
AIt is disabled before any input
BIt is enabled before any input
CIt is hidden before any input
DIt is clickable before any input
Key Result
A good tester thinks about different input combinations and verifies UI behavior for each, including initial states and changes after user actions.