Loop of test suites in a CasperJS test file results in random failures in the shell

让人想犯罪 __ 提交于 2019-12-04 17:04:59

You should use start and run only once in your test case and never outside of casper.test.begin. You don't need the main function as a step for then. Also, you can further condense your script.

  lines.forEach(function(line){
    var tab = line.split(";");
    casper.test.begin("test : "+tab[0], 1, function suite(test){
      casper.start(tab[0]).then(function (){
        this.echo(this.currentHTTPStatus);
        test.assertTitle(tab[1]);
      }).run(function(){
        test.done();
      });
    });
  });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!