Jasmine: How to get name of current test(Jasmine:如何获取当前测试的名称)
问题描述
有没有办法获取当前正在运行的测试的名称?
Is there a way of getting the name of the currently running test?
一些(高度简化的)代码可能有助于解释.我想避免 "test1"/"test2"
在对 performTest
的调用中重复:
Some (heavily simplified) code may help explain. I want to avoid the duplication of "test1" / "test2"
in the calls to performTest
:
describe("some bogus tests", function () {
function performTest(uniqueName, speed) {
var result = functionUnderTest(uniqueName, speed);
expect(result).toBeTruthy();
}
it("test1", function () {
performTest("test1", "fast");
});
it("test2", function () {
performTest("test2", "slow");
});
});
<小时>
更新我看到我需要的信息在:
UPDATE I see the information I need is in:
jasmine.currentEnv_.currentSpec.description
或者可能更好:
jasmine.getEnv().currentSpec.description
推荐答案
jasmine.getEnv().currentSpec.description
这篇关于Jasmine:如何获取当前测试的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Jasmine:如何获取当前测试的名称


基础教程推荐
- npm start 错误与 create-react-app 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01