FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

UnitTest Fixtures

v0.0.9 Public

Plugin: Fixtures


The fixtures provides utilities to dump database tables into json fixtures or load json fixtures and create/populate database tables.



  • Lucee 5
  • Adobe Coldfusion 2016


  • SQL Server
  • MySQL


create a fixtures folder in your cfwheels tests folder.



Dump Data

Providing table names, the dumpData method will pull the structure and table rows and generate a fixture. You can provide 1 or many tables for each fixture

    tables = ["tablenames","users","markets"],
    filePath = "tests/fixtures/markets.json",
    overWriteFileEnabled = true,
    maxRows = 50


tablesarraytrue Specify which tables to prep for the fixture dump.
filePathstringoptional Overload the file path, if no file path is provided, the fixture will be saved to the cfwheels home folder.
overWriteFileEnabledbooleanoptionalfalseIf a fixture exists, you can either over write it or leave it as is.
maxRowsnumericoptional-1You can reduce the number of records fetched from each table.

Load Data

The loaddata can be called from anywhere, however, it is common to load from unit tests

loadData(fixtures = ["markets.json"]);

You can also load multiple fixtures at a time by adding items to the array. The path can be supplied when specifying the fixture, however, if one is not provided it will automatically look in the root folder of the cfwheels_home/tests/fixtures folder.

loadData(fixtures = ["markets.json", "fixture2.json", "/lib/fixture3.json"]);


fixturesarraytrue Specify which files to load the fixtures from.
enableCreateTablesbooleanoptionaltrueWhen loading data, you can either create tables or use existing tables.
enablePopulateTablesbooleanoptionaltrueWhen loading data, you can either populate tables or not.

Clear Data

Wipe database tables clean... In other words, drop tables specified in your fixtures.

    clearData(fixtures = ["markets.json"]);


fixturesarraytrue Specify which files to load the fixtures from.


component extends="wheelsMapping.Test" {

    function setup() {
        loadData(fixtures = ["users.json"]);

    function tearDown() {
        clearData(fixtures = ["users.json"]);

    function test_user_authentication() {
        user = model("user").findOne(
            where = "id=12345",
            include = "roles"

Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.

Version Created Last Update Published By Stable Actions
0.0.9 Mar 16 2018 01:20 PM Mar 16 2018 01:20 PM
Version History
0.0.8 Mar 16 2018 01:06 PM Mar 16 2018 01:06 PM


$ box install fixtures

No collaborators yet.
  • Mar 16 2018 01:06 PM
  • Mar 16 2018 01:20 PM
  • 591
  • 0
  • 3