Hi I am creating slot filling chatbot where I would like to ask as much open question as possible at the beginning to make my flow the most similar to the normal conversation.
How can I achieve two types of prompts one general to specify which parameter is missing and if user will not fill it in a correct way then i would like to suggest him answers by using suggestion chips? (Blue on the flow diagram above)
AFAIK, your requirements can only be implemented in webhook code; the Dialogflow configuration is not enough to set up this kind of dialog. A webhook is necessary - however, some resources discourage that altogether. Go and read The different types of Dialogflow (API.AI) slot filling tasks carefully.
If you decide to start using webhook for slot-filling (this sample webhook implementation is a good starting point), it will:
+----------+ +-------------+ +-------------+
| | ------> | | -----> | |
| User | | Dialogflow | | Webhook |
| | <------ | | <----- | |
+----------+ +-------------+ +-------------+
receive a request with the recognized intent and entities
ask follow-up questions (either asking for a missing entity or offering a suggestion if an unsupported value was provided)
Basically, this means that Dialogflow is now used only for natural language understanding (NLU) and the webhook becomes responsible for dialog management.
So far as I understand, dialogflow.com has no such provision to define multiple prompts within single intent so either way to do this is to use webhooks for slot-filling. I can see here, https://miningbusinessdata.com/different-types-api-ai-slot-filling-tasks/ that this is not a recommended way of solving your problem & this is because once you enter in webhook, you will have to write your own logic of NLP to handle user responses & understand the context of what user wants to say. So instead of having multiple prompts like what type of vehicle->plane->we don't have this (enter car/truck), you can directly say what type of vehicle (please enter any of this: car/truck) so you don't have to define multiple prompts here & your work will be done. Unless you have car/truck in user says of your intent, it will continue promoting same question.
Related
I have a scenario with following structure:
Scenario Outline: Sections displayed on login
Given Robert is at the home page
When Robert logs in as "<role>"
Then the "<section1>" should be displayed
And the "<section2>" should be displayed
Examples:
| email | section1 | section2 |
| Administrator | Administration | Profile |
| External | IGNORED | Profile |
As you can see, there is a parameter "IGNORED" in the second example.
In case I detect this keyword during runtime, I want the step, the keyword appeared in, to be skipped.
At the moment I use this:
#Then("the {string} should be displayed")
public void the_section_should_be_displayed(String sectionName) {
if(sectionName.contentEquals("IGNORED"))
return;
// rest of code
}
Here the step will be set as PASSED if the IGNORED keyword is there.
What I want instead, is that this single step is marked as SKIPPED and that the following steps are still executed and the full test scenario is afterwards marked as PASSED or FAILED depending on the status of the other steps.
So my question is:
Is there a way to manually set a Cucumber step to status SKIPPED without skipping the rest of the scenario?
I am aware that I could simply create two scenarios, one for each role. But I currently have no choice. I can not change anything within the feature file and need to solve this with code. So please try to answer the question if you can.
I appreciate any help!
Instead of adding logic to your step definition, consider making a separate scenario that skips this step. I'm assuming there is a reason that "section1" is not relevant to the role of "External"? It would be considered good practice to capture that in a different scenario with a different name. Remember that a goal of the feature files is to describe the intended behaviour of your system; using 2 different scenarios here allows you to specify what the difference in behaviour is for different roles.
For example, as follows:
Scenario Outline: Admin section is visible to Admin
Given Robert is at the home page
When Robert logs in as Administrator
Then the Administration section should be displayed
And the Profile section should be displayed
Scenario Outline: Relevant sections are visible to External
Given Robert is at the home page
When Robert logs in as External
Then the Profile section should be displayed
Alternatively, if you want to check that specific section are / are not displayed, you could do something like this, and use the step definition to check a sectio is / is not displayed based on the provided value:
Scenario Outline: Sections displayed on login
Given Robert is at the home page
When Robert logs in as "<role>"
Then the admin section "<admin>" be displayed
And the "<section2>" should be displayed
Examples:
| email | admin | section2 |
| Administrator | should | Profile |
| External | should not | Profile |
(My example might not be correct Gherkin, but should give you an idea)
I'm practicing event-storming, with sticky notes and stuffs.
But one thing is missing: command validation (rules to be satisfied for a command to be accepted / succeed).
How to make it visible in the whiteboard? (not just as comments sprinkled here and there). Event-storming only mentions "events" (yellow), "command" (blue), "aggregate" (pale yellow), etc. I don't see "command validation" as first-class citizen.
Any thoughts?
I would consider command validation as policies in event storming. Those are business rules that must be satisfied for a command to be accepted.
They will go on pink "policy" sticky note - https://eventnotes.io/pdf/cheatsheet-big-picture-exploration.pdf
I consider policies as:
Control how the action plays out
Business rules
Decisions
When an event occurs, you apply policy and decide what the next action is
Reactive logic
External decision
Time based
Trigger based
Reacts on events
Triggers commands
Often at domain boundary
I had this same trouble and worked through it like this....
First understand there are different types of validation. What is the type of validation you want to do?
Do you want to validate a model to ensure the order address is correctly formatted? This would only extend to "schematic" validation and could be done synchronously as part of your command, and would be what I would call Command Validation. I would make a note somewhere with the language as this will be taken through to build the contract.
Do you want to validate that "if there isn't enough stock to complete the order the order should fail"? It is not the commands responsibility to validate business logic, it is the aggregate; and I would call this Domain Validation. I use negative events to indicate some form of validation has taken place in the aggregate.
I hope this helps
Could any please suggest me some way we could use cucumber to repeat a test (e.g Login/Logout) multiple time, but changing only username/password for each time?
I could do for a single pair of username/password, but I'm looking for a way to re-use the test for multiple data set (The data set may be an array which store username/password, and the expected result which is true or false).
Thanks.
Scenario Outline allows you to run your Features based on the provided Examples in a tabular format, so to test login multiple time with different values you instruct to your step definition to run for every provided examples, In this we need to mention table column field in angle brackets in feature file.
Scenario Outline: Creating a new account
Given I am not authenticated
When I go to Login page
And I fill in "user_email" with "<email>"
And I fill in "user_password" with "<password>"
And I press "Sign up"
Then I should see "logged in as <email>"
Examples:
| email | password |
| testing#xyz.com | secretpass |
| testing2#xyz.com | fr33z3 |
For more references, Cucumber tutorials
I have started writing the following feature within an app designed to manage a cleaning business:
Feature: Creating a new cleaner
In order to allow Franchisees to allocate cleaners to jobs they need to be uploaded to the system
Background:
Given I am currently logged in to my account
And I have navigated to the "Cleaners" page
And I want to add a new cleaner to the database
Scenario: Add a new cleaner to the system
Given I have brought up the "Add Cleaner" form
Then I will need to complete the fields within the following form:
| first_name |
| last_name |
| email |
| date_of_birth |
| postcode |
| mobile |
| other_phone |
| address_1 |
| address_2 |
| work_radius |
| **days_available** |
| notes |
When I have entered valid data
Then I can save to the database
And I will have added a new cleaner to the system
In addition to welcoming comments on the way I have written the scenarios etc, my main problem is that I can't work out how to simulate selecting from a pre-populated field:
Populating the days_available should allow the franchisee to choose which days of the week, and which hours within those days, that a cleaner will be available for work. This obviously makes it possible to return queries which only show available cleaners for any given day/time of day.
Really hope someone can explain how this is done?
Just a quick comment on the structure of your feature file ... the 'Then' step in your feature should be asserting that something has or has not been done successfully.
Given I have logged into the site
When I add a new Cleaner to the site
Then I should see that the Cleaner has been added successfully
I would recommend using language that can be easily understood. Your scenario doesn't need to be instructions on how to use the site. Excessive navigational steps can make you lose track of the purpose of the scenario.
To answer your question regarding days_available accurately, would require some knowledge of how the site is structured and how the days_available are entered. Are you choosing from select lists, filling in form fields, etc? Also, since you are testing, you could consider setting the data from within your step (ie. hash, array) instead of passing all of the info in via a table.
Just some food for thought. Cheers.
Based on your updated post, I would suggest the following:
The step And I want to add a new cleaner to the database doesn't seem like an actionable step and could be removed. Same for the step When I have entered valid data. If you handle filling out the form in the previous step, you have already entered valid data.
If you need to multiple available days, I would consider making it its own step
And(/^the cleaner is available from (.*?) to (.*?) on (.*?)$/) do |start_time, end_time, day|
#fill in start time
#fill in end time
#select day
end
Background:
Given I am currently logged in to my account
And I have navigated to the "Cleaners" page
Scenario:
And I bring up the "Add Cleaners" form
And I complete the form with
| first name | Bob |
| last name | Smith |
...
And the cleaner is available from 0600 to 1800 on W
When I submit the Add Cleaners form
Then I should see the new cleaner has been successfully added
I've got to test a message-routing application, whose functionality is broadly as follows:
- message gets sent to app
- app examines message
- message gets forwarded somewhere, based on the content of the message
The vast majority of test cases are near-identical; generate a particular type of message, load it into the system, wait a few seconds, then check the required destination to ensure that the message was forwarded correctly.
Rather than generate 100s of near-identical test cases in Cucumber, is there a recommended way to generate the one test case, and have it repeatedly cycle through all the (message, required_destination) tuples? I'd prefer to have these tuples maintained into a YAML file rather than a database, for ease of maintenance, but either solution would be fine.
You should try Scenario Outline using Examples
Normal Scenario
Scenario: Login
Given I am on login page
When I enter username "Jonas" and password "secrect" and press login
Then I get redirected to "Jonas Home Page"
Scenario Outline
Scenario Outline: Login
Given I am on login page
When I enter username <username> and password <password> and press login
Then I get redirected to <redirect_page>
Examples:
| username | password | redirect_page |
| "Jonas" | "secret" | "Jonas Home Page" |
| "Anna" | "Data" | "Annas Home Page" |
Read More:
https://github.com/cucumber/cucumber/wiki/Scenario-Outlines
I dont have this kind of situation in cucumber, but I do use pipe separated files in specs for massive data testing, hope it will help:
You can find examples here in description of DamerauLevenshteinMod and here in read_test_file
I dont see why the same approach cannot be used for cucumber as well.