[英]Ordering of Angular e2e describe and it blocks
我正在使用Karma在AngularJS中運行e2e測試。
在describe()
塊中,為什么it()
塊總是在嵌套的describe()
塊之后始終執行,而不管它們在測試中的順序如何?
例如:
describe( 'Hello Page Nav Bar', function()
{
it( 'should be on the hello page', function()
{
expect( browser().location().url() ).toBe( '/hello' );
} );
// ... many other it() blocks relating to 'Nav Bar' ...
// Create nested describe specifically for menu items within the nav bar
describe( 'Nav Bar Menu Items', function()
{
it( 'should have 12', function()
{
expect( element( '.menu-items div' ).count() ).toBe( 12 );
} );
// ... many other it() blocks relating to 'Nav Bar Menu Items' ...
} );
});
最終將按以下順序執行:
* Hello Page Nav Bar
* Nav Bar Menu Items
* should have 12
* should be on the hello page
我想先測試“應該在問候頁面上” ,這才有意義。
我同意。
一種解決方法是始終使describe塊僅包含其他“ describe塊”或“ it塊”。 這樣,順序保持連貫。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.