Test Flashcards
9 cards from real API practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 9 Test flashcards as text
Which variable is provided by default for environment variables in Jenkins Pipeline?
Answer: env
In Jenkins Pipeline scripts, the `env` global variable is automatically provided and serves as a map-like object to access and manipulate environment variables. You can read existing environment variables (e.g., `env.BUILD_NUMBER`) or set new ones (e.g., `env.MY_VAR = 'value'`) using this variable within your pipeline stages, making it essential for managing build environments.
For the json-schema-validator module, which library does REST Assured use?
Answer: fge library
REST Assured's `json-schema-validator` module leverages the `fge` JSON Schema Validator library (specifically, `com.github.fge.jsonschema`). This library provides the underlying functionality for validating JSON responses against a defined JSON schema. It ensures that the structure, data types, and content of the API's output conform to the expected contract, enhancing API reliability.
Which Postman variables are available across all requests in a collection and are not affected by environment?
Answer: Collection variables
Collection variables in Postman are specifically designed to be accessible by all requests within a particular collection. Unlike environment variables, which can change based on the selected environment, collection variables remain constant across all environments for that collection. This makes them ideal for values common to the entire collection, such as base URLs or authentication tokens that don't vary by environment.
Which Postman console offers diagnostic data during development?
Answer: DevTools console
The Postman DevTools console, similar to browser developer tools, provides detailed diagnostic information during API development and testing. It allows users to inspect network requests, view console logs, examine variable values, and debug scripts. This offers crucial insights into the execution flow and helps identify potential issues within requests or scripts.
Which data provider function in PHPUnit allows a test method to accept any number of arguments?
Answer: additionProvider
In PHPUnit, a data provider method is used to supply multiple sets of arguments to a single test method, allowing it to be executed with various inputs. The `additionProvider` (or any method named `*Provider`) is a convention for such a data provider function. It returns an array of arrays, where each inner array represents a set of arguments for one execution of the test method, enabling robust testing with diverse data.
What is the REST guaranteed default port?
Answer: 8080
While REST itself is an architectural style and doesn't mandate a specific port, the common convention for many web servers and application servers that host RESTful APIs, especially during development or for non-standard HTTP/HTTPS, is port 8080. This port is frequently used for HTTP traffic when port 80 (standard HTTP) is unavailable or reserved, making it a de facto default for many REST implementations.
Which activities should not be included in end-to-end testing design as build conditions?
Answer: none of the above
End-to-end testing aims to simulate real user scenarios by testing an application's entire workflow from start to finish. This includes considering various conditions like timing, data, and sequence, as these factors directly impact how a user interacts with the system. Therefore, all the listed activities (timing and data conditions, building a set of conditions for each user function, sequence conditions) are crucial for a comprehensive end-to-end testing design, meaning none of them should be excluded.
What is Pytest's mechanism for executing code before each test method?
Answer: Pytest fixtures
Pytest fixtures are functions that run before (and optionally after) test functions, modules, or sessions. They are used to set up a stable and known environment for tests, such as creating temporary files, setting up database connections, or providing test data. This mechanism ensures that each test starts with the required preconditions, promoting reusability and isolation.
Which Postman variables enable data access across collections, requests, test scripts, and environments?
Answer: Global variables
Global variables in Postman have the broadest scope, meaning they can be accessed by any request, collection, or environment within your Postman workspace. This makes them ideal for storing data that needs to be shared across multiple tests or workflows, such as authentication tokens or base URLs that might change infrequently. Their wide accessibility ensures data consistency across your testing efforts.