2014-03-06 36 views
14

在我的量角器的测试脚本,我用的是通常的符号:如何查看当前正在执行的Protractor测试?

describe("mytest") { 
    ... 
    it(" should do this") { 
    ... 
    it(" should do that") { 

我希望能够看到什么样的测试和哪一部分的每一个当前正在运行,当我运行它们。有没有我可以用来输出测试描述到控制台的选项?

回答

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 
+12

它也可以用它设置成量角器-config.js:'jasmineNodeOpts :{isVerbose:true}';) – glepretre

0

因为量角器在节点上运行,你可以使用console.log,你通常会在JavaScript中,更多的控制台乐趣看到节点docs

我喜欢把所有日志功能后,让我知道它已经完成的,所以它包装一个.then()函数中似乎最适合我

例如:

element(elementToFind).click().then(function(){ 
    console.log("clicked element"); 
    continue(); 
}); 
+1

谢谢。我知道我可以使用console.log,但我需要动态获取测试名称,否则我将不得不为每个测试手动添加它。 –

0

如果您需要了解规范的名称目前rinning你可以使用:jasmine.getEnv().currentSpec.description 和记录它

0
 console.log('\nTest spec: ' + __filename + '\n'); 

登录测试,但不知道如何记录执行

相关问题