【发布时间】:2015-11-03 15:22:03
【问题描述】:
我查找了控制测试流程,但找不到直接的方法。仍然想知道是否有人找到了另一种方法来管理以下情况。
如何编写依赖于先前测试用例成功的测试用例?考虑下面的例子:
describe('Test scenario started', function() {
BeforeEach(function() {
//Doing the login here and executing it once
});
it('TC001 (independent)', function() {
// Perform steps and validate
// Click a link for newpage and verify it's loaded
});
describe('Navigate to next page', function() {
it('TC002 (Dependent on success of TC001)', function() {
// Perform steps and validate
// Click a link for nav to page #3 and verify it's loaded
});
describe('Navigate to Page #3', function() {
it('TC003 (Dependent on success of TC002)', function() {
// Page #3 is available, let's perform the tasks now
});
})
});
});
如果父测试用例失败,我想跳过依赖的测试,从而避免尝试执行它们的不必要延迟。我可以将所有功能添加到一个测试用例中,但我们更喜欢在较小的用例中分解。
谁有优雅的方法来处理这个?
【问题讨论】:
标签: webdriver jasmine protractor