Skip to content

Instantly share code, notes, and snippets.

@Zayon
Last active June 6, 2019 15:11
Show Gist options
  • Save Zayon/e97c5382e581887daa530ecd259765c1 to your computer and use it in GitHub Desktop.
Save Zayon/e97c5382e581887daa530ecd259765c1 to your computer and use it in GitHub Desktop.
Behat results
fixtures-demo $ vendor/bin/behat --tags="@add-products"
@product @add-products
Feature:
In order to offer a large choice of products
As a product seller
I want to add products
Background:
Given the fixtures file "add-products.yaml" is loaded
Scenario: Add a product
Given I send a "GET" request to "/products/"
And the response status code should be 200
And the JSON node "total" should be equal to the number 5
When I send a "POST" request to "/products/" with body:
"""
{
"name": "Super cool drill",
"price": 249.99,
"category": {{ category_tools.id }}
}
"""
Then the response status code should be 200
And I send a "GET" request to "/products/"
And the JSON node "total" should be equal to the number 6
1 scenario (1 passed)
8 steps (8 passed)
0m0.37s (23.20Mb)
fixtures-demo $ vendor/bin/behat --tags="@add-products"
@product @add-products
Feature:
In order to offer a large choice of products
As a product seller
I want to add products
Background:
Given the fixtures file "add-products.yaml" is loaded
Scenario: Add a product
Given I send a "GET" request to "/products/"
And the response status code should be 200
And the JSON node "total" should be equal to the number 5
"""
{\n
"name": "Super cool drill",\n
"price": 249.99,\n
"category": 1\n
}
"""
When I send a "POST" request to "/products/" with body:
"""
{
"name": "Super cool drill",
"price": 249.99,
"category": {{ category_tools.id }}
}
"""
Then the response status code should be 200
Current response status code is 500, but 200 expected.
And I send a "GET" request to "/products/"
And the JSON node "total" should be equal to the number 6
--- Failed scenarios:
tests/functional/add-products.feature:10
1 scenario (1 failed)
9 steps (6 passed, 1 failed, 2 skipped)
0m0.45s (26.73Mb)
fixtures-demo $ vendor/bin/behat --tags="@add-products"
@product @add-products
Feature:
In order to offer a large choice of products
As a product seller
I want to add products
Background:
Given the fixtures file "add-products.yaml" is loaded
Scenario: Add a product
Given I send a "GET" request to "/products/"
And the response status code should be 200
And the JSON node "total" should be equal to the number 5
And I store the "id" property of "category_tools" as "category_tools_id"
When I send a "POST" request to "/products/" with body:
"""
{
"name": "Super cool drill",
"price": 249.99,
"category": {{ category_tools_id }}
}
"""
Then the response status code should be 200
And I send a "GET" request to "/products/"
And the JSON node "total" should be equal to the number 6
1 scenario (1 passed)
9 steps (9 passed)
0m0.39s (23.20Mb)
fixtures-demo $ vendor/bin/behat --tags="@list-products"
@product @list-products
Feature:
In order to select products
As a customer
I want to see the products available
Background:
Given the fixtures file "list-products.yaml" is loaded
Scenario: List all products
When I send a "GET" request to "/products/"
Then the response status code should be 200
And the response should be in JSON
And the JSON node "total" should be equal to the number 15
Scenario: List products of a given category
When I send a "GET" request to "/products/" with parameters:
| key | value |
| category | tools |
Then the response status code should be 200
And the response should be in JSON
And the JSON node "total" should be equal to the number 10
2 scenarios (2 passed)
10 steps (10 passed)
0m0.75s (23.52Mb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment