Eliminate the code coverage stats banner in a Directory Runner

I am using a few different directory runners.

I have tried including:

But I think that this just prevents it from performing code coverage and has no effect on the Code Coverage stats banner at the top of the page.
Generating these stats takes longer than executing all of my test.

What is the trigger for this banner and is there an option to not generate/calculate this banner?

Alternatively how do I clear/zero out these stats?

Can you include a screenshot of what you’re seeing/ Also, it seems as though you intended to include a code snippet in your post after the text “I have tried including:” but there is nothing there.


You can see the Code Coverage Stats banner at the top with 5571 File Processed.

The missing code block was:
cfparam name=“url.coverageEnabled” default=“false”

The test stats show 63,137 ms which I think is very close for when I run the test individually outside of the runner.

In the runner it takes around 2:05 minutes for the page to return.

Thanks for the additional information. With this, I will address your original questions.

Eliminate the code coverage stats banner

You do this by disabling code coverage. How you accomplish this depends on what runner you are using and how the code is written. The out-of-the-box runner.cfm that comes with a ColdBox app for example, will usually just allow you to set url.codeCoverageEnabled to false. However, if you have written your own runner which does not include the HTMLRunner.cfm from the core of TestBox, you may need to manually set the options when you create TestBox. We’d need to see more code to determine how your runner is working.

But I think that this just prevents it from performing code coverage and has no effect on the Code Coverage stats banner at the top of the page.

This is incorrect. If you see the banner, that means code coverage ran. It sounds like your attempts to disable the code coverage feature are not working which would require the information I discussed in the previous paragraph.

Generating these stats takes longer than executing all of my test.

Yes, for a large number of files, it can be slow. This is mostly due to the CF engine compiling all the files. Unless your app actually has 5,500 CF files, you can use the coverageBlacklist feature to exclude directories that you do not want to be processed. Enabling the coverageBrowserOutputDir setting will allow you to see a report of all the files being processed by code coverage.

What is the trigger for this banner and is there an option to not generate/calculate this banner?

See above.

Alternatively how do I clear/zero out these stats?

I don’t quite understand this question. The code coverage stats are recalculated on every test run. There’s no need for you to try and affect the stats yourself. They are simply a product of what code coverage is detected in your files.

That helps alot here is my runner code:

cfsetting showdebugoutput="false" >
cfsetting requesttimeout="5000">
cfparam name="url.reporter" default="simple">
cfparam name="url.coverageEnabled" default="false">
cfset r = new testbox.system.TestBox( directory={ mapping = "testbox.tests.specs", recurse = true } ) >
cfoutput>#r.run(reporter=url.reporter)#</cfoutput>

I have also added coverageEnabled=false in the URL.
And yes we actually have almost 6000 files.

Yeah, a custom runner like that isn’t going to do anything at all with the URL variable you’re trying to set. If you look in the core HTMLRunner.cfm file, you can see how the default runner uses that flag. Since you’re creating TestBox directly, you’ll need to duplicate what is here:

and pass those options into the TestBox class. Is there a particular reason why you’re not using an out-of-the-box runner like what we have here in our application templates?

1 Like

Thank you, excellent description and solution.

I was unaware of templates.

1 Like