Skip to content

Commit 465dfae

Browse files
committed
test box sample runner, lots of refactoring for standalone builds and our version of colddoc integration.
1 parent 30a1974 commit 465dfae

40 files changed

+3540
-179
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright Since 2005 Ortus Solutions, Corp
3+
* www.coldbox.org | www.luismajano.com | www.ortussolutions.com | www.gocontentbox.org
4+
**************************************************************************************
5+
*/
6+
component{
7+
this.name = "A TestBox Runner Suite " & hash( getCurrentTemplatePath() );
8+
// any other application.cfc stuff goes below:
9+
this.sessionManagement = true;
10+
11+
// any mappings go here, we create one that points to the root called test.
12+
this.mappings[ "/test" ] = getDirectoryFromPath( getCurrentTemplatePath() );
13+
14+
// any orm definitions go here.
15+
16+
// request start
17+
public boolean function onRequestStart( String targetPage ){
18+
19+
return true;
20+
}
21+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<cfsetting showdebugoutput="false">
2+
<cfparam name="url.reporter" default="simple">
3+
<cfscript>
4+
tb = new coldbox.system.testing.TestBox( directory={ recurse=true, mapping="test.specs" }, reporter=url.reporter );
5+
writeOutput( tb.run() );
6+
</cfscript>
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
* This tests the BDD functionality in TestBox. This is CF10+, Railo4+
3+
*/
4+
component extends="coldbox.system.testing.BaseSpec"{
5+
6+
/*********************************** LIFE CYCLE Methods ***********************************/
7+
8+
function beforeAll(){
9+
application.salvador = 1;
10+
}
11+
12+
function afterAll(){
13+
structClear( application );
14+
}
15+
16+
/*********************************** BDD SUITES ***********************************/
17+
18+
function run(){
19+
20+
/**
21+
* describe() starts a suite group of spec tests.
22+
* Arguments:
23+
* @title The title of the suite, Usually how you want to name the desired behavior
24+
* @body A closure that will resemble the tests to execute.
25+
* @labels The list or array of labels this suite group belongs to
26+
* @asyncAll If you want to parallelize the execution of the defined specs in this suite group.
27+
* @skip A flag that tells TestBox to skip this suite group from testing if true
28+
*/
29+
describe( "A spec", function(){
30+
31+
// before each spec in THIS suite group
32+
beforeEach(function(){
33+
coldbox = 0;
34+
coldbox++;
35+
});
36+
37+
// after each spec in THIS suite group
38+
afterEach(function(){
39+
foo = 0;
40+
});
41+
42+
/**
43+
* it() describes a spec to test. Usually the title is prefixed with the suite name to create an expression.
44+
* Arguments:
45+
* @title The title of the spec
46+
* @spec A closure that represents the test to execute
47+
* @labels The list or array of labels this spec belongs to
48+
* @skip A flag that tells TestBox to skip this spec from testing if true
49+
*/
50+
it("is just a closure so it can contain code", function(){
51+
expect( coldbox ).toBe( 1 );
52+
});
53+
54+
// more than 1 expectation
55+
it("can have more than one expectation test", function(){
56+
coldbox = coldbox * 8;
57+
// type checks
58+
expect( coldbox ).toBeTypeOf( 'numeric' );
59+
// dynamic type methods
60+
expect( coldbox ).toBeNumeric();
61+
// delta ranges
62+
expect( coldbox ).toBeCloseTo( expected=10, delta=2 );
63+
// negations
64+
expect( coldbox ).notToBe( 4 );
65+
});
66+
67+
// negations
68+
it("can have negative expectations", function(){
69+
coldbox = coldbox * 8;
70+
// type checks
71+
expect( coldbox ).notToBeTypeOf( 'usdate' );
72+
// dynamic type methods
73+
expect( coldbox ).notToBeArray();
74+
// delta ranges
75+
expect( coldbox ).notToBeCloseTo( expected=10, delta=2 );
76+
});
77+
78+
// xit() skips
79+
xit("can have tests that can be skipped easily like this one", function(){
80+
fail( "xit() this should skip" );
81+
});
82+
83+
// acf dynamic skips
84+
it( title="can have tests that execute if the right environment exists (railo only)", body=function(){
85+
expect( server ).toHaveKey( "railo" );
86+
}, skip=( !isRailo() ));
87+
88+
// railo dynamic skips
89+
it( title="can have tests that execute if the right environment exists (acf only)", body=function(){
90+
expect( server ).notToHaveKey( "railo" );
91+
}, skip=( isRailo() ));
92+
93+
// specs with a random skip closure
94+
it(title="can have a skip that is executed at runtime", body=function(){
95+
fail( "Skipped programmatically, this should fail" );
96+
},skip=function(){ return true; });
97+
98+
});
99+
100+
101+
}
102+
103+
private function isRailo(){
104+
return ( structKeyExists( server, "railo" ) );
105+
}
106+
107+
}

ApplicationTemplates/testbox-runner/specs/put_test_bundles_here.txt

Whitespace-only changes.

ant/framework/ForgeBoxToTemplates.xml

Lines changed: 0 additions & 32 deletions
This file was deleted.

ant/framework/api-build.xml

Lines changed: 0 additions & 57 deletions
This file was deleted.

ant/framework/build.number

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#Build Number for ANT. Edit not!
2-
#Wed, 23 Oct 2013 09:38:28 -0700
2+
#Mon, 02 Dec 2013 15:44:49 -0800
33

4-
build.number=00024
4+
build.number=00029
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<!--Build Properties-->
1313
<property name="dir.userlocation" value="/Users/lmajano" />
1414
<property name="dir.exports" value="${dir.userlocation}/exports" />
15-
<property name="dir.build" value="${dir.exports}/coldbox" />
15+
<property name="dir.build" value="${dir.exports}/coldbox" />
1616
<!-- <property name="dir.dashboard" value="${dir.userlocation}/sites/cboxdev/core/dashboard" /> -->
1717
<property name="dir.samples" value="${dir.userlocation}/sites/cboxdev/samples/coldbox/samples"/>
1818
<property name="colddoc.http" value="http://cf9tools.jfetmac/ColdDoc/coldbox.cfm?version=" />
@@ -61,7 +61,7 @@
6161
</ftp>
6262
</target>
6363

64-
<!--BUild-->
64+
<!--BUild-->
6565
<target name="build" description="Build a new coldbox distribution" depends="compilechecks">
6666

6767
<mkdir dir="${dir.build}"/>
@@ -70,34 +70,34 @@
7070
<concat destfile="${dir.build}/${build.label}">Built on ${start.TODAY}</concat>
7171

7272
<!-- Copy src -->
73-
<copy todir="${dir.build}/coldbox/system">
74-
<fileset dir="system">
75-
</fileset>
73+
<copy todir="${dir.build}/coldbox/system">
74+
<fileset dir="system">
75+
</fileset>
7676
</copy>
77-
78-
<!-- Samples -->
79-
<copy todir="${dir.build}/coldbox/samples">
80-
<fileset dir="${dir.samples}">
81-
</fileset>
82-
</copy>
8377

84-
<!-- Install folder -->
85-
<copy todir="${dir.build}/coldbox/install">
86-
<fileset dir="install" />
78+
<!-- Samples -->
79+
<copy todir="${dir.build}/coldbox/samples">
80+
<fileset dir="${dir.samples}">
81+
</fileset>
82+
</copy>
83+
84+
<!-- Install folder -->
85+
<copy todir="${dir.build}/coldbox/install">
86+
<fileset dir="install" />
8787
</copy>
8888

8989
<!--Copy ForgeBox Modules-->
9090
<ant antfile="${ant.forgeboxModule}" target="copy" />
9191

92-
<!--AppTemplate-->
93-
<copy todir="${dir.build}/coldbox/ApplicationTemplates">
94-
<fileset dir="ApplicationTemplates" />
92+
<!--AppTemplate-->
93+
<copy todir="${dir.build}/coldbox/ApplicationTemplates">
94+
<fileset dir="ApplicationTemplates" />
9595
</copy>
96-
97-
<!--Copy text files to install folder-->
98-
<copy todir="${dir.build}/coldbox/install">
99-
<fileset file="license.txt" />
100-
<fileset file="readme.txt" />
96+
97+
<!--Copy text files to install folder-->
98+
<copy todir="${dir.build}/coldbox/install">
99+
<fileset file="license.txt" />
100+
<fileset file="readme.txt" />
101101
</copy>
102102

103103
<!--Remove Dist-->

ant/framework/header.txt

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dir.exports=/Users/lmajano/exports
2+
dir.build=${basedir}/build-testbox
3+
dir.api=${dir.build}/apidocs
4+
url.api=http://cf10cboxdev.jfetmac/coldbox/apidocs/testbox.cfm?version=

0 commit comments

Comments
 (0)