botium-box

How to use variables with an utterance file in botium


I have a botium/dialogflow project that my developer has created using node and not botiumbox. I want to be able to call multiple neighborhoods in multiple ways using variables. For example, I know using a variable in an adaptive card should look something like this:

Show me a neighborhood

#me
Show me a neighborhood in $neighborhood

#bot
In $neighborhood, there are [0-9]+ active listings.

I was previously using an utterance file with different types of utterances such as:

NEIGHBORHOOD_SNAPSHOTS_UTT    
Show me a location in Lawrenceville
Show me a market snapshot in Lawrenceville
What are the market stats in Lawrenceville
Find market snapshot in Lawrenceville

And my adaptive card looked something like this:

Show me a neighborhood

#me
NEIGHBORHOOD_SNAPSHOTS_UTT

#bot
In Lawrenceville, there are [0-9]+ active listings.

In the botium wiki somewhere I saw something similar to this, so I saved it as a file named location.txt in the same folder as my conversations and utterance files

       |$neighborhood                    |
 Case1 | Lawrenceville                   |
 Case2 | Midway                          |
 Case3 | Paintsville                     |
 Case4 | River Point                     |
 Case5 | The Fountains                   |
 Case6 | Castlewood                      |
 Case7 | Middlebury                      |
 Case8 | Happy Valley                    |
 Case9 | 20th / Breakwood                |
 Case10| Courtney Ct/Knight Ave          |

Now I want to tie them together so that I can query multiple neighborhoods in multiple ways, such as

 Show me a neighborhood

 #me  
 NEIGHBORHOOD_SNAPSHOTS_UTT.utterances.txt

 #bot
 In $neighborhood, there are [0-9]+ active listings.

Where I take my utterance file and change it from Lawrenceville to:

Show me a location in $neighborhood
Show me a market snapshot in $neighborhood
What are the market stats in $neighborhood
Find market snapshot in $neighborhood

But my project was not seeming to find the location.txt variable file. How can I make utterances, a variable file, and these adaptive cards work together in my project (not botium box)?


Solution

  • Basically, the test case you are trying to create is fine, and you made a lot of things right, but there are some things missing as well.

    1. Scripting Memory files are to be named location.scriptingmemory.txt (see Botium Wiki)

    2. First line of the utterances file is the name it is referenced from convo files (one of your examples is correct, the other is not).

    3. When referencing utterances in convo files, don't use any file extension (again one time right, one time wrong).

    #me  
    NEIGHBORHOOD_SNAPSHOTS_UTT
    
    1. You have to enabled the scripting memory in Botium it is disabled by default - see Botium Wiki
    2. And finally, you want Botium to run the same convo multiple times with changed variables, you have to tell this as well (see Botium Wiki)

    I prepared a repl.it with a demo.