Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential enhancement - upgrade tests to use virtual alexa #2

Open
jkelvie opened this issue Nov 14, 2017 · 0 comments
Open

Potential enhancement - upgrade tests to use virtual alexa #2

jkelvie opened this issue Nov 14, 2017 · 0 comments

Comments

@jkelvie
Copy link

jkelvie commented Nov 14, 2017

Hi @acucciniello - I see that you are using our BSTAlexa testing framework here. That is awesome.

I wanted to let you know that we pulled this out of our core https://github.com/bespoken/bst repo and put it in it's own repo, here:
https://github.com/bespoken/virtual-alexa

We also made several enhancements to it - adding promises for returns, simplifying greatly setup and teardown, as well as adding a more user-friendly constructor object. Here is an example of it in action:
https://github.com/bespoken/GuessThePrice/blob/master/test/index-test.js

     it("Launches successfully", async function() {
    const bvd = require("virtual-alexa");
    const alexa = bvd.VirtualAlexa.Builder()
        .handler("index.handler") // Lambda function file and name
        .intentSchemaFile("./speechAssets/IntentSchema.json")
        .sampleUtterancesFile("./speechAssets/SampleUtterances.txt")
        .create();

    let reply = await alexa.launch();
    assert.include(reply.response.outputSpeech.ssml, "Welcome to guess the price");

    reply = await alexa.utter("two");
    assert.include(reply.response.outputSpeech.ssml, "what is your name");
    assert.include(reply.response.outputSpeech.ssml, "contestant one");

    reply = await alexa.utter("john");
    assert.include(reply.response.outputSpeech.ssml, "what is your name");
    assert.include(reply.response.outputSpeech.ssml, "Contestant 2");

    reply = await alexa.utter("juan");
    assert.include(reply.response.outputSpeech.ssml, "let's start the game");
    assert.include(reply.response.outputSpeech.ssml, "Guess the price");

    reply = await alexa.filter(function (request) {
        console.log("Request: " + JSON.stringify(request, null, 2));
    }).utter("200 dollars");
    assert.include(reply.response.outputSpeech.ssml, "the actual price was");
});

When you have a chance, please take a look - would love your feedback on it. And if you choose to use it, happy to help or answer any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants