The Ortus BlogBox

"Ortus: A rise, beginning, coming into being, born, the origin!"

 

 

Category Filtering: 'testbox'

 

The 12 Modules of (ForgeBox) Christmas — Day 10 — TestBox Snapshots

Eric Peterson
Dec 23, 2017

 

Today's featured module is a TestBox module that introduces snapshot testing capabilities to TestBox. If you've avoided testing your legacy applications, come see how TestBox Snapshots can get you started.

12 Modules of (ForgeBox) Christmas, ForgeBox, Modules, TestBox 0

ColdBox and TestBox Microsoft Visual Studio Code Support Released

Luis Majano
Nov 29, 2017

 

We are very excited today to announce the immediate release of our first two extensions for Microsoft Visual Studio Code Our ColdBox Extension is very similar to our Sublime extension but better! I have to admit that VSCode is absolutely great and we have been able to not only release our collection of snippets but give you typeahead and scope recognition in this extension.

CacheBox, ColdBox MVC, IDE, LogBox, Releases, TestBox, WireBox 0

CFSUMMIT2017 - 3 ways to test your ColdFusion API

Gavin Pickin
Nov 22, 2017

 

CF Summit 2017 was a lot of fun, lots of new faces, and good to meet friends, old and new alike. I really enjoyed the ColdBox 2 day training, RESTFul Training Bootcamp. I also enjoyed, Pete Freitag's Hands On CFML Security Workshop. It was fun, and terrifying at the same time. My session on 3 ways to test your ColdFusion API went well, lots of interest, and lots of discussion after the class. I am sharing my slides in this post, as well as a collection of other Video Presentations from previous presentations by myself, and others, which will help build upon the information presented.

Conferences, Presentations, TestBox 2

CFObjective 2017 - 3 WAYS TO TEST YOUR COLDFUSION API - Gavin Pickin

Gavin Pickin
Jul 24, 2017

 

Most projects in CF now involve creating some type of consumable CFC Endpoint or API Service… do you Unit test your API, do you use Integration Tests on your API? How many ways do you test your API? Not all tests are created equal.

We build our CFCs and CF API to be consumed with CF Apps, Mobile Apps, Javascript apps and devices we haven’t even thought about yet. To be smart developers we need to be able to test our CFC endpoints, and the code that uses those endpoints.

Conferences, Presentations, REST, TestBox 2

CFObjective 2017 - Automate Thyself - Luis Majano

Luis Majano
Jul 24, 2017

 

At this year's CF.Objective I had the privilege to present on testing and automation. Here are the slides for the presentation and you can find the test source code in github: https://github.com/coldbox-samples/cbvue.

Automate Thyself Synopsis

In this advanced session, we will investigate all the ways that you can automate your testing processes with TestBox and many CI and automation tools. From Jenkins integration, Travis CI, Node runners, Grunt watchers and much more. This session will show you the value of continuous integration and how to apply it with modern tools and technologies.

Conferences, Presentations, TestBox 0

Using "testbox watch" to Automate Your Testing Suite

Brad Wood
May 19, 2017

 

Using "testbox watch" to Automate Your Testing Suite

There is a new command in town in the CommandBox 3.7 snapshot build.  If you want to get the current snapshot build of CommandBox 3.7 to try this out, and play with it, simply run the following command and it will direct you to the latest bleeding edge download page:

CommandBox> upgrade --latest
CommandBox, TestBox, Tutorials 0

TestBox v2.5.0 Released!

Luis Majano
May 18, 2017

 

We are excited to announce the release of TestBox version 2.5.0. To install just do:

box install testbox --savedev

To upgrade your current testbox installation just run the following:

box uninstall testbox && install testbox --savedev

TestBox 2.5.0 is a minor release with some great new functionality and tons of fixes. You can find the release notes here and the major updates for this release. One of the biggest features for TestBox that was not part of TestBox, was the addition of TestBox Watchers to CommandBox.

ColdBox MVC, ColdFusion, Community, News, Releases, TestBox 0

Content Box Theme Development: Creating a CI Pipeline

Jon Clausen
Aug 05, 2016

 

An incredibly powerful feature of ContentBox 3 is the increasing availability of open source themes to jump start your custom development.   For those wishing to contribute back to the community, creating your own theme is as simple as cloning one of our boilerplate themes, creating a new GitHub repo for your customizations, and publishing your theme on Forgebox.  

ContentBox CMS, TestBox, Tutorials 0

Spec Data Binding in TestBox

Luis Majano
May 06, 2016

 

This issue has comed up several times in our mailing lists, so why not expand a little with a blog post.

The Problem

Many developers working with TestBox love the BDD approach to spec design. Once they get familiar with the syntax they start getting funky! It is just natural! Since they are coding within a CFC they decide to create dynamic it() or specs by iterating over some type of data collection (queries,arrays,structs). The first iteration of the code might look like this:

// Complex Example
for( var filePath in files ){

    it("#getFileFromPath(filePath)# should be valid JSON", function() {

        var json = fileRead(filePath);
        var isItJson = isJSON(json);
        expect(json).notToBeEmpty();
        expect(isItJson).toBeTrue();

        if (isItJson) {
            var data = deserializeJSON(json);
            if (getFileFromPath(filePath) != "index.json") {
                expect(data).toHaveKey("name");
                expect(data).toHaveKey("type");
            }
        }

    });

}

The Expectation

Now, you would really expect this to work, and it partially does. What you will see is that only the last binding of the iteration works. This is due to the fact that you are iterating and creating closures at runtime. The problem is that closures rely on its environment when executed, not when defined. So in reality, once TestBox executes these closures for evaluation purposes, the last filePath is the one used, since that is the contents of the variable at the time of the execution of the closure, NOT the definition of the closure.

I know, I know, this is really hurting your brain. That's ok. You are getting funky, doesn't mean it is always easy. Anyways, thankfully, TestBox provides a workaround so you can actually bind the spec with runtime definitions so your closures can actually take the right data.

The Solution

The solutions is to use spec data binding in TestBox. Each closure that defines the it() spec, accepts a data argument which is a structure.

it( title="", data={}, body=function( data ){} );

This is passed by TestBox automatically for you. All you have to do is bind it. You do this by passing another argument to the it() spec called data. This now allows you to update your code to the following:

// Complex Example. Let's iterate over a bunch of files and create dynamic specs
for( var filePath in files ){

  it( 
    title="#getFileFromPath( filePath )# should be valid JSON", 
    // pass in a struct of data to the spec for later evaluation
    data = { filePath = filePath },
    // the spec closure accepts the data for later evaluation
    function( data ) {
      var json = fileRead( data.filePath );
      var isItJson = isJSON( json );

      expect( json ).notToBeEmpty();
      expect( isItJson ).toBeTrue();

      if( isItJson ){
          var jsonData = deserializeJSON(json);
          if( getFileFromPath( filePath ) != "index.json"){
              expect( jsonData ).toHaveKey( "name" );
              expect( jsonData ).toHaveKey( "type" );
          }
      }

  });

}

Now you can generate dynamic specs and bind them accordingly at runtime! Enjoy!

TestBox, Tutorials 0

REST2016 - Testing your API with TestBox

Gavin Pickin
Mar 18, 2016

 

Are you writing APIs? Going to start writing APIs? Now is the time to start testing. Do it early, and often, and reap the benefits as the project grows. TestBox, the defacto CFML test suite, can help your test your API, whether it’s CFML or not.

I will assume you have the basic TextBox installation setup.
 

ColdBox MVC, REST, RoadShow, TestBox 1
1 2 3 4 5 6 ... 7 >>