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

问题描述:

我有一个应用程序在extJS中开发,我正在探索InternJS开发自动化测试。但我不能运行一个简单的测试,我觉得缺少一些步骤,因为我有这样的错误:如何使用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 

我使用这个命令来启动硒

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)\// 
}); 

当你运行实习生时,你需要告诉它你的配置在哪里。假设您正在运行WebDriver测试(因为您开始使用Selenium),您可以从您的软件包基目录开始Intern:

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