【问题标题】:Add test dependency in Protractor & Jasmine test framework在 Protractor & Jasmine 测试框架中添加测试依赖
【发布时间】: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


    【解决方案1】:

    您可以使用以下任何一种:

    jasmine-bail-fast

    jasmine-fail-fast

    它会让你更快地失败测试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-10
      • 1970-01-01
      • 2016-10-11
      • 2011-10-21
      • 1970-01-01
      • 1970-01-01
      • 2016-12-27
      • 1970-01-01
      相关资源
      最近更新 更多