Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
775 views
in Technique[技术] by (71.8m points)

node.js - Doing something aftereach describe in protractor with selenium server with angularjs

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 () {
                  ------------------
    })
})
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...