Brent
06/26/2024, 1:40 AMsuper.beforeAll()
or super.afterAll()
in test bundles referenced in documentation and examples I'm reading that inherit from a Base Test Class (that inherits from the Testbox Base Spec).
Can someone explain to me what this means:
"This also helps parent classes enforce their setup methods are called by annotating the methods with @beforeAll
. No more forgetting to call super.beforeAll()
!"
- from this page: https://testbox.ortusbooks.com/in-depth/life-cycle-methods/annotations
I am not doing this (not calling super.beforeAll etc, anywhere), but my tests are working fine. Am I missing something or should I be calling that somewhere? When and where do you need to call the super.[LifeCycleMethods]()
?
My class inheritance:
testbox.system.BaseSpec
-> myBaseTestClass (initializes application variables/test setup and does not call super.beforeEach etc.)Brent
06/26/2024, 1:45 AMelpete
06/26/2024, 5:18 AMelpete
06/26/2024, 5:19 AMsuper
methods. If your tests are working, no need to change anything.Brent
06/26/2024, 12:38 PMbdw429s
06/26/2024, 2:11 PMBrent
06/26/2024, 2:13 PMbdw429s
06/26/2024, 2:17 PMbeforeAll()
you
β’ only can have one of them (duh)
β’ you must call the super.beforeAll()
or stuff won't work
however, when you do this
@beforeAll
funnction someRandomMethodWhoCaresWhatItIsCalled() {
}
@beforeAll
funnction anotherOne() {
}
@beforeAll
funnction anotherOneBitesTheDust() {
}
you can
β’ have as many before all methods as you like
β’ none of them need to make any super calls since they don't actually override the base methodbdw429s
06/26/2024, 2:19 PMbdw429s
06/26/2024, 2:19 PMBrent
06/26/2024, 2:25 PMbeforeAll
call, I have no need to call super.beforeAll() (pretty sure this is right), correct?
However if I did have a beforeAll in my BaseTest class, does that mean I need to call super.beforeAll in it or in a constructor init in order to bring maybe a TestBox's BaseSpec beforeAll
I'm inheriting from into the mix?bdw429s
06/26/2024, 3:04 PM