Testing Tools
The frameworks you actually write tests with, from JVM unit runners and mocking libraries to browser E2E drivers and load generators across Python, Node, Ruby, PHP, .NET, and native stacks. Interviewers use this area to see whether you pick the right tool for a test level instead of forcing everything through one framework.
on this pageshowhide
explore
- JUnit191 questions
- Test Annotations22 questions
- Assertions & Assumptions27 questions
- Lifecycle & Fixtures18 questions
- Parameterized Tests27 questions
- Extension Model28 questions
- Test Runners & Suites20 questions
- Nested & Dynamic Tests15 questions
- Tags, Conditions & Parallelism19 questions
- JUnit Platform15 questions
- TestNGempty
- Mockito114 questions
- Mocks, Spies & Injection19 questions
- Stubbing23 questions
- Matchers & Captors16 questions
- Verification17 questions
- Advanced Mocking23 questions
- Strictness & Mocking Hygiene16 questions
- pytestempty
- Fixtures and Scopesempty
- Parametrizationempty
- Plugins and Mockingempty
- Jestempty
- Mocks and Spiesempty
- Async Testingempty
- Snapshot Testingempty
- Coverageempty
- Vitestempty
- Jasmineempty
- RSpec23 questions
- Example Groups & Hooks5 questions
- Expectations & Matchers6 questions
- Doubles & Message Stubs6 questions
- Run Order & Filtering6 questions
- Minitest14 questions
- Assertions & Spec DSL5 questions
- Mock Verification & Stubbing4 questions
- Runner, Plugins & Parallelism5 questions
- PHPUnit20 questions
- Test Cases & Assertions5 questions
- Data Providers & Attributes5 questions
- Mocks & Stubs5 questions
- Configuration & Coverage5 questions
- Pest12 questions
- Closure Tests & Expectations6 questions
- Architecture & Plugins6 questions
- xUnitempty
- NUnitempty
- MSTestempty
- GoogleTestempty
- Catch2empty
- ScalaTestempty
- Cypress256 questions
- Test Runner and Commands44 questions
- Selectors and Assertions29 questions
- Network Stubbing and Intercept25 questions
- Fixtures and Custom Commands25 questions
- Component Harness20 questions
- Pipeline Orchestration25 questions
- In-Browser Runtime30 questions
- Config and Node Events20 questions
- Debugging and Diagnostics21 questions
- Choosing and Moving17 questions
- Playwright287 questions
- Browsers and Contexts36 questions
- Locators and Auto-Waiting59 questions
- Assertions29 questions
- Fixtures and Test Config41 questions
- Network Interception32 questions
- Tracing and Debugging24 questions
- Run Orchestration33 questions
- Isolated Component Runs14 questions
- Positioning and Migration19 questions
- Selenium265 questions
- WebDriver Architecture40 questions
- Element Location32 questions
- Synchronization Model31 questions
- Element Interaction36 questions
- Browser Context Control24 questions
- Screenshots and Logs16 questions
- Abstraction Layers20 questions
- Grid Deployment28 questions
- Suite Execution16 questions
- Ecosystem and Positioning22 questions
- Puppeteerempty
- Webdriver.ioempty
- Nightwatchempty
- JMeter246 questions
- Plan Composition26 questions
- Load Shaping29 questions
- Dynamic Values26 questions
- Sample Verdicts22 questions
- Run Output27 questions
- Headless Execution27 questions
- Multi-Engine Runs20 questions
- Custom Behaviour23 questions
- Protocol Coverage30 questions
- Pipeline Fit16 questions
- k6161 questions
- Verdict Gating27 questions
- Executor Choice17 questions
- Script Anatomy25 questions
- Declared Settings16 questions
- Metric Model15 questions
- Transport Surface15 questions
- Measurement Delivery13 questions
- Runtime and Extension19 questions
- Automation Fit14 questions
- Gatling111 questions
- Injection Vocabulary30 questions
- Chained Builders26 questions
- Session Values23 questions
- Finished Simulation16 questions
- Ecosystem Placement16 questions
- Locustempty
- Lighthouseempty
- Chrome DevToolsempty
- REST Assured (has its own guide)133 questions
- Request DSL & Assertions6 questions
- Outgoing Call Setup18 questions
- Specification Reuse20 questions
- Response Consumption27 questions
- Payload Binding15 questions
- Credential Wiring16 questions
- Cross-Cutting Hooks15 questions
- Harness Placement16 questions
- Kotest108 questions
- Spec Styles16 questions
- Matchers & Assertions19 questions
- Property-Based Testing20 questions
- Data-Driven Testing9 questions
- Lifecycle & Configuration29 questions
- Platform & Ecosystem Integrations15 questions
- MockK92 questions
- Mocks, Spies and Lifecycle18 questions
- Stubbing14 questions
- Matchers and Capture17 questions
- Verification16 questions
- Mocking Kotlin Constructs13 questions
- Coroutines, Annotations and JUnit 514 questions
- Contract Testing29 questions
- Contract Testing Fundamentals4 questions
- Pact Consumer Tests4 questions
- Pact Provider Verification4 questions
- Pact Broker and can-i-deploy5 questions
- Spring Cloud Contract4 questions
- Message and Event Contracts4 questions
- Schema Evolution and Compatibility Gates4 questions
- Cucumber & BDD Automation43 questions
- Gherkin Syntax & Feature Files4 questions
- Scenario Outlines & Data Tables5 questions
- Step Definitions & Expressions5 questions
- Hooks, Tags & Execution Control5 questions
- State Sharing & Dependency Injection4 questions
- Cucumber-JVM & Runner Integration6 questions
- cucumber-js, Behave & SpecFlow/Reqnroll5 questions
- Reporting & Living Documentation5 questions
- Scenario Design & Anti-Patterns4 questions
- Testcontainers31 questions
- Core API and Lifecycle4 questions
- Module Containers5 questions
- Spring Boot Integration3 questions
- Networking and Wait Strategies4 questions
- Reuse and Performance5 questions
- Custom Images and Compose5 questions
- CI and Docker Environments5 questions
- Test Management & Reporting185 questions
- Case Inventories90 questions
- Result Consolidation95 questions
- API Mocking & Stub Servers110 questions
- Stand-In Definitions31 questions
- Lifecycle and Isolation32 questions
- Transport Conditions22 questions
- Fidelity Risks25 questions
- Browser & Device Clouds85 questions
- Sourcing the Fleet13 questions
- Remote Session Wiring24 questions
- Capacity and Cost16 questions
- Triaging from Afar16 questions
- Access and Data Trust16 questions
- Karate90 questions
- Glue-Free Execution13 questions
- Payload Matching29 questions
- Reuse and Defaults21 questions
- Mock Mode16 questions
- Adoption and Wiring11 questions
→ has its own guide
questions
2,606 · 22 sectionsIn JUnit 5, some teams mark tests with one custom annotation such as @SlowIntegrationTest instead of writing @Test plus @Tag("slow") on every method. What is that custom annotation called, and how does JUnit know to treat the method as a test?
basics
~20 sIt is a composed annotation: your own annotation type that is itself annotated with JUnit's @Test, @Tag, @ExtendWith and so on. Jupiter looks up annotations recursively, so anything meta-annotated with @Test is discovered and run as a test.
In JUnit 5, what does the @Disabled annotation do, how does putting it on a test class differ from putting it on a single test method, and what is the string argument used for?
basics
~20 s@Disabled skips a test instead of running it, reporting it as skipped rather than failed. On a method it skips that method; on a class it skips every test in the class, including its nested classes. The string argument is the reason, shown in reports and IDEs.
What rules must a Java method (and its enclosing class) satisfy for the JUnit 5 Jupiter engine to discover and run it as a test?
basics
~20 sAnnotate it with org.junit.jupiter.api.Test. The method must not be private, static or abstract, and must return void. Parameters are allowed only if a ParameterResolver supplies them (TestInfo, TestReporter, @TempDir...). The class must not be abstract and needs a single constructor; neither class nor method has to be public.
In JUnit 5, how do you make a single test fail automatically if it runs longer than a chosen duration, and what exactly happens when that limit is reached?
basics
~20 sAnnotate the test with JUnit Jupiter's @Timeout, e.g. @Timeout(value = 500, unit = TimeUnit.MILLISECONDS). The default unit is seconds. When the limit elapses the test fails with a TimeoutException naming the method and the configured duration.
In JUnit 5, how do you make a test stop at runtime and report itself as skipped when a precondition is not satisfied, and how does that outcome differ from a failure?
basics
~20 sCall Assumptions.assumeTrue(condition) (or assumeFalse) at the top of the test. If the condition does not hold, a TestAbortedException is thrown, the rest of the method never runs, and the test is reported as aborted or skipped — the build stays green rather than red.
In a Mockito test, what value comes back when you call a method on a mock that you never stubbed, and what part of Mockito decides that value?
basics
~10 sThe mock's default answer decides. Mockito's built-in default, Answers.RETURNS_DEFAULTS, gives 0 for numeric primitives, false for boolean, an empty collection, Optional or Stream for those types, and null for every other object. Nothing throws.
When writing Mockito stubs and verifications, when should you wrap a plain value in ArgumentMatchers.eq(), and when is passing the raw value directly the better style?
basics
~20 sUse eq() only when the same call already uses another matcher, because matchers and raw values cannot be mixed. If no argument needs a wildcard, pass plain values - eq() everywhere is noise with identical behaviour.
Explain what Mockito's ArgumentCaptor is for, how you create one and wire it into a verification, and how you read the captured value afterwards.
basics
~10 sAn ArgumentCaptor grabs the actual argument a mock received so you can assert on it. Create it with ArgumentCaptor.forClass(X.class) or @Captor, pass captor.capture() inside verify(...), then read captor.getValue() and assert normally.
In Mockito, what is an argument matcher such as any(), anyString() or anyInt(), and why would you stub or verify a call with one instead of passing a concrete expected value?
basics
~20 sA matcher is a placeholder used inside Mockito's when() or verify() saying 'any argument fitting this description' instead of one exact value. any() matches anything, anyString() any non-null String, anyInt() any int. Use them when the value is irrelevant or unpredictable.
You create a Mockito mock of a Java interface and then call a method on it that you never stubbed. What does that call return, and what else happens?
basics
~20 sNo real code runs. Mockito returns the type's default value: null for objects, 0 for numbers, false for boolean, and an empty collection, Optional or stream for those types. Void methods do nothing. The call is recorded so you can verify it later.
In rspec-mocks, what is the difference between allow(obj).to receive(:msg) and expect(obj).to receive(:msg)?
basics
~20 sallow(obj).to receive(:msg) permits a message and configures its reply; the example passes whether or not it is sent. expect(obj).to receive(:msg) also demands it: unless it arrives exactly once by the end of the example, the example fails.
In an RSpec spec, how do describe, context and it relate to each other, and what does nesting groups actually build?
basics
~20 sdescribe and context both create an example group and behave identically; it defines one example in a group. A nested group is a subclass of its parent, inheriting let, hooks and helpers, and each example runs in a fresh group instance.
In RSpec, how do the eq, eql, equal and be matchers differ when a spec checks an order total or an order object?
basics
~20 seq passes when actual == expected, eql when actual.eql?(expected), and equal or be(x) only when both are the same object (equal?). Bare be with no argument passes for any truthy value. eq is the default for values.
In an RSpec spec, how does instance_double differ from a plain double, and what does it check against the real class?
basics
~20 sA plain double accepts stubs for any method name, so it stays green when the real class changes. instance_double(SmsGateway) only lets you stub or expect instance methods SmsGateway really defines, and checks calls against their parameters.
In RSpec, how do let, let! and an instance variable assigned in a before hook differ in when setup runs?
basics
~20 slet is lazy, running its block on first call and memoizing the value for one example. let! also adds a before hook, so it always runs. An instance variable set in before always runs too, and reads as nil if misspelled.
With Minitest, what makes a method in a Minitest::Test subclass run as a test, and when do setup and teardown run?
basics
~10 sMinitest runs every public method whose name starts with test_ in a Minitest::Test subclass, each on a fresh instance. setup runs before every test and teardown after it, even when the test failed.
With Minitest 6, how do you run one test file, one test method, or only the tests matching a pattern?
basics
~20 sRun the file with ruby -Ilib:test, and filter tests with --include (alias -n) using a name or a /regexp/, or --exclude. Under rake use N=, X= or A=; Minitest 6's minitest command also accepts file.rb:line.
With Minitest, how does assert_raises decide whether a test passes, what does it return, and how do you check the error message?
basics
~10 sassert_raises(ErrorClass) { code } passes when the block raises that class or a subclass, and returns the exception so you can assert on its message. No exception, or a different one, fails the test.
With minitest-mock, how do Minitest::Mock#expect and #verify work, and what happens when code calls the mock differently than expected?
basics
~20 sexpect(name, retval, args) records one expected call and its return value; each actual call consumes one expectation. verify raises MockExpectationError for any expected call that never happened; unexpected arguments raise it at call time, unknown methods raise NoMethodError.
With minitest-mock, how does Object#stub replace Time.now for one block in a subscription-renewal test, and what restores the original?
basics
~20 sTime.stub(:now, fixed_time) { ... } redefines now on Time's singleton class for the length of the block, returning fixed_time or calling it if it is callable; an ensure clause restores the original method even if the block fails.
In a PHPUnit 13 phpunit.xml, what do the <testsuites> element, the bootstrap attribute and the <source> element each configure?
basics
~10 s<testsuites> names sets of test directories or files; bootstrap names a PHP script, usually vendor/autoload.php, included once before tests load; <source> declares your first-party code, which coverage and issue reporting are scoped to.
With a PHPUnit 13 test stub, how do you make a method return a value, choose one by argument, compute one, or throw?
basics
~10 sName the method with method(), then attach an answer: willReturn() for fixed values, willReturnMap() to pick by arguments, willReturnCallback() to compute from them, and willThrowException() to throw.
With PHPUnit, what is the difference between assertSame and assertEquals, and when does choosing the wrong one hide a bug?
basics
~20 sassertSame checks identity with ===: same type and value, and for objects the same instance. assertEquals checks loose equality: 90 equals '90', and separate objects with equal properties are equal. Loose checks can pass when the type is wrong.
In PHPUnit 13, how does a #[DataProvider] method feed a test, and why must that provider be public and static?
basics
~20 s#[DataProvider('name')] points a test at a public static method returning an iterable of argument arrays. PHPUnit calls it while building the suite, before any setUp(), so there is no instance to call it on; each array becomes one test run.
In PHPUnit 13, what is the difference between createStub() and createMock(), and how do you choose between them?
basics
~20 screateStub() returns a Stub that only answers calls with configured values; createMock() returns a MockObject that can also carry expects() rules that PHPUnit enforces. Stub collaborators that feed data in, mock those whose calls are the outcome.
In Pest, how do expect()->toBe() and toEqual() differ, and how do the not and and() modifiers change an expectation chain?
basics
~20 stoBe() checks type and value and, for objects, the same instance; toEqual() checks equal value loosely, so '1' equals 1 and two equal objects pass. not inverts only the next expectation, and and() starts a new expectation on another value.
In a Pest test closure, what is $this, how does beforeEach() share state through it, and what does pest()->extend()->in() change?
basics
~20 s$this is the PHPUnit test case instance the closure is bound to, a fresh one per test. beforeEach() stores state on it, such as $this->cart. pest()->extend(Base::class)->in('Feature') makes tests in that folder bind to your base class instead.
In Pest, how do test() and it() differ, and what does describe() add to the tests declared inside it?
basics
~20 stest() and it() both register one test from a description and a closure; it() only prefixes the description with 'it'. describe() groups tests under a shared name prefix and scopes the hooks and datasets declared inside it to that group.
In Pest, how would you write an arch() test that forbids controllers from using the database layer directly?
basics
~10 sWrite arch()->expect('App\Http\Controllers')->not->toUse([...]) naming the database namespace and classes such as PDO, or turn it around with arch()->expect('App\Database')->toOnlyBeUsedIn('App\Repositories'); Pest fails the test listing every file that breaks the rule.
What do Pest's --parallel and --tia options each do to a slow suite, and why does only one belong in the CI command?
basics
~20 s--parallel runs the whole suite across several processes through ParaTest, so it belongs in CI; --tia (Pest 5) records which files each test touches and later runs only affected tests, replaying cached results, so it is meant for local runs.
Which browsers can Cypress 16 launch, and how do you pick one for a run?
basics
~20 sCypress 16 launches Chrome-family browsers - Chrome, Chrome for Testing, Chromium and Edge - plus Firefox, experimental WebKit, and the deprecated bundled Electron. Choose one per run with the --browser flag, or set defaultBrowser in the Cypress config.
In Cypress, how do you test a link that opens in a new browser tab?
basics
~20 sCypress drives a single tab and has no tab-switching command, so assert the link rather than follow it: check its href and target attributes, request the URL directly with cy.request, or strip the target attribute so the click navigates the current tab.
Why does a console.log() in a Cypress spec never reach the terminal running cypress run?
basics
~20 sSpec code is evaluated inside the browser, so console.log() writes to that browser's DevTools console. The terminal belongs to Cypress's separate Node process, which only prints what code in cypress.config.js and its Node handlers log.
In Cypress, what happens to a request whose host matches a `blockHosts` pattern?
basics
~10 sCypress ends the request itself and answers 503, adding an x-cypress-matched-blocked-host header naming the pattern that matched. The request is never sent, so it resolves immediately instead of waiting on a third party.
In Playwright, what does expect(locator).toMatchAriaSnapshot() compare, and what does it ignore?
basics
~20 sIt compares an element's accessibility tree, meaning the roles, accessible names and a few ARIA states of its non-hidden nodes, against a YAML template. It ignores pixels, CSS, tag names, class names and hidden nodes.
In Playwright, what happens the first time expect(page).toHaveScreenshot() runs and no reference image exists?
basics
~20 sPlaywright captures the page, writes that capture to the snapshots folder as the new reference image, and still fails the test. A later run, or an automatic retry, compares against the file just written and passes.
In Playwright, what does expect.soft() do that a plain expect() does not?
basics
~10 sA soft assertion records its failure and lets the test keep running, while a plain expect throws and stops the test at that line. Both end with the test reported as failed.
In Playwright, what happens if you forget to await expect(locator).toBeVisible()?
basics
~20 sPlaywright's web-first matchers return a promise. Without await, the test body runs on and the test finishes before the matcher decides anything, so the assertion can never fail it — the error is dropped or blamed on a later test.
In Selenium, how do you read a JavaScript confirm dialog's text and then accept or cancel it?
basics
~10 sTake the dialog with driver.switchTo().alert(), which returns an Alert. Call getText() for its message, then accept() to press OK or dismiss() to press Cancel. Use sendKeys only on a prompt, before accepting it.
In Selenium, which Chrome preferences make a download land in a directory your test picked, with no save prompt?
basics
~20 sSet the Chrome preference download.default_directory to an absolute path and download.prompt_for_download to false, passed as the prefs experimental option on ChromeOptions. The browser then writes the file into that folder on whichever machine runs the browser.
Where does Selenium Manager store the drivers it downloads, and does every Selenium 4 run download again?
basics
~20 sIn a per-user cache folder, by default ~/.cache/selenium, and no. Selenium 4's Selenium Manager reuses a matching cached driver on later runs and downloads only when the cache has no suitable copy. SE_CACHE_PATH moves the folder.
In Selenium 4, what happens when you construct a ChromeDriver without configuring any chromedriver path?
basics
~20 sSelenium Manager runs automatically. The binary bundled in the Selenium 4 client detects the installed Chrome, works out the matching chromedriver, downloads it if the local cache lacks it, and returns the path, so the session starts with no PATH entry and no setup code.
In JMeter's CSV Data Set Config, what happens if you leave Variable Names empty?
basics
~20 sJMeter reads the file's first line and uses its fields as the variable names. That line is consumed as a header, never handed to a thread as data, and the Delimiter field must match the header's separator.
In JMeter, how do you write a call to a built-in function such as __UUID?
basics
~10 sJMeter function calls take the form ${__functionName(arg1,arg2)}. The double underscore marks a built-in, the parentheses hold comma-separated positional arguments, and a function that takes none may drop them: ${__UUID}.
In JMeter's Regular Expression Extractor, what does a Template value of $1$ refer to?
basics
~20 sTemplate $1$ inserts the text captured by the first parenthesised group of the Regular Expression field. JMeter builds the stored value from the Template, so $0$ means the whole match and $1$ the first group.
In Apache JMeter, how do you capture an order id from a JSON confirmation body for the next request?
basics
~20 sAdd a JSON Extractor as a child of the sampler that returns the confirmation body, give it a variable name and a JSON Path expression, then reference the captured value as ${orderId} in the next request.
In JMeter, what is the difference in scope between a variable and a property?
basics
~10 sA JMeter variable is a per-thread copy that no other thread can read or change. A JMeter property is a single JVM-wide value that every thread in the run shares.
In a k6 `constant-arrival-rate` scenario, what do the `rate`, `timeUnit` and `duration` keys each set?
basics
~10 sIn k6 v2, rate is how many iterations the executor starts during each timeUnit period, timeUnit is that period (default 1s), and duration is how long the scenario keeps starting them.
Which k6 scenario do the root vus and iterations options build, and what does duration do there?
basics
~20 sk6 turns root vus and iterations into a single scenario named default that uses the shared-iterations executor, so iterations is the total across all VUs. A root duration set alongside them becomes that scenario's maxDuration.
In k6, how do the constant-vus and ramping-vus executors differ, and what options does each take?
basics
~20 sk6's constant-vus executor holds a fixed number of VUs for a set time and takes vus plus duration. ramping-vus moves the count through a schedule and takes startVUs, stages and gracefulRampDown. Neither accepts the other's keys.
In a k6 arrival-rate scenario, what do preAllocatedVUs and maxVUs control, and what happens when maxVUs is omitted?
basics
~10 spreAllocatedVUs is the number of VUs k6 initializes before an arrival-rate scenario starts; maxVUs is the hard ceiling that pool may grow to mid-run. Omitted, maxVUs equals preAllocatedVUs, so the pool never grows.
Which of k6's four metric types does each built-in such as vus, http_reqs or checks use?
basics
~20 sk6 has four metric types: Counter, Gauge, Rate and Trend. Among the built-ins, vus and vus_max are Gauges, http_reqs and iterations are Counters, checks and http_req_failed are Rates, and every duration such as http_req_duration is a Trend.
Which command launches a Gatling simulation under Maven, Gradle, sbt and the JavaScript CLI, and how do the four names differ?
basics
~20 sMaven runs mvn gatling:test, Gradle runs ./gradlew gatlingRun, sbt runs sbt Gatling/testOnly with a class pattern, and the JavaScript CLI runs npx gatling run. Each build tool names its own entry point; there is no shared Gatling command.
In Gatling, how do you assemble a browse-then-checkout scenario out of two reusable chain values?
basics
~20 sStore each flow in a chain value returned by a standalone exec call, then hand both to scenario("Shopper").exec(browse, checkout). Chains are ordinary values, so one scenario composes as many of them as you like, in order.
In a Gatling scenario, how do you repeat a chain a fixed number of times or for a fixed duration, and how do the Java and Scala spellings of those loops differ?
basics
~10 srepeat(n) runs the wrapped chain n times; during(d) runs it until d has elapsed. Java, Kotlin and JavaScript attach the body with .on(...), while Scala passes it in a second parameter list.
In Gatling, what must a Java or Kotlin simulation declare before its first request — which class does it extend, and which imports put the DSL in scope?
basics
~10 sA Gatling simulation in Java or Kotlin extends io.gatling.javaapi.core.Simulation and needs two imports per DSL family: the package wildcard for the types, plus a static import of CoreDsl and HttpDsl for the DSL methods.
Which npm packages does a Gatling HTTP simulation written in JavaScript or TypeScript depend on, and which of them provides the gatling command-line tool?
basics
~10 sThree: @gatling.io/core for the DSL and the simulation function, @gatling.io/http for the HTTP protocol builder, and @gatling.io/cli, a dev dependency that supplies the gatling command you invoke as npx gatling.
In REST Assured, how do you authenticate every request by default and opt one test out?
basics
~10 sAssign a scheme to the static field RestAssured.authentication, for example RestAssured.basic(user, pass). It applies to any request that sets no scheme of its own. A single request opts out with given().auth().none().
In REST Assured, how do you carry a logged-in session id from one request to the next?
basics
~20 sRead the session id off the login response with sessionId(), then hand it to the next call as given().sessionId(value). REST Assured writes it as the JSESSIONID cookie. One SessionFilter instance added to both requests does that capture-and-replay for you automatically.
REST Assured has no auth().bearer() method - so how do you attach a bearer token to a request?
basics
~20 sUse given().auth().oauth2(token) - REST Assured has no bearer method at all. With the default HEADER signature that call installs a PreemptiveOAuth2HeaderScheme, which writes a plain Authorization: Bearer header on the request, with no signing and no challenge round trip.
What is the REST Assured library used for on the JVM, and how does its given/when/then request DSL work?
basics
~20 sREST Assured is a Java library for testing HTTP/REST APIs. You write one fluent chain: given() sets up the request (headers, body, params, auth), when() fires the HTTP call (get/post/put/delete), then() asserts on the response (status, headers, body values).
In REST Assured, how do you print the request and response only when a validation fails?
basics
~20 sREST Assured buffers the log instead of printing it when you chain given().log().ifValidationFails() on the request or then().log().ifValidationFails() on the response. The buffered text reaches the console only if a then() expectation fails. RestAssured.enableLoggingOfRequestAndResponseIfValidationFails() switches both sides on globally.
In a Kotest spec, how do you run setup code before every test and cleanup code after every test, and what do those callbacks receive?
basics
~20 sDeclare Kotest's beforeTest { } and afterTest { } blocks in the spec body. beforeTest receives the TestCase about to run; afterTest receives a TestCase/TestResult pair. Both are suspend lambdas, so suspending setup and cleanup work directly.
When a Kotest table-driven check (`forAll` over a `table(headers(...), row(...), ...)`) fails on some rows, do the remaining rows still run, and what does the resulting failure message contain?
basics
~20 sEvery row runs. Kotest collects the failures instead of stopping at the first one and then throws a single error that lists each failing row with its header/value pairs and that row's assertion error, so you see all bad rows in one run.
When you drive tests from a collection of values with Kotest's `withData`, how does the framework derive the name of each generated test, and what happens when the elements are not data classes?
basics
~20 sKotest asks the element for a stable identifier: a WithDataTestName implementation wins, then an @IsStableType-annotated class's toString, then a data class's toString. Anything else falls back to a type-derived name, so every case ends up named the same.
In Kotest, test bodies and lifecycle callbacks are declared as suspending functions. What does the framework do differently because of that, and what does it change about how you write a test that touches suspending code?
basics
~20 sKotest invokes every test body — and every lifecycle callback like beforeTest and beforeSpec — inside a coroutine, so suspending calls are made directly with no wrapper builder. The test scope is itself a CoroutineScope, and Kotest enforces the test's configured timeout around that coroutine.
A developer puts JUnit 5 annotations like @BeforeEach, @Disabled and @Tag inside a Kotest FunSpec and nothing happens — no setup runs, the "disabled" test still executes. Why are they inert, and what are the Kotest-side equivalents?
basics
~20 sKotest specs are executed by Kotest's own TestEngine, not JUnit Jupiter, and Jupiter annotations only mean something to the Jupiter engine. Use Kotest's own facilities instead: beforeTest/afterTest/beforeSpec, .config(enabled = false) or the x-prefixed builders, @Ignored on the spec, and Kotest Tag objects.
In a test class that declares MockK's @MockK and @SpyK properties, what does MockKAnnotations.init(this) actually do, and what breaks if you forget to call it?
basics
~20 sIt reflects over the given instance, creates a mock or spy for every MockK-annotated property and assigns it. Without it those lateinit properties are never set, so the first use throws UninitializedPropertyAccessException — the annotations do nothing on their own.
In a JUnit 5 test class annotated with @ExtendWith(MockKExtension::class), what work does MockK's extension actually perform, and at which points of the test lifecycle does it perform it?
basics
~20 sIt initialises annotated mock properties on each new test instance, resolves MockK-annotated test parameters, and afterwards runs unmockkAll() plus clearAllMocks() — after every test method, or after the whole class when the instance lifecycle is PER_CLASS.
After calling MockK's mockkConstructor(Foo::class), what does anyConstructed<Foo>() actually stand for, and which Foo instances does a stub recorded on it affect?
basics
~20 sanyConstructed<Foo>() is not an instance — it is a single shared handler for the class. Every Foo constructed while the class is mocked routes its calls through it, so one stub applies to all of them. Methods you never stub fall through to the real implementation.
When you call MockK's mockkObject(PricingRules) on a Kotlin object declaration, is a new instance created to stand in for the singleton, and what happens when the test then calls a method you never stubbed?
basics
~20 sNo new instance: MockK patches the existing singleton in place, so its identity and state are unchanged and every holder of a reference sees the patch. Unstubbed methods still run the real implementation — an object mock is a spy, not a strict mock.
When you use MockK's mockkStatic to stub a Kotlin top-level or extension function, how do you work out the exact string to pass, and what can change that name?
basics
~20 sPass the JVM name of the file facade class: package plus source file name with Kt appended. Greetings.kt in com.acme becomes com.acme.GreetingsKt. A @file:JvmName annotation on that file replaces the name, and the string must match exactly.
In Pact, Spring Cloud Contract and bi-directional contract testing, who authors the contract artefact first, and who must act when verification fails?
basics
~20 sPact is consumer-driven: the consumer records a pact file and the provider must satisfy it. Spring Cloud Contract is producer-first: the provider authors the contract and ships stubs. Bi-directional cross-checks a provider specification against consumer-recorded expectations, coupling the teams least.
In Pact, what does an asynchronous message pact verify, and what does excluding the transport leave unproven?
basics
~20 sAn asynchronous Pact message pact verifies that a producer emits a payload the named consumer's handler can decode. It covers payload shape and message metadata only. Topic, broker, delivery and serialization on the wire stay unproven.
What does the Pact Broker store that a shared folder of pact files cannot?
basics
~20 sThe Pact Broker stores pacts as a relation: each pact belongs to a named application and a specific version, and each verification result is recorded against that pact and the provider version that ran it. A folder stores only bytes.
What does a Pact consumer test do at runtime, and when does it write the pact file?
basics
~20 sA Pact consumer test starts a local mock HTTP server, registers the expected interactions on it, and runs the real client code against that server. The pact JSON file is written only when every registered interaction was requested and matched.
How does a Pact provider verification run fetch pacts and replay each interaction?
basics
~20 sA Pact verification run loads pact files from a broker, a URL or a local folder, then per interaction applies the provider state, sends the recorded request to the running provider, and matches the real response against the recorded expectations.
In a Cucumber .feature file, which lines does the Gherkin parser treat as keywords, and what happens to a line that matches none?
basics
~20 sGherkin recognises a fixed keyword set - Feature, Rule, Background, Scenario, Scenario Outline, Examples and the Given/When/Then/And/But step keywords. Other text is free-form description where the grammar allows it, and a parse error that fails the whole file anywhere else.
What does Cucumber's tag expression "@smoke and not @wip" select, and which lines can carry those tags?
basics
~20 sIt selects scenarios tagged @smoke that are not also tagged @wip. Cucumber tag expressions are boolean, with lowercase and, or, not and parentheses. Tags written on Feature, Rule, Scenario, Scenario Outline and Examples lines are inherited downward.
In Cucumber-JVM, what does the glue option point at, and what happens when it is wrong?
basics
~20 sThe glue option lists package names that Cucumber scans recursively for step definitions and hooks — packages, never file paths. Point it at the wrong package and every step of every scenario reports undefined, not just one line.
In a Cucumber Scenario Outline, where does an <placeholder> from an Examples row get substituted?
basics
~20 sCucumber substitutes an Examples value into the Scenario Outline's name, into step text, into the cells of a data table attached to a step, and into a doc-string body. Tags, comments and Background are never templated.
In Cucumber, how do you select a formatter and point it at an output file, and which built-in formats are machine-facing?
basics
~20 sCucumber-JVM registers a formatter with --plugin name:path or the cucumber.plugin property; cucumber-js uses --format name:path; Behave pairs --format with --outfile. Console and HTML output is written for people, while JSON, JUnit XML and message output is written for tools.
In Testcontainers, what do GenericContainer's withExposedPorts, withEnv and withCommand actually do?
basics
~20 sThey build the specification Testcontainers sends to Docker when the container is created: withExposedPorts marks container-internal ports to publish on random free host ports, withEnv sets environment variables, and withCommand overrides the image's default command.
In Testcontainers, what does PostgreSQLContainer give you that a plain GenericContainer does not?
basics
~20 sA module container ships the right image defaults, the environment wiring the image expects, a database-aware readiness check, and typed accessors — getJdbcUrl, getUsername, getPassword, getDatabaseName — that already contain the randomly mapped host port.
In Testcontainers, why must a test use getHost() and getMappedPort() instead of a fixed port?
basics
~20 sTestcontainers publishes each exposed container port on a random free port on the Docker host, so the number differs every run and cannot be hardcoded. getHost() matters too, because the daemon is not always on localhost.
How does Testcontainers locate a Docker daemon, and what does a CI runner need to provide?
basics
~20 sTestcontainers probes an ordered chain of client strategies at startup: the tc.host override, the DOCKER_HOST environment variable with its TLS settings, then the Unix socket at /var/run/docker.sock. A CI runner needs one reachable Docker endpoint, not Docker Desktop.
In Testcontainers, why does PostgreSQLContainer reject an image named registry.corp/pg:16?
basics
~10 sModule containers assert that the image name matches the one they were written for. Wrap a mirrored image with DockerImageName.parse(name).asCompatibleSubstituteFor("postgres") to declare it behaves like upstream, and construction succeeds.
In a TestRail-class test management product, what does assigning a test cycle item to a named tester change, and what does that tester's queue show?
basics
~20 sAssignment records an owner on one cycle item, so it leaves the shared pile and appears in that tester's filtered queue. It changes nobody's result: an assigned item stays untested until an outcome is recorded.
In a TestRail-class case repository, a requirement-coverage panel reports a single percentage — what sits in the numerator and what forms the denominator?
basics
~20 sThe denominator is the set of requirements the panel's saved filter selects; the numerator is how many of those satisfy the panel's configured covered condition. The unit counted is the requirement, not the test case.
In a TestRail- or Xray-class test case repository, what does attaching a variant table to one stored case do, and how does a placeholder in a step get its value?
basics
~20 sA variant table holds one row of values per run of the same stored case. Placeholders in the step text name a column, and the repository substitutes that row's value, producing one execution per row.
Before a TestRail-class case repository can create a defect in a separate issue tracker, what must the two systems agree on about the destination?
basics
~20 sTwo things, as a pair: which tracker project receives the item, and which item type it is created as. Trackers attach mandatory fields, closed value lists and workflow to that pair, so the mapping is defined against it.
In a TestRail-class case repository, what does filing a defect straight from a failed execution pre-fill into the new tracker item?
basics
~20 sFiling from a failed execution pre-fills the draft ticket with the run's context: which case failed, which cycle it ran in, the environment or build under test, who recorded the result, and the comment and evidence captured at failure time.
In MockServer, how do you verify that a POST to /catalogue/v1/holds actually arrived?
basics
~20 sMockServer keeps a journal of every request it receives, and MockServerClient.verify asserts against it. Pass a request definition describing the POST plus a VerificationTimes count. When nothing matches, verify throws an AssertionError listing the requests the journal did record.
In WireMock, what does the --no-request-journal flag switch off, and what then happens to verify()?
basics
~20 sWireMock's --no-request-journal flag stops the server recording the requests it receives. Because nothing is recorded, verification is not weakened but abolished: the disabled journal raises RequestJournalDisabledException. A verify() call after that flag can never pass, whatever the client sent.
In WireMock, what does makeStubsPersistent(false) change about the stubs a re-recording produces?
basics
~20 sWith makeStubsPersistent set to false, WireMock keeps the regenerated stubs in memory only: they serve requests while the instance lives and vanish on restart. Its default, true, writes each one as a JSON file under the mappings directory.
In WireMock, what do GET, POST and DELETE on /__admin/mappings each do?
basics
~20 sWireMock's admin API at /__admin/mappings lists every registered stub on GET and registers one new stub from the posted body on POST. DELETE on the same path removes all of them. Any HTTP client can drive it while the server runs.
What is a hosted mock service, and what does a team give up by adopting it?
basics
~20 sA hosted mock service is a stub server a vendor runs for you. Its canned replies live in an account on their platform, reachable at an address they control. What you give up is custody: review, rollback and availability.
Who records the video of a hosted browser session, and what must your test do to get it?
basics
~20 sThe service makes the recording on its own machine: a capture process beside the browser grabs the virtual screen for the whole session. A test asks with one setting in the session request and fetches the finished file afterwards.
Does raising a test runner's worker count raise a hosted provider's session ceiling?
basics
~20 sNo. The worker count is a local setting that decides how many sessions your suite tries to hold at once; the ceiling belongs to the provider account and is enforced there, whatever your runner is configured to do.
Why do a hosted browser provider's settings arrive as one colon-prefixed capability map?
basics
~20 sW3C WebDriver reserves the colon for extension capabilities, so a provider's settings must sit under prefixed keys; gathering them into a single map is convention, not a rule. Loose non-standard keys are not capabilities the specification recognises at all.
Which of your hostnames does a hosted browser provider's tunnel carry, and what happens to the rest?
basics
~20 sA tunnel carries traffic for a defined set of names; anything outside that set the remote browser fetches the ordinary way. The danger is silence: an unlisted internal name can resolve publicly and the test passes against the wrong site.
In Selenoid, what is created when a browser session starts and what happens to it at the end?
basics
~20 sSelenoid starts a fresh Docker container per WebDriver session, proxies the session to the driver inside, then force-removes it on delete. Nothing carries over: no profile, cookies, downloads or stray process, unless browsers.json mounts a host directory in.
In a Karate feature file, what does `match response contains { id: 1 }` assert, and what does `match response.ids contains 23` assert when `ids` is a JSON array?
basics
~20 sKarate's contains asserts a subset. Against a JSON object, every expected key must exist with an equal value while extra actual keys are ignored. Against a JSON array, every expected item must appear somewhere, in any order.
In a Karate feature file, what does the step `* match order == { id: 1, name: 'Billie' }` assert, and what happens if `order` also carries a `role` key?
basics
~20 sKarate's match == compares the entire payload in one recursive step: every key and value must correspond exactly. An extra role key fails the step, because == is a strict whole-payload comparison, not a subset check.
In a Karate feature file, what forms can the left-hand side of a `match` step take, and what does a bare `$` refer to there?
basics
~20 sThe left side of a Karate match step is a variable name, a JsonPath or XPath rooted at a variable such as response.name, a function or method call, or parenthesised JavaScript. A bare $ stands for the response, and a left side that starts with / is a bare XPath rooted there too.
In a Karate feature file, the response carries a server-generated `id` and a `createdAt` timestamp that differ on every run. How do you still assert the entire payload in a single `match` step?
basics
~20 sPut marker strings where the unpredictable values would go: match response == { id: '#uuid', createdAt: '#string', name: 'Billie' }. A marker asserts the value's type or shape instead of its content, so one step still checks every key.
In a Karate feature file, what does the expected value `'#? _ > 0'` assert inside a `match`, and what is `_` bound to while that expression runs?
basics
~20 s#? runs the JavaScript that follows it and passes only when the result is true. Karate binds _ to the actual value at that position, so '#? _ > 0' asserts that the value there is greater than zero.