2015-11-03 95 views
0

我擡頭控制測試流程,但找不到直接的方法。仍然想知道是否有人找到了一種替代方式來管理下面的情況。在量角器和茉莉花測試框架中添加測試依賴項

如何編寫依賴於以前的測試用例成功的測試用例?考慮下面的例子:

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

我想跳過測試是依賴如果父測試用例失敗從而避免試圖執行它們不必要的延遲。我可以將所有功能添加到一個測試用例,但在較小的情況下分解是我們更喜歡的。

任何人都有一個優雅的方式來處理?

回答