Doing something aftereach describe in protractor with selenium server with angularjs

♀尐吖头ヾ 提交于 2019-12-29 09:19:12

问题


I want to do something after each describe(not after each testcase) and before each describe, is there any way to do this? I have tried below format, but it gives me error that, before and after not defined, is it possible to do sometask before and after of each describe:

describe('testcase', function () {
    before(function () {
        --------------
    })
    beforeEach(function () {
       -----------------
    })
    afterEach(function () {
        --------------
    })
    after(function () {
        -----------------
    })
    it('task1', function () {
             -----------

    })it('task2', function () {
                  ------------------
    })
})

回答1:


As far as I understand, you want beforeAll and afterAll which were introduced in jasmine 2.1:

The beforeAll function is called only once before all the specs in describe are run, and the afterAll function is called after all specs finish. These functions can be used to speed up test suites with expensive setup and teardown.

For the older jasmine versions, the same can be done with the help of jasmine-beforeAll package.



来源:https://stackoverflow.com/questions/27415507/doing-something-aftereach-describe-in-protractor-with-selenium-server-with-angul

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!