This repository is a Python-based remake of an existing Java + TestNG + Maven Selenium project that was designed to run in CI (Jenkins-style), producing machine-readable results and human-readable reports.
The remake keeps the same functional intent (UI automation against LambdaTest’s sample Todo application) while modernising the stack to:
- pytest (test runner)
- selenium (Remote WebDriver)
- LambdaTest Selenium Grid (cloud execution)
- pytest-xdist (parallel execution)
- JUnit XML + HTML reports (CI-friendly outputs)
Target application under test: https://lambdatest.github.io/sample-todo-app/
- Test framework: TestNG
- Build runner: Maven Surefire
- Suite control: TestNG suite XML files (single / parallel / mobile)
- Typical CI outputs: Surefire/TestNG HTML + XML reports
- Test framework: pytest
- Dependency management: pip requirements
- Suite control: pytest markers (replacing TestNG suite XML)
- Parallelism: pytest-xdist (replacing TestNG parallel suite config)
- CI outputs: JUnit XML + HTML report (Jenkins-friendly)
.
├─ tests/
│ ├─ test_todo_1.py
│ ├─ test_todo_2.py
│ ├─ test_todo_3.py
│ └─ test_todo_mobile.py
├─ config/
│ └─ capabilities.py
├─ conftest.py
├─ pytest.ini
├─ requirements.txt
└─ README.md
-
Each test module mirrors the intent of the original Java test classes:
- navigate to the sample Todo app
- select pre-existing items
- add new items
- assert the final added item text appears as expected
-
Driver lifecycle mirrors TestNG’s
@BeforeMethod / @AfterMethod:- a pytest fixture creates a RemoteWebDriver session on LambdaTest
- the same fixture quits the session after each test
LambdaTest credentials are read from environment variables:
LT_USERNAMELT_ACCESS_KEY
Optional:
LT_BUILD_NAME(defaults to a sensible value if unset)LT_PROJECT_NAME(defaults to a sensible value if unset)
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
pip install -r requirements.txt
All examples below assume LT_USERNAME and LT_ACCESS_KEY are set.
Runs the tests marked as single:
pytest -m single
Runs the tests marked as mobile.
Note: this implementation uses mobile emulation-style settings inside a standard Selenium session (not Appium), to stay lightweight:
pytest -m mobile
Runs the tests marked as regression in parallel workers:
pytest -m regression -n auto
pytest --junitxml=reports/junit.xml
pytest --html=reports/report.html --self-contained-html
pytest -m regression -n auto --junitxml=reports/junit.xml --html=reports/report.html --self-contained-html
The reports/ directory is gitignored by default.
This remake intentionally simplifies or changes a few areas while keeping the same testing intent:
-
Suite XML files are not used
- Test selection is implemented with pytest markers instead of TestNG suite XML (
single.xml,parallel.xml,mobile.xml).
- Test selection is implemented with pytest markers instead of TestNG suite XML (
-
Mobile is lightweight, not full Appium
- The “mobile” flow is represented using browser-side configuration intended to be lightweight.
- If full device cloud coverage is required, the mobile capabilities can be upgraded to Appium-based execution.
-
Report formats differ
- Maven Surefire/TestNG reports are replaced with:
- JUnit XML (
--junitxml) - pytest HTML (
--html)
- JUnit XML (
- These are typically sufficient for Jenkins pipelines, but will not match Surefire report HTML exactly.
- Maven Surefire/TestNG reports are replaced with:
-
No legacy build outputs included
- Java build output folders (e.g.,
target/,surefire-reports/,maven-status/,test-classes/) are intentionally not included to keep the repo Python-only.
- Java build output folders (e.g.,
- Add a Jenkinsfile that:
- installs dependencies
- exports LT env vars via Jenkins credentials
- runs suite/marker selection based on job params
- archives
reports/artifacts
- Add a small CLI wrapper (or Makefile) to standardize commands:
make single,make mobile,make parallel
- Add page objects for cleaner test code organization if the suite grows
-
LT_USERNAMEandLT_ACCESS_KEYavailable in CI environment - Network access to LambdaTest hub endpoint
- Reports written to
reports/and archived by CI - Parallel worker count tuned for account concurrency