BerryCrush
What is BerryCrush?
BerryCrush is a behavior-driven development (BDD) testing framework that generates API test code directly from your OpenAPI specification. Write tests in a human-readable .scenario format and let BerryCrush handle the rest.
scenario: Create and retrieve a pet
given:
call ^createPet
body:
name: "Berry"
status: "available"
when:
call ^getPet
path:
petId: ${response.body.id}
then:
status: 200
body:
name: "Berry"
Key Features
📋 OpenAPI Integration
Automatically discovers endpoints, parameters, and schemas from your OpenAPI spec
📖 Readable Syntax
Write tests in natural language that both developers and stakeholders can understand
🔄 Reusable Fragments
Create reusable test components to eliminate duplication and improve maintainability
🛠️ IDE Support
Full IDE integration with syntax highlighting, completion, and navigation
Documentation
📚 Library Documentation
Core library reference, scenario syntax, and integration guides
💻 VS Code Extension
Install and configure the VS Code extension for BerryCrush
🧠 IntelliJ Plugin
IDE support for IntelliJ IDEA, WebStorm, and other JetBrains IDEs
Quick Start
1. Add the dependency
Gradle (Kotlin DSL)
testImplementation("org.berrycrush:berrycrush-junit:1.0.0")
Maven
<dependency>
<groupId>org.berrycrush</groupId>
<artifactId>berrycrush-junit</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
2. Create a test suite
@Suite
@IncludeEngines("berrycrush")
@BerryCrushScenarios(locations = "scenarios/*.scenario")
@BerryCrushSpec("petstore.yaml")
@BerryCrushConfiguration(bindings = PetstoreBindings.class)
public class PetstoreScenarioTest {
}
public class PetstoreBindings implements BerryCrushBindings {
@Override
public Map<String, Object> getBindings() {
return Map.of(
BerryCrushBindings.DEFAULT_BINDING_NAME, new OpenApiSpecValue("petstore.yaml", "http://localhost:8080")
);
}
}
3. Write your first scenario
# src/test/resources/scenarios/pets.scenario
scenario: List all pets
when:
call ^listPets
then:
status: 200
4. Run your tests
Gradle
./gradlew test
Maven
mvn test