Forum Discussion

Bruna's avatar
Bruna
New Member
4 years ago

Multiple when Then In Same Cucumber Scenario

Hello, 

 

I try write feature with cucumber to test order of chatbot conversation

 

First I write feature this way:

 

Feature: Try Cancel Given Correct CPF, Correct order number and diferent phone as the order
As a customer
I want cancel my order using chatbot

Scenario: Create Order In Maestro
Given order to create

Feature: Try Cancel Given Correct CPF, Correct order number and diferent phone as the order
As a customer
I want cancel my order using chatbot

Scenario: Create Order In Maestro
Given order to create
"""
"""
When create order in maestro
Then find this order in Maestro
Then get order information

Scenario: Customer give correct intent of cancelation in chatbot
Given chatbot jupiter has no open conversation context
And WhatsApp number is different from the order
And Customer write "Quero cancelar essa compra" in jupiter chatbot
When chatbot answer
Then chatbot receive message contains "Pra seguir com a sua solicitação de *cancelamento e reembolso*, vou precisar do seu *CPF*"

Scenario: Customer give correct cpf when chatbot ask
Given Customer write "23951670029" in jupiter chatbot
When chatbot answer
Then chatbot receive message contains "Certo! Olha o que eu vi 👀 sobre o seu último pedido:"

In the second and third scenario I need the order number that was created in scenario 1 but I no longer have this information because the context has been cleared

I need to know if write in this form (with multiple then when pairs in the same scenario) is correct and agrees with cucumber patterns:

Feature: Try Cancel Given Correct CPF, Correct order number and diferent phone as the order
As a customer
I want cancel my order using chatbot

Scenario: Create Order In Maestro
Given order to create
"""

"""
And chatbot jupiter has no open conversation context
And WhatsApp number is different from the order

When create order in maestro
Then find this order in Maestro
Then get order information

When Customer write "Quero cancelar essa compra" in jupiter chatbot
And chatbot answer
Then chatbot receive message contains "Pra seguir com a sua solicitação de *cancelamento e reembolso*, vou precisar do seu *CPF*"

When Customer write "23951670029" in jupiter chatbot
And chatbot answer
Then chatbot receive message contains "Certo! Olha o que eu vi 👀 sobre o seu último pedido:"

Thank you

No RepliesBe the first to reply