Refactoring tests with skip() and skipAll(), help wanted

I have proposed an enhancement for Testbox, to add skip and skipAll() functionality, so we can cleanup some of the test handling in Lucee, when services aren’t available

Once this is available, I’d love some help from the community to go thru and refactor/cleanup all our tests

An example, see all the isNotSupported() cruft / boilerplate in this testcase?

it could all be stripped out with

public function beforeTests() {
    if ( len( server.getDatasource( "mongoDB" ) ) eq 0 )

much cleaner eh?


Hi @Zackster,
I am now watching the ticket - once it is completed I can help with some work.

Having thought about this over the weekend, in the spirit of removing boilerplate, we could add services as component metadata

component extends="org.lucee.cfml.test.LuceeTestCase" labels="mssql" services="mssql" {

basically following the same logic we use for labels

Hi @Zackster

Do we have a “coding style guide”?

  • Use 4 space TABS
  • have a space BEFORE and AFTER parenthesis
  • All new code MUST have a test-case to cover changes.
  • All existing tests MUST include required updates as a result of your changes.

And more to the point for THIS thread;
When writing a test;
We use the following attribuites; “tags” / “services” / “etc”…
The “tag” attributes is for… which does “this” during the CI process…

I did look through the non-source code documents in the root of the Lucee repo - but couldn’t find anything.


There are no current style guidelines for unit tests, what you describe is my normal coding style for tests :slight_smile: I am too old to even touch this topic, even with a barge pole!

Some of our tests are a bit ugly, but I’m of the school, merge when reasonable, as once it’s merged, others can then (theoretically) dive in and improve / cleanup tests.

As for tests being required, it’s simply standard practice these days and it’s clearly mentioned on Lucee/ at 6.0 · lucee/Lucee · GitHub

We generally won’t merge any functionality changes which doesn’t have test coverage, however, not everything can be unit tested due to various reasons (JEE sessions for example, aren’t available when running tests) and underlying bug fixes / improvements to the core engine.

We could do with some documentation on tests in Lucee, it’s all copy by example at the moment

1 Like