如何使用extJS应用程序运行InternJS测试

时间:2016-08-04 14:50:41

标签: selenium extjs intern

我在extJS开发了一个应用程序,我正在探索 InternJS 来开发自动化测试。但是我不能进行简单的测试,我想错过了一些步骤,因为我有这个错误:

Error: Missing required argument "config"
  at PreExecutor.getConfig  <workspace/intern-tutorial-completed-tutorial-3.0.0/node_modules/intern/lib/executors/PreExecutor.js:145:11>
  at getConfig  <workspace/intern-tutorial-completed-tutorial-3.0.0/node_modules/intern/lib/executors/PreExecutor.js:379:17>
  at <workspace/intern-tutorial-completed-tutorial-3.0.0/node_modules/intern/browser_modules/dojo/Promise.js:156:41>
  at run  <workspace/intern-tutorial-completed-tutorial-3.0.0/node_modules/intern/browser_modules/dojo/Promise.js:51:33>
  at CallbackQueue.drain  <workspace/intern-tutorial-completed-tutorial-3.0.0/node_modules/intern/browser_modules/dojo/CallbackQueue.js:39:35>
  at MutationObserver.<anonymous>  <workspace/intern-tutorial-completed-tutorial-3.0.0/node_modules/intern/browser_modules/dojo/nextTick.js:52:27>

我的文件夹结构是这样的

   - app
   - bin
      chromedriver.exe
      phantomjs.exe
      selenium-server-standalone-2.53.1.jar
   - tests
      - functional
         index.js
      - unit
         hello.js
      Intern.js
   index.html
   package.json

我使用此命令启动selenium

java -jar bin/selenium-server-standalone-2.53.1.jar

我配置像

这样的 intern.js 文件
define({
    capabilities: {
        'selenium-version': '2.53.1'
    },
    environments: [
        {
            browserName: 'chrome' 
            chromeOptions: {
                args: [ 'load-and-launch-app=../app/hello.js' ]
            }
        },
        {
            browserName: 'phantomjs'
        }
    ],
    maxConcurrency: 2,
    tunnel: 'NullTunnel',
    loaderOptions: {
        packages: [ { name: 'app', location: '../app' } ]
    },
    loaders: {
        'host-node': 'requirejs',
        'host-browser': 'node_modules/requirejs/require.js'
    }
    suites: [ 'tests/unit/hello' ],
    functionalSuites: [ 'tests/functional/index' ],
    excludeInstrumentation: /^(?:tests|node_modules)\//
});

1 个答案:

答案 0 :(得分:0)

当您运行Intern时,您需要告诉它您的配置在哪里。假设您正在运行WebDriver测试(因为您正在启动Selenium),您可以从包基目录启动Intern,如:

$ ./node_modules/.bin/intern-runner config=tests/Intern.js