aliaspooryorik
describe(
title = "A Lucee only suite",
body = function(){
it( "should only execute for Lucee", function(){
expect( server ).toHaveKey( "Lucee" );
} );
},
skip = ( !isLucee() )
);zackster
07/20/2022, 11:20 AMaliaspooryorik
aliaspooryorik
scenario(
title = "Service x is available",
body = function(){
... given / when / then nested in here
})zackster
07/20/2022, 11:23 AMpublic function beforeAll(){
var redis = serve*r.getDatasource("redis");*
if ( structCount(redis) eq 0 )
return false;
defineCache();
}zackster
07/20/2022, 11:24 AMaliaspooryorik
skip=structCount(redis) eq 0 in the scenario (or feature etc)aliaspooryorik
zackster
07/20/2022, 11:26 AMAdam Cameron
beforeAll acts on all tests in the suite; the outermost describe also does. Either impacts the same number of tests.
I do not see either option being cleaner than the other.
The describe approach also has the merit of already being in place.
I do think that giving special powers to a return value of false from beforeAll seems a bit magical. But not egregiously so, that said.
I like the idea of having a mechanism like skipAll or exitSpec or failAll or failRest or something that one could put anywhere in the context of a spec - so within a describe / it callback etc (and indeed in beforeAll!) - which then does what it suggests: doesn't run the rest of the tests, marking them failed. This seems clearer in intent than return false being given special meaning.Adam Cameron
Adam Cameron
describe("tests of the thing", () => {
}, skip=!isOKToRunThese())
Rather than needing to specify them all:
describe(
title = "tests of the thing",
body = () => {
},
skip=!isOKToRunThese()
)
Or include all positional ones (incl the ones one doesn't care about):
describe(
"tests of the thing",
() => {
},
[], // what even is this?
false, // or this?
!isOKToRunThese()
)aliaspooryorik
describe signature and there is a focused have never seen that before and no idea what it does!aliaspooryorik
fdescribealiaspooryorik
Focused Describe, only this should runaliaspooryorik
Adam Cameron
zackster
07/20/2022, 2:18 PMskip( ) and skipAll() was the original idea, we have 16 and counting external services in the Lucee test suite.
I have already done the hard yakka abstracting that all out into https://github.com/lucee/Lucee/blob/6.0/test/_setupTestServices.cfc rather than each test reading and checking env and sys propertieszackster
07/20/2022, 2:19 PMzackster
07/20/2022, 2:20 PMAdam Cameron
zackster
07/20/2022, 2:45 PMAdam Cameron
skipAll and the ticket is about skip.
How does the skip present itself in the output (I guess same way it does now with the skip param actually)?zackster
07/20/2022, 2:52 PMskipAll{} has the same effect as component skip=true {}
skip{} has the same effect as function(etc) skip=true {}