简体   繁体   English

测试结果为成功,尽管在测试过程中发现错误

[英]Tests result as successful, although errors are found during Tests

I have set up my test environment as described here with QunitJS + PhantomJS + GruntJS: http://jordankasper.com/blog/2013/04/automated-javascript-tests-using-grunt-phantomjs-and-qunit/ 我已经按照QunitJS + PhantomJS + GruntJS的说明设置了测试环境: http ://jordankasper.com/blog/2013/04/automated-javascript-tests-using-grunt-phantomjs-and-qunit/

Everything works fine, but I have the problem that, my Grunt Task finishes without errors, although errors are found. 一切正常,但是我遇到的问题是,尽管发现了错误,但我的Grunt任务没有错误地完成了。 This is crucial for my build process. 这对于我的构建过程至关重要。 Due to the Test results the build either fails or succeeds. 由于测试结果,构建失败或成功。 But in my case the build always succeeds. 但就我而言,构建总是成功的。 Any Ideas why grunt doesn't exit with failure when errors found? 有什么主意,为什么发现错误时咕gr咕exit咕with咕exit的叫声?

qunit Task of the grunt file: grunt文件的qunit任务:

module.exports = {

  services: {
    options: {
      urls: [
        'http://localhost:8000/tests/services.html'
      ],
      timeout: 20000,
      force: true
    }
  },

  gui: {
    options: {
      urls: [
        'http://localhost:8000/tests/gui.html'
      ],
      timeout: 20000,
      force: true
    }
  }

};

Output: 输出:

在此处输入图片说明

Please consider that I cant upload more info due to confidental issues. 请考虑由于存在自信问题,我无法上传更多信息。

You are asking 'why does Grunt continue and when the tests fail?' 您在问“为什么Grunt会继续,什么时候测试失败?” The answer is 'because you are asking it to'. 答案是“因为您要这样做”。

The force option controls whether the QUnit task fails if there are failing tests. 如果有失败的测试, force选项控制QUnit任务是否失败。 Setting it to true as you have done tells Grunt to continue even if there are failing tests. 完成后将其设置为true会告诉Grunt即使测试失败也要继续。 Try setting it to false , or removing it altogether as false is the default. 尝试将其设置为false ,或者将其完全删除,因为默认情况下为false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM