Botium-需要帮助来配置Amazon Alexa的规范文件

时间:2019-09-06 09:56:30

标签: javascript bots chatbot

我应该做些什么修改才能对Alexa运行相同

我需要通过单个规格文件运行convo文件,就像botium-core项目中给出的示例一样,因为我发现很难为Alexa配置规格文件,而Botium-core中没有给出示例

针对Amazon Alexa的botium规格设置,例如botium core的fillScriptingMemoryFromFile.spec.js

Convos文件夹
•包含2个文件 1.product.xlsx-product1维也纳炸肉排 2. buy.convo

Examplefile.spec

Note - I want the configuration for Amazon.In botium core its not give for Alexa

const path = require('path')
const assert = require('chai').assert
const BotDriver = require('../../../').BotDriver
const Capabilities = require('../../../').Capabilities

const echoConnector = ({ queueBotSays }) => {
  return {
    UserSays (msg) {
      const botMsg = { sender: 'bot', sourceData: msg.sourceData, messageText: `You said: ${msg.messageText}` }
      queueBotSays(botMsg)
    }
  }

describe('scripting.scriptingmemory.memoryenabled.originalkept', function () {
  beforeEach(async function () {
    const myCaps = {
      [Capabilities.PROJECTNAME]: 'scripting.scriptingmemory', // "my project name here i've given" . Is this correct ??
      [Capabilities.CONTAINERMODE]: echoConnector, // "alexa-smapi",
      [Capabilities.SCRIPTING_XLSX_SHEETNAMES_SCRIPTING_MEMORY]: 'ScriptingMemory', // What should I give here ??
      [Capabilities.SCRIPTING_XLSX_SHEETNAMES]: 'Convos', // What should I give here ??
      [Capabilities.SCRIPTING_ENABLE_MEMORY]: true,
      [Capabilities.SCRIPTING_MEMORYEXPANSION_KEEP_ORIG]: true

    }
    const driver = new BotDriver(myCaps)
    this.compiler = driver.BuildCompiler()
    this.container = await driver.Build()
  })
  afterEach(async function () {
    this.container && await this.container.Clean()
  })

  it('Original convo kept', async function () {
    this.compiler.ReadScriptsFromDirectory(path.resolve(__dirname, 'convosSimple')) // This is the folder in which i have convo file
    this.compiler.ExpandScriptingMemoryToConvos()
    assert.equal(this.compiler.convos.length, 2) // why 2 ???
  })
})

最后,我们使用mocha运行“规范文件名”来运行规范。
我需要帮助进行配置,以便可以在package.json的“脚本标签”下为每种情况创建单独的测试运行。因此,当我有10个意图时,我可以将每个分类归类为唯一的规格名称,并使用“ mocha规格名称”

1 个答案:

答案 0 :(得分:0)

要将Botium连接到Alexa SMAPI,可以在connector repository中找到设置说明和使用的功能

SCRIPTING_XLSX -... 功能是Botium如何读取excel文件的说明-Botium Wiki

中的更多信息

对于您想做的事情,我建议您看一下botium-bindings,它是Botium和茉莉,摩卡,杰斯特等测试跑步者之间的“胶水”。甚至还有splitting convos in multiple folders的示例:

您可以拥有一个文件spec / scenario1.spec.js

const BotiumBindings = require('botium-bindings')
const bb = new BotiumBindings({ convodirs: [ './spec/scenario1' ] })
BotiumBindings.helper.jest().setupJestTestSuite({ bb })

还有另一个spec / scenario2.spec.js

const BotiumBindings = require('botium-bindings')
const bb = new BotiumBindings({ convodirs: [ './spec/scenario2' ] })
BotiumBindings.helper.jest().setupJestTestSuite({ bb })