1. Python Syntax & Variables for Test Automation

Python Variables & Data Types

Python is dynamically typed and indentation-sensitive. Variables are assigned with =.
# Test configuration variables:
base_url = "https://targetqa.com"
timeout_seconds = 30
implicit_wait = 2.5
is_headless = True
auth_token = None

# Arithmetic & comparison operators:
attempts = 0
attempts += 1
is_ready = attempts >= 3 and is_headless

Task

  • Implement format_test_status(passed_count, total_count):
  • 1. If total_count == 0, return "NO_TESTS".
  • 2. If passed_count == total_count, return "ALL_PASSED".
  • 3. Otherwise return f"{passed_count}/{total_count} PASSED".
πŸ’‘Common doubts
Did you like the problem?
Lesson 1 of 43
Python
Loading code editor…
Next