问题
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