Download the PHP package friends-of-behat/test-context without Composer
On this page you can find all versions of the php package friends-of-behat/test-context. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download friends-of-behat/test-context
More information about friends-of-behat/test-context
Files in friends-of-behat/test-context
Package test-context
Short Description Provides reusable context that helps in testing Behat extensions.
License MIT
Informations about the package test-context
Test Context

Provides a reusable Behat context for testing Behat extensions. It lets you run Behat inside Behat - setting up temporary configurations, feature files, and contexts, then asserting on the results.
Installation
Configuration
Register the context in your test suite:
How It Works
Each scenario gets an isolated temporary directory that is created before and cleaned up after every scenario. When you use the setup steps, files are written into this directory.
When I run Behat executes a real Behat process in that directory, and the assertion steps check its exit code and output.
This means scenarios are fully independent — file changes from one scenario never leak into another.
Usage Examples
Testing a simple extension
Quick smoke tests with shorthand steps
Asserting on error output
Available Steps
Setup
| Step | Description |
|---|---|
Given a Behat configuration containing: |
Creates a temporary behat.yml (or behat.php for Behat 4) |
Given a feature file "path" containing: |
Creates a feature file at the given path |
Given a feature file containing: |
Creates a feature file with an auto-generated path |
Given a context file "path" containing: |
Creates a PHP context file at the given path |
Given a file "path" containing: |
Creates any file at the given path |
Given a feature file with passing scenario |
Generates a ready-made passing scenario with context |
Given a feature file with failing scenario |
Generates a ready-made failing scenario with context |
Given a feature file with scenario with missing step |
Generates a scenario with an undefined step |
Given a feature file with scenario with pending step |
Generates a scenario with a pending step |
Execution
| Step | Description |
|---|---|
When I run Behat |
Runs Behat in the temporary working directory |
Assertions
| Step | Description |
|---|---|
Then it should pass |
Asserts Behat exited with code 0 |
Then it should pass with "text" |
Asserts Behat passed and output contains text |
Then it should fail |
Asserts Behat exited with a non-zero code |
Then it should fail with "text" |
Asserts Behat failed and output contains text |
Then it should end with "text" |
Asserts output contains text (regardless of exit code) |
All with variants also accept multiline pystrings.
All versions of test-context with dependencies
behat/behat Version ^3.0 || ^4.0
symfony/filesystem Version ^5.4 || ^6.4 || ^7.0 || ^8.0
symfony/process Version ^5.4 || ^6.4 || ^7.0 || ^8.0