2014-03-03 39 views
0

我的测试成功运行后,我一直收到报告XML文件的错误no such file or directory。这似乎是在寻找错误的目录:NightwatchJS - 没有用于报告XML文件的文件或目录

no such file or directory 'E:\source\test\nightwatch\reports\E:\source\test\nightwatch\tests\file1.xml' 

我打得周围与settings.json,但无济于事。任何想法如何让它成功创建报告?

NightwatchJS版本: 0.2.7

文件夹结构

/source 
- /test 
    - /nightwatch 
    - nightwatch.js 
    - settings.json 
    - /reports 
    - /screenshots 
    - /tests 
     - file1.js 
     - file2.js 
     - file3.js 
- /node_modules 
    - /nightwatch 
    - [nightwatch files] 
- app.server.js 
- [other files for my app] 

nightwatch.js

require('nightwatch/bin/runner.js'); 

settings.json

{ 
    "src_folders" : ["tests"], 
    "output_folder" : "reports", 
    "custom_commands_path" : "", 

    "selenium" : { 
    "start_process" : true, 
    "server_path" : "C:/Program Files/Selenium/selenium-server-standalone-2.39.0.jar", 
    "log_path" : "reports", 
    "host" : "127.0.0.1", 
    "port" : 4444 
    }, 

    "test_settings" : { 
    "default" : { 
     "launch_url" : "http://localhost", 
     "port" : 4444, 
     "silent": true, 
     "firefox_profile": false, 
     "screenshots" : { 
     "enabled" : true, 
     "path" : "screenshots" 
     }, 
     "desiredCapabilities": { 
     "browserName": "chrome", 
     "javascriptEnabled": true, 
     "acceptSslCerts": true 
     } 
    } 
    } 
} 

样本输出

E:\source\test\nightwatch>node nightwatch.js -t tests/file1.js 
Starting selenium server... started - PID: 7472 
Running tests 

[ E:\source\test\nightwatch\tests\file1 module ] 

Running: Test File1 
✔ [some assertions here...] 
OK. 6 assertions passed. 

fs.js:427 
    return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); 
       ^
Error: ENOENT, no such file or directory 'E:\source\test\nightwatch\reports\E:\source\test\nightwatch\tests\file1.xml' 
    at Object.fs.openSync (fs.js:427:18) 
    at Object.fs.writeFileSync (fs.js:966:15) 
    at E:\source\node_modules\nightwatch\runner\reporters\junit.js:36:10 
    at fs.js:266:14 
    at Object.oncomplete (fs.js:107:15) 

回答

0

您正在运行这对节省在Windows上的报告文件中的错误过时的nightwatch版本。最新版本是0.3.7。 要更新到最新版本,你可以运行:

npm update nightwatch 
+0

是它没关系从GitHub和禁止复制刚刚下载粘贴到我的'node_modules/nightwatch'文件夹?因为做'npm update nightwatch'不会做任何事情。 – Obay

+0

没关系,我在package.json里加了''nightwatch':'0.3.7'' – Obay

0

您可以尝试更新您的src和输出设置相对于亚军:

"src_folders": ["./tests"], 
"output_folder": "./reports", 
相关问题