0
我使用jasmine和量角器編寫了一些測試,使用require('child_process')執行.exe文件,然後@aftereach我將重新啓動瀏覽器。 問題是.exe文件在第一個規範中只執行一次。 這裏是在beforeEach(代碼)執行.exe文件使用節點在量角器中只運行一次
beforeEach((done) => {
console.log("before each is called");
var exec = require('child_process').execFile;
browser.get('URL');
console.log("fun() start");
var child = exec('Test.exe', function(err, data) {
if (err) {
console.log(err);
}
console.log('executed');
done();
process.on('exit', function() {
child.kill();
console.log("process is killed");
});
});
然後我寫了2種規格和在aftereach我重新啓動瀏覽器
afterEach(function() {
console.log("close the browser");
browser.restart();
});
我想你的孩子solution.The進程已退出,但它只once.In它並沒有得到執行 – user1115684
第二規格這時我們就需要對你的測試的更多信息運行。我會添加一個「describe」,「beforeEach」和「it」塊的小片段。 – cnishina