在 Protractor & Jasmine 测试框架中添加测试依赖

Add test dependency in Protractor & Jasmine test framework

我查找了控制测试流程的方法,但找不到直接的方法。仍然想知道是否有人找到了另一种方法来处理以下情况。

如何编写依赖于先前测试用例成功的测试用例?考虑以下示例:

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
            });
        })
    });
});

如果父测试用例失败,我想跳过依赖的测试,从而避免不必要的延迟尝试执行它们。我可以将所有功能添加到一个测试用例中,但我们更喜欢在较小的用例中分解。

谁有解决这个问题的优雅方法?

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

jasmine-bail-fast

jasmine-fail-fast

它可以让您更快地通过测试。