在我的量角器测试脚本中,我使用通常的表示法:
describe("mytest") {
...
it(" should do this") {
...
it(" should do that") {
我希望能够在运行它时看到每个测试以及每个测试的哪个部分正在运行。我可以使用任何选项将测试描述输出到控制台吗?
答案 0 :(得分:14)
有记者应该做你想要的。请查看https://www.npmjs.com/package/jasmine-spec-reporter和https://github.com/bcaudan/jasmine-spec-reporter/tree/master/examples/protractor
答案 1 :(得分:13)
您可以使用--verbose选项打印有关测试的更多信息,但它不会告诉您当前正在运行哪个测试。
如果您需要该功能,我建议您创建一个问题。 https://github.com/angular/protractor/issues/new
$ ./node_modules/protractor/bin/protractor protractor-config.js --verbose
------------------------------------
PID: 7985 (capability: chrome #1)
------------------------------------
Using the selenium server at http://localhost:4444/wd/hub
angularjs homepage
should greet the named user
todo list
should list todos
should add a todo
Finished in 5.915 seconds
3 tests, 5 assertions, 0 failures
答案 2 :(得分:0)
由于量角器在节点中运行,您可以像在javascript中一样使用console.log
,为了获得更多控制台乐趣,请参阅节点docs
我喜欢在功能之后放置任何日志,以便我知道它已经完成,因此将它包装在.then()
函数内似乎最适合我
示例:
element(elementToFind).click().then(function(){
console.log("clicked element");
continue();
});
答案 3 :(得分:0)
如果您需要知道当前正在使用的规范的名称,您可以使用:UserProfile
{
"Owner": "Rich guy!",
"Car": "Cool car"
}
并记录下来
答案 4 :(得分:0)
console.log('\nTest spec: ' + __filename + '\n');
记录测试,但不知道如何记录正在执行的