使用量角器我正在测试我的网络应用程序。对于一个故事,我需要向控制台写一些短信,以便以后查看。目前正在这样做
expect(element.isPresent()).toBe(true);
console.log('Create button is present');
以后运行套装时,使用命令
protractor conf.js > testLog.txt
在testLog.txt文件中的我可以看到我的控制台语句。有没有办法避免额外调用console.log?因此,无论何时调用expect,我都可以将一些文本消息传递给控制台中的输出。
答案 0 :(得分:0)
我想你可能会在这里重新发明轮子。用例非常适合 Behavior Driven Development 模式 - 基本上你会用人类语言描述你的测试(包括通过“then”的期望):
Feature: Running Cucumber with Protractor
As a user of Protractor
I should be able to use Cucumber
to run my E2E tests
Scenario: Wrapping WebDriver
Given I go on "index.html"
Then the title should equal "My AngularJS App"
了解如何将cucumber.js
BDD框架与量角器一起使用: