CasperJS 测试器模块输出到 csv 而不是命令行

CasperJS tester module output to csv instead of command line

使用 CasperJS 测试模块,有没有办法将断言输出输出到 CSV 而不是命令行?

当然,您可以编写自己的断言序列化程序。您可以使用 events "success", "skipped" and "failed". Then you can append it directly to your CSV file using PhantomJS' fs module (fs.write()).

收集信息
var fs = require('fs');
casper.test.on("success", function(result){
    fs.write("file", "success;"+result.message+"\n", "a");
});
casper.test.on("skipped", function(result){
    fs.write("file", "skipped;"+result.message+"\n", "a");
});
casper.test.on("fail", function(result){
    fs.write("file", "fail;"+result.message+"\n", "a");
});