That is a normal behavior since, to reduce the risk of concurrency clashes and bugs, ParallelTestExecution
runs each test in its own instance of the Test class. Each one of your tests will be ran as a separate instance of TestSpec
, this results in beforeAll
and afterAll
being executed for each instance.
However you can work around this (in order to get one beforeAll
and one afterAll
executed for all) using nested suites, see this question for more details.