1

Jasmine's beforeEach/ afterEach method runs for each spec defined. Is there a way to run a method once for a group of tests? I am not looking for a solution to use a variable to track if a a method was run or not. It makes teardown tricky.

Edit: Removing jasmine as it already have the beforeAll and afterAll methods. Protractor does not have it yet (https://github.com/angular/protractor/issues/103).

The workaround @jmr suggested is to use a setup and a teardown spec ( it("should setup"...) ).

  • possible duplicate of [Doing something aftereach describe in protractor with selenium server with angularjs](http://stackoverflow.com/questions/27415507/doing-something-aftereach-describe-in-protractor-with-selenium-server-with-angul) – alecxe Dec 27 '14 at 01:20
  • Also see http://stackoverflow.com/questions/24208490/how-can-i-have-a-beforeall-function-in-jasmine-not-coffeescript and http://stackoverflow.com/questions/21726469/beforeall-and-afterall-in-javascript-test-cases. – alecxe Dec 27 '14 at 01:21
  • I see beforeAll is added to newer version of jasmine. Not sure why it did not show up in my search. Will delete this question if that works with protractor. – Maruf Maniruzzaman Dec 27 '14 at 01:45
  • Yup, on older versions, use `jasmine-beforeAll` package mentioned in the linked threads. – alecxe Dec 27 '14 at 01:46

0 Answers0