繁体   English   中英

Angular e2e describe的顺序及其阻止

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM