skip to content

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 pageshow

explore

→ has its own guide

questions

2,606 · 22 sections

In 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?

level: juniorimportance: must knowfreq 45%
basics
~20 s

It 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.

open as a page

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?

level: juniorimportance: must knowfreq 50%
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.

open as a page

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?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Annotate 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.

open as a page

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?

level: juniorimportance: must knowfreq 40%
basics
~20 s

Annotate 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.

open as a page

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?

level: juniorimportance: must knowfreq 45%
basics
~20 s

Call 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.

open as a page

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?

level: juniorimportance: must knowfreq 62%
basics
~10 s

The 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.

open as a page

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?

level: juniorimportance: must knowfreq 60%
basics
~20 s

Use 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.

open as a page

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.

level: juniorimportance: must knowfreq 70%
basics
~10 s

An 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.

open as a page

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?

level: juniorimportance: must knowfreq 70%
basics
~20 s

A 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.

open as a page

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?

level: juniorimportance: must knowfreq 78%
basics
~20 s

No 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.

open as a page

In rspec-mocks, what is the difference between allow(obj).to receive(:msg) and expect(obj).to receive(:msg)?

level: juniorimportance: must knowfreq 72%
basics
~20 s

allow(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.

open as a page

In an RSpec spec, how do describe, context and it relate to each other, and what does nesting groups actually build?

level: juniorimportance: must knowfreq 62%
basics
~20 s

describe 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.

open as a page

In RSpec, how do the eq, eql, equal and be matchers differ when a spec checks an order total or an order object?

level: juniorimportance: must knowfreq 76%
basics
~20 s

eq 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.

open as a page

In an RSpec spec, how does instance_double differ from a plain double, and what does it check against the real class?

level: middleimportance: must knowfreq 62%
basics
~20 s

A 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.

open as a page

In RSpec, how do let, let! and an instance variable assigned in a before hook differ in when setup runs?

level: middleimportance: must knowfreq 74%
basics
~20 s

let 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.

open as a page

With Minitest, what makes a method in a Minitest::Test subclass run as a test, and when do setup and teardown run?

level: juniorimportance: must knowfreq 72%
basics
~10 s

Minitest 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.

open as a page

With Minitest 6, how do you run one test file, one test method, or only the tests matching a pattern?

level: juniorimportance: must knowfreq 58%
basics
~20 s

Run 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.

open as a page

With Minitest, how does assert_raises decide whether a test passes, what does it return, and how do you check the error message?

level: middleimportance: must knowfreq 55%
basics
~10 s

assert_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.

open as a page

With minitest-mock, how do Minitest::Mock#expect and #verify work, and what happens when code calls the mock differently than expected?

level: middleimportance: must knowfreq 52%
basics
~20 s

expect(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.

open as a page

With minitest-mock, how does Object#stub replace Time.now for one block in a subscription-renewal test, and what restores the original?

level: middleimportance: must knowfreq 50%
basics
~20 s

Time.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.

open as a page

In a PHPUnit 13 phpunit.xml, what do the <testsuites> element, the bootstrap attribute and the <source> element each configure?

level: juniorimportance: must knowfreq 50%
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.

open as a page

With a PHPUnit 13 test stub, how do you make a method return a value, choose one by argument, compute one, or throw?

level: juniorimportance: must knowfreq 56%
basics
~10 s

Name 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.

open as a page

With PHPUnit, what is the difference between assertSame and assertEquals, and when does choosing the wrong one hide a bug?

level: juniorimportance: must knowfreq 75%
basics
~20 s

assertSame 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.

open as a page

In PHPUnit 13, how does a #[DataProvider] method feed a test, and why must that provider be public and static?

level: middleimportance: must knowfreq 60%
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.

open as a page

In PHPUnit 13, what is the difference between createStub() and createMock(), and how do you choose between them?

level: middleimportance: must knowfreq 64%
basics
~20 s

createStub() 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.

open as a page

In Pest, how do expect()->toBe() and toEqual() differ, and how do the not and and() modifiers change an expectation chain?

level: juniorimportance: must knowfreq 58%
basics
~20 s

toBe() 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.

open as a page

In a Pest test closure, what is $this, how does beforeEach() share state through it, and what does pest()->extend()->in() change?

level: middleimportance: must knowfreq 50%
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.

open as a page

In Pest, how do test() and it() differ, and what does describe() add to the tests declared inside it?

level: juniorimportance: should knowfreq 50%
basics
~20 s

test() 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.

open as a page

In Pest, how would you write an arch() test that forbids controllers from using the database layer directly?

level: middleimportance: should knowfreq 30%
basics
~10 s

Write 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.

open as a page

What do Pest's --parallel and --tia options each do to a slow suite, and why does only one belong in the CI command?

level: middleimportance: should knowfreq 35%
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.

open as a page

Which browsers can Cypress 16 launch, and how do you pick one for a run?

level: juniorimportance: must knowfreq 76%
basics
~20 s

Cypress 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.

open as a page

Why do Cypress commands fail after the app navigates to another origin?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Cypress runs inside the browser and obeys the same-origin policy, so a test is bound to one origin and cannot touch a document from a different one. Wrap the commands for the new origin in a cy.origin() block.

open as a page

Why does a console.log() in a Cypress spec never reach the terminal running cypress run?

level: juniorimportance: must knowfreq 58%
basics
~20 s

Spec 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.

open as a page

In Cypress, what happens to a request whose host matches a `blockHosts` pattern?

level: juniorimportance: must knowfreq 55%
basics
~10 s

Cypress 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.

open as a page

In Playwright, what does expect(locator).toMatchAriaSnapshot() compare, and what does it ignore?

level: juniorimportance: must knowfreq 45%
basics
~20 s

It 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.

open as a page

In Playwright, how does expect(locator).toBeHidden() differ from expect(locator).not.toBeVisible()?

level: juniorimportance: must knowfreq 58%
basics
~20 s

In outcome they are the same. Both retry until the element is hidden or absent from the DOM, and both pass when it never existed at all. The difference is readability and the failure message, not semantics.

open as a page

In Playwright, what happens the first time expect(page).toHaveScreenshot() runs and no reference image exists?

level: juniorimportance: must knowfreq 74%
basics
~20 s

Playwright 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.

open as a page

In Playwright, what does expect.soft() do that a plain expect() does not?

level: juniorimportance: must knowfreq 56%
basics
~10 s

A 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.

open as a page

In Playwright, what happens if you forget to await expect(locator).toBeVisible()?

level: juniorimportance: must knowfreq 84%
basics
~20 s

Playwright'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.

open as a page

In Selenium, how do you read a JavaScript confirm dialog's text and then accept or cancel it?

level: juniorimportance: must knowfreq 78%
basics
~10 s

Take 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.

open as a page

In Selenium, which Chrome preferences make a download land in a directory your test picked, with no save prompt?

level: juniorimportance: must knowfreq 74%
basics
~20 s

Set 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.

open as a page

In Selenium, what is the difference between driver.get(url) and driver.navigate().to(url)?

level: juniorimportance: must knowfreq 78%
basics
~10 s

Nothing functional separates them. Both send the same WebDriver Navigate To command and load the URL in the current tab. navigate() exists because the object it returns also carries back, forward and refresh.

open as a page

Where does Selenium Manager store the drivers it downloads, and does every Selenium 4 run download again?

level: juniorimportance: must knowfreq 56%
basics
~20 s

In 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.

open as a page

In Selenium 4, what happens when you construct a ChromeDriver without configuring any chromedriver path?

level: juniorimportance: must knowfreq 74%
basics
~20 s

Selenium 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.

open as a page

In JMeter's CSV Data Set Config, what happens if you leave Variable Names empty?

level: juniorimportance: must knowfreq 74%
basics
~20 s

JMeter 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.

open as a page

In JMeter, how do you write a call to a built-in function such as __UUID?

level: juniorimportance: must knowfreq 78%
basics
~10 s

JMeter 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}.

open as a page

In JMeter's Regular Expression Extractor, what does a Template value of $1$ refer to?

level: juniorimportance: must knowfreq 76%
basics
~20 s

Template $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.

open as a page

In Apache JMeter, how do you capture an order id from a JSON confirmation body for the next request?

level: juniorimportance: must knowfreq 74%
basics
~20 s

Add 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.

open as a page

In JMeter, what is the difference in scope between a variable and a property?

level: juniorimportance: must knowfreq 85%
basics
~10 s

A 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.

open as a page

In a k6 `constant-arrival-rate` scenario, what do the `rate`, `timeUnit` and `duration` keys each set?

level: juniorimportance: must knowfreq 74%
basics
~10 s

In 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.

open as a page

Which k6 scenario do the root vus and iterations options build, and what does duration do there?

level: juniorimportance: must knowfreq 68%
basics
~20 s

k6 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.

open as a page

In k6, how do the constant-vus and ramping-vus executors differ, and what options does each take?

level: juniorimportance: must knowfreq 82%
basics
~20 s

k6'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.

open as a page

In a k6 arrival-rate scenario, what do preAllocatedVUs and maxVUs control, and what happens when maxVUs is omitted?

level: juniorimportance: must knowfreq 74%
basics
~10 s

preAllocatedVUs 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.

open as a page

Which of k6's four metric types does each built-in such as vus, http_reqs or checks use?

level: juniorimportance: must knowfreq 66%
basics
~20 s

k6 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.

open as a page

Which command launches a Gatling simulation under Maven, Gradle, sbt and the JavaScript CLI, and how do the four names differ?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Maven 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.

open as a page

In Gatling, how do you assemble a browse-then-checkout scenario out of two reusable chain values?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Store 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.

open as a page

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?

level: juniorimportance: must knowfreq 70%
basics
~10 s

repeat(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.

open as a page

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?

level: juniorimportance: must knowfreq 68%
basics
~10 s

A 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.

open as a page

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?

level: juniorimportance: must knowfreq 45%
basics
~10 s

Three: @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.

open as a page

In REST Assured, how do you authenticate every request by default and opt one test out?

level: juniorimportance: must knowfreq 58%
basics
~10 s

Assign 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().

open as a page

In REST Assured, how do you carry a logged-in session id from one request to the next?

level: juniorimportance: must knowfreq 61%
basics
~20 s

Read 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.

open as a page

REST Assured has no auth().bearer() method - so how do you attach a bearer token to a request?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Use 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.

open as a page

What is the REST Assured library used for on the JVM, and how does its given/when/then request DSL work?

level: juniorimportance: must knowfreq 65%
basics
~20 s

REST 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).

open as a page

In REST Assured, how do you print the request and response only when a validation fails?

level: juniorimportance: must knowfreq 68%
basics
~20 s

REST 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.

open as a page

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?

level: juniorimportance: must knowfreq 45%
basics
~20 s

Declare 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.

open as a page

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?

level: middleimportance: must knowfreq 30%
basics
~20 s

Every 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.

open as a page

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?

level: middleimportance: must knowfreq 32%
basics
~20 s

Kotest 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.

open as a page

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?

level: middleimportance: must knowfreq 40%
basics
~20 s

Kotest 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.

open as a page

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?

level: middleimportance: must knowfreq 45%
basics
~20 s

Kotest 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.

open as a page

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?

level: middleimportance: must knowfreq 55%
basics
~20 s

It 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.

open as a page

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?

level: middleimportance: must knowfreq 45%
basics
~20 s

It 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.

open as a page

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?

level: middleimportance: must knowfreq 40%
basics
~20 s

anyConstructed<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.

open as a page

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?

level: middleimportance: must knowfreq 40%
basics
~20 s

No 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.

open as a page

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?

level: middleimportance: must knowfreq 45%
basics
~20 s

Pass 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.

open as a page

In Pact, Spring Cloud Contract and bi-directional contract testing, who authors the contract artefact first, and who must act when verification fails?

level: middleimportance: must knowfreq 68%
basics
~20 s

Pact 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.

open as a page

In Pact, what does an asynchronous message pact verify, and what does excluding the transport leave unproven?

level: middleimportance: must knowfreq 62%
basics
~20 s

An 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.

open as a page

What does the Pact Broker store that a shared folder of pact files cannot?

level: middleimportance: must knowfreq 64%
basics
~20 s

The 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.

open as a page

What does a Pact consumer test do at runtime, and when does it write the pact file?

level: middleimportance: must knowfreq 74%
basics
~20 s

A 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.

open as a page

How does a Pact provider verification run fetch pacts and replay each interaction?

level: middleimportance: must knowfreq 72%
basics
~20 s

A 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.

open as a page

In a Cucumber .feature file, which lines does the Gherkin parser treat as keywords, and what happens to a line that matches none?

level: juniorimportance: must knowfreq 80%
basics
~20 s

Gherkin 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.

open as a page

What does Cucumber's tag expression "@smoke and not @wip" select, and which lines can carry those tags?

level: juniorimportance: must knowfreq 82%
basics
~20 s

It 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.

open as a page

In Cucumber-JVM, what does the glue option point at, and what happens when it is wrong?

level: juniorimportance: must knowfreq 68%
basics
~20 s

The 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.

open as a page

In a Cucumber Scenario Outline, where does an <placeholder> from an Examples row get substituted?

level: juniorimportance: must knowfreq 76%
basics
~20 s

Cucumber 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.

open as a page

In Cucumber, how do you select a formatter and point it at an output file, and which built-in formats are machine-facing?

level: juniorimportance: must knowfreq 66%
basics
~20 s

Cucumber-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.

open as a page

In Testcontainers, what do GenericContainer's withExposedPorts, withEnv and withCommand actually do?

level: juniorimportance: must knowfreq 58%
basics
~20 s

They 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.

open as a page

In Testcontainers, what does PostgreSQLContainer give you that a plain GenericContainer does not?

level: juniorimportance: must knowfreq 66%
basics
~20 s

A 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.

open as a page

In Testcontainers, why must a test use getHost() and getMappedPort() instead of a fixed port?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Testcontainers 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.

open as a page

How does Testcontainers locate a Docker daemon, and what does a CI runner need to provide?

level: middleimportance: must knowfreq 62%
basics
~20 s

Testcontainers 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.

open as a page

In Testcontainers, why does PostgreSQLContainer reject an image named registry.corp/pg:16?

level: middleimportance: must knowfreq 45%
basics
~10 s

Module 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.

open as a page

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?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Assignment 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.

open as a page

In a TestRail-class case repository, a requirement-coverage panel reports a single percentage — what sits in the numerator and what forms the denominator?

level: juniorimportance: must knowfreq 60%
basics
~20 s

The 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.

open as a page

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?

level: juniorimportance: must knowfreq 72%
basics
~20 s

A 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.

open as a page

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?

level: juniorimportance: must knowfreq 68%
basics
~20 s

Two 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.

open as a page

In a TestRail-class case repository, what does filing a defect straight from a failed execution pre-fill into the new tracker item?

level: juniorimportance: must knowfreq 64%
basics
~20 s

Filing 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.

open as a page

In MockServer, how do you verify that a POST to /catalogue/v1/holds actually arrived?

level: juniorimportance: must knowfreq 68%
basics
~20 s

MockServer 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.

open as a page

In WireMock, what does the --no-request-journal flag switch off, and what then happens to verify()?

level: juniorimportance: must knowfreq 46%
basics
~20 s

WireMock'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.

open as a page

In WireMock, what does makeStubsPersistent(false) change about the stubs a re-recording produces?

level: juniorimportance: must knowfreq 58%
basics
~20 s

With 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.

open as a page

In WireMock, what do GET, POST and DELETE on /__admin/mappings each do?

level: juniorimportance: must knowfreq 70%
basics
~20 s

WireMock'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.

open as a page

What is a hosted mock service, and what does a team give up by adopting it?

level: juniorimportance: must knowfreq 62%
basics
~20 s

A 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.

open as a page

Who records the video of a hosted browser session, and what must your test do to get it?

level: juniorimportance: must knowfreq 68%
basics
~20 s

The 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.

open as a page

Does raising a test runner's worker count raise a hosted provider's session ceiling?

level: juniorimportance: must knowfreq 72%
basics
~20 s

No. 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.

open as a page

Why do a hosted browser provider's settings arrive as one colon-prefixed capability map?

level: juniorimportance: must knowfreq 68%
basics
~20 s

W3C 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.

open as a page

Which of your hostnames does a hosted browser provider's tunnel carry, and what happens to the rest?

level: juniorimportance: must knowfreq 66%
basics
~20 s

A 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.

open as a page

In Selenoid, what is created when a browser session starts and what happens to it at the end?

level: juniorimportance: must knowfreq 66%
basics
~20 s

Selenoid 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.

open as a page

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?

level: juniorimportance: must knowfreq 76%
basics
~20 s

Karate'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.

open as a page

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?

level: juniorimportance: must knowfreq 84%
basics
~20 s

Karate'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.

open as a page

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?

level: juniorimportance: must knowfreq 82%
basics
~20 s

The 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.

open as a page

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?

level: juniorimportance: must knowfreq 78%
basics
~20 s

Put 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.

open as a page

In a Karate feature file, what does the expected value `'#? _ > 0'` assert inside a `match`, and what is `_` bound to while that expression runs?

level: juniorimportance: must knowfreq 58%
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.

open as a page