Jasmine 失败的测试自动化
Jasmine failed tests automation
当 jasmine 上的测试失败时,我可以使用任何自动化来为特定的失败测试准备相同的环境吗?我使用 karma 作为规范 运行ner。
例如:
describe("this plugin", function(){
beforeEach(function(){
$("body").append("<input type='text' id='myplugintester'>");
this.plugin = $("#myplugintester").plugin({
cond1: true,
cond2: new Date(),
condetc: null
});
}
afterEach(function(){
$("#myplugintester").data("plugin").destroy();
$("#myplugintester").remove();
}
it("should show the correct value", function(){
expect(this.plugin.value).toEqual("somevalue");
});
it("should display 'disabled' when cond3 is not null", function(){
this.plugin.cond3 = "blabla";
expect(this.plugin.value).toEqual("somevalue");
});
});
当第二种情况失败时,我必须将其写入测试页面以调试代码出了什么问题。
var expect = function(){
// filler code
};
$("body").append("<input type='text' id='myplugintester'>");
this.plugin = $("#myplugintester").plugin({
cond1: true,
cond2: new Date(),
condetc: null
});
this.plugin.cond3 = "blabla";
console.log(this.plugin.value);
$("#myplugintester").data("plugin").destroy();
$("#myplugintester").remove();
是否有节点包自动执行此操作?或者其他开发人员在这种情况下如何反应?
注:因为速度问题我从grunt-jasmine
换成了grunt-karma
。 grunt-jasmine
允许我在浏览器上 运行 单个测试用例,我可以使用 Chrome 开发人员工具进行调试。我找了几位 html 的记者寻找业力,但他们只在输出 HTML 上陈述结果。他们没有 运行我可以中断和调试的规范。
最后,我写了一个业力插件来填补这个空白。如果有人需要:
当 jasmine 上的测试失败时,我可以使用任何自动化来为特定的失败测试准备相同的环境吗?我使用 karma 作为规范 运行ner。
例如:
describe("this plugin", function(){
beforeEach(function(){
$("body").append("<input type='text' id='myplugintester'>");
this.plugin = $("#myplugintester").plugin({
cond1: true,
cond2: new Date(),
condetc: null
});
}
afterEach(function(){
$("#myplugintester").data("plugin").destroy();
$("#myplugintester").remove();
}
it("should show the correct value", function(){
expect(this.plugin.value).toEqual("somevalue");
});
it("should display 'disabled' when cond3 is not null", function(){
this.plugin.cond3 = "blabla";
expect(this.plugin.value).toEqual("somevalue");
});
});
当第二种情况失败时,我必须将其写入测试页面以调试代码出了什么问题。
var expect = function(){
// filler code
};
$("body").append("<input type='text' id='myplugintester'>");
this.plugin = $("#myplugintester").plugin({
cond1: true,
cond2: new Date(),
condetc: null
});
this.plugin.cond3 = "blabla";
console.log(this.plugin.value);
$("#myplugintester").data("plugin").destroy();
$("#myplugintester").remove();
是否有节点包自动执行此操作?或者其他开发人员在这种情况下如何反应?
注:因为速度问题我从grunt-jasmine
换成了grunt-karma
。 grunt-jasmine
允许我在浏览器上 运行 单个测试用例,我可以使用 Chrome 开发人员工具进行调试。我找了几位 html 的记者寻找业力,但他们只在输出 HTML 上陈述结果。他们没有 运行我可以中断和调试的规范。
最后,我写了一个业力插件来填补这个空白。如果有人需要: