Python + Pytest
Full OOP/decorators/generators + deep Pytest; DSA ONLY Easy→comfortable-Medium (0/90 JDs ask Hard). STOP before LeetCode Hard/DP, metaclasses, CPython internals.
- Generators & yield (lazy eval, memory, generator vs list)
Explain lazy iterators because pytest fixtures use yield for teardown.
'What is a generator / yield? Generator vs list — memory?' / 'Why does a fixture use yield?'
- Mutable vs immutable, pass-by-object-ref, deep/shallow copy, is vs ==, mutable-default bug
Explain Python's object model to avoid the classic bugs interviewers plant.
'What does def f(a, b=[]) do across calls?' / 'is vs ==?' / 'deep vs shallow copy?'
- OOP advanced (dunders, @property, class vs static vs instance methods)
Use special methods and method types correctly and explain the difference.
'@staticmethod vs @classmethod vs instance method?' / 'What is __repr__ vs __str__?' / 'Write a class usable in a with-block.'
- Comprehensions, enumerate/zip, unpacking, slicing
Write idiomatic Python fluently under time pressure.
Expected fluency baked into every live coding task; 'rewrite this loop as a comprehension'
- Exceptions (try/except/else/finally, custom exceptions, raising, chaining)
Reason about failure paths and design clean error handling in tests/framework.
'Difference between else and finally?' / 'How do you make a custom exception?' / 'How do you assert an exception is raised?' (links to pytest.raises)
- File / JSON / CSV handling
Load, parse and assert on structured test data.
'How do you read test data from a JSON/CSV?' / 'Parse this API response and assert a nested field.'
- Decorators (write from scratch, functools.wraps, decorator with args)
Write a decorator live because pytest markers/fixtures ARE decorators.
'What is a decorator? Write one.' / 'Write a decorator that retries a flaky function N times.'
- Context managers (with, __enter__/__exit__, contextlib.contextmanager)
Build resource setup/teardown safely — the pattern under fixtures and sessions.
'What is a context manager? Write one.' / 'Why use with over manual open/close?'
- OOP fundamentals (classes, __init__, self, inheritance, composition, 4 pillars)
Model a test-framework component as classes and defend the design choice live.
'Explain OOP with an example from your framework' / 'Design a class structure for a login-page test' / 'inheritance vs composition — when which?'
- Built-in data structures (list/dict/set/tuple) + time complexity + when-to-use
Pick the right structure and state its Big-O cold, because coding rounds hinge on it.
'list vs tuple; when a set vs dict?' / most coding solutions are graded on choosing hashmap/set for O(n)
- requests library (verbs, headers, params, json body, auth, sessions, timeouts, response handling)
Own API testing with requests — named in nearly every JD.
'Write an API test for this endpoint' / 'How do you structure an API client?' / 'How do you reuse auth across requests?'
- GIL (conceptual)
Explain why threads don't parallelize CPU work — justifies process-based test parallelism.
'What is the GIL? Does multithreading speed up CPU work?' / 'Why processes not threads for parallel tests?'
- async/await basics (coroutine, event loop concept)
Explain coroutines enough to test async APIs — deep asyncio NOT required.
'What is a coroutine / the event loop?' / 'How would you test an async API?'
- *args/**kwargs, closures, lambda, first-class functions
Use functions as values and flexible signatures — enables decorators/callbacks.
'What is a closure?' / 'What do *args and **kwargs do?' / 'sort by a custom key'
- functools (wraps, lru_cache, partial) + collections (defaultdict, Counter, deque, namedtuple)
Reach for the right stdlib helper — Counter/defaultdict shortcut many coding answers.
Elegance signal in coding rounds ('solve first-non-repeating char' -> Counter); 'how do you memoize?'
- Type hints / typing basics + dataclasses
Annotate code and use dataclasses for clean test-data models.
'What do type hints do at runtime?' / 'When would you use a dataclass?'
- conftest.py (sharing without imports, hierarchy, override)
Share fixtures/config across the suite via conftest and explain resolution order.
'What is conftest.py? How are fixtures shared?' / 'What if two conftests define the same fixture?'
- @pytest.mark.parametrize (multi-param, ids, stacking, indirect)
Drive data-driven tests and know parametrize stacking / indirect via fixtures.
'How do you parametrize? Stack parametrize?' / 'What is indirect parametrization?'
- Markers (skip/skipif/xfail, custom markers, registration, --strict-markers, -m)
Tag and select tests; register custom markers to avoid warnings/errors.
'skip vs xfail?' / 'How do you run only smoke tests?' / 'How do you register a custom marker?'
- Assertions (plain assert introspection, pytest.raises, pytest.approx)
Assert idiomatically and test exceptions/floats correctly.
'How do you assert an exception is raised?' / 'Why plain assert not assertEqual?' / 'Compare floats in a test.'
- Fixtures (yield setup/teardown, dependency injection, composition, autouse)
Design fixtures as the backbone of a framework and defend the choices.
'Explain fixtures' / 'fixture vs a parametrized test?' / 'How do fixtures compose?'
- Fixture scopes (function/class/module/package/session) + when each
Choose scope correctly and reason about it under parallelism — a senior signal.
'Fixture scopes — when session vs function?' / 'A session fixture leaks state between tests — fix it.'
- Mocking (unittest.mock: Mock/MagicMock/patch/side_effect/return_value/assert_called_with + pytest-mock mocker)
Isolate the unit under test — the genuine gap for QA-background SDETs.
'Mock vs MagicMock?' / 'return_value vs side_effect?' / 'How do you mock a method imported into another module?' (classic gotcha)
- Framework design (fixtures + POM/API-client abstraction, test-data mgmt, env config, CI integration)
Architect a maintainable framework and narrate the decisions — where SDET-2 offers are won.
'Design a framework to test a login page and list the test cases' / 'Walk me through a framework you built.'
- BDD (pytest-bdd / behave, Gherkin) + TDD
Speak to BDD/TDD workflow for shops that require it.
'Have you done BDD? How does Gherkin map to steps?' / 'Explain TDD.'
- Config (pyproject.toml / pytest.ini: addopts, testpaths, markers, ini_options)
Configure the runner project-wide the modern way.
'Where do you register markers / set default options?' / 'pyproject vs pytest.ini?'
- CLI flags (-k, -x, -v, -s, --lf, -ra, --durations, -n)
Drive the runner efficiently and debug fast in a live session.
'How do you rerun only failed tests?' / 'How do you find your slowest tests?'
- Ecosystem plugins (pytest-xdist, pytest-cov, pytest-html/allure, pytest-rerunfailures, pytest-mock, pytest-asyncio)
Assemble the standard plugin stack and know each one's failure mode.
'How do you run tests in parallel — and what breaks?' / 'How do you handle flaky tests?' / 'How do you gate on coverage?'
- Hooks (pytest_addoption, pytest_collection_modifyitems, pytest_runtest_makereport)
Customize runner behavior via conftest hooks — separates SDET-2 from junior.
'How would you add a --env CLI flag?' / 'How do you attach a screenshot on test failure?'
- Async pytest specifics (pytest-asyncio 1.0+: async fixtures, asyncio_mode, no event_loop fixture)
Test async code the modern (2025+) way after pytest-asyncio's breaking changes.
'How do you test an async function/endpoint?' / 'What changed in pytest-asyncio 1.0?'
- Custom pytest plugin (packaged, with hooks) / pytest_generate_tests dynamic parametrization
Package reusable pytest behavior — impressive, few candidates have it.
'Have you written a pytest plugin?' / 'How would you generate test cases dynamically from a data source?'
- Design patterns for test frameworks (Factory, Page Object, Strategy, Builder, Singleton)
Speak framework architecture in the design round — know 3-4, not all 23 GoF.
'Which design patterns have you used in your framework?' / 'How do you keep test data building clean?'
- SOLID principles
Justify clean framework design with named principles.
'Explain SOLID' / 'How do SOLID principles show up in your framework?'
- Schema / JSON response validation (jsonschema or pydantic)
Assert API contract shape, not just individual fields — higher-signal API testing.
'How do you validate an API response beyond status code?' / 'How do you assert the response schema?'
- Debugging: tracebacks, pdb/breakpoint(), logging
Debug fast in a live session and when triaging complex automation failures.
'How do you debug a failing/flaky test?' / live: 'this test fails, find out why'
- Two-pointer & sliding window
Recognize and apply the two highest-yield array/string patterns.
'Find all anagram start indices' (sliding window) / 'triplet summing to target' (two-pointer)
- Stack / queue
Use LIFO/FIFO for the bracket/parsing family.
'Validate balanced brackets' / 'evaluate/parse this expression'
- Recursion + sorting/searching (binary search)
Write clean recursion and binary search with correct base cases/bounds.
'Write factorial recursively, handle edge cases' / 'search in a sorted array in O(log n)'
- Easy trees + linked lists (traversal, reverse, palindrome, invert)
Handle basic pointer/node problems — the TOP of the useful DSA ceiling for this band.
'Invert a binary tree' / 'reverse a linked list' / 'is this linked list a palindrome without extra space'
- Arrays / strings / hashmaps / sets
Solve the most common coding-round category cleanly and optimally.
Live coding: 'return all start indices of pattern's anagrams' / 'first non-repeating character' / two-sum
- Complexity / Big-O trade-off reasoning (articulation)
State and defend time/space complexity out loud — the 2025-2026 raised bar.
'What's the time and space complexity?' / 'Can you do better than O(n^2)?' / 'What's the trade-off?'
- Hard tier (advanced DP, hard graphs Dijkstra/max-flow, segment trees, tries, union-find, backtracking, competitive speed)
Recognize the name only; do NOT invest sprint time here for this band.
Rare; only elite shops (e.g. D.E. Shaw) push tree+graph hard for SDET — not this band