generated from commandbox-modules/commandbox-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
275 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Dependencies | ||
/docbox/** | ||
modules/** | ||
tests/testbox/** | ||
testbox/** | ||
|
||
# Build Artifacts | ||
.tmp/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name":"TestBox CLI", | ||
"version":"1.1.3", | ||
"version":"1.2.0", | ||
"location":"https://downloads.ortussolutions.com/ortussolutions/commandbox-modules/testbox-cli/@build.version@/[email protected]@.zip", | ||
"slug":"testbox-cli", | ||
"author":"Ortus Solutions, Corp", | ||
|
@@ -25,11 +25,16 @@ | |
"commandbox-cfformat":"*", | ||
"commandbox-docbox":"*" | ||
}, | ||
"dependencies":{}, | ||
"installPaths":{}, | ||
"dependencies":{ | ||
"testbox":"^5.3.0+5" | ||
}, | ||
"installPaths":{ | ||
"testbox":"testbox/" | ||
}, | ||
"ignore":[ | ||
"**/.*", | ||
"build/*" | ||
"build/*", | ||
"tests" | ||
], | ||
"scripts":{ | ||
"build:module":"task run taskFile=build/Build.cfc :projectName=`package show slug` :version=`package show version`", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright Since 2005 Ortus Solutions, Corp | ||
* www.ortussolutions.com | ||
* ************************************************************************************* | ||
*/ | ||
component { | ||
|
||
this.name = "A TestBox Runner Suite " & hash( getCurrentTemplatePath() ); | ||
// any other application.cfc stuff goes below: | ||
this.sessionManagement = true; | ||
|
||
// any mappings go here, we create one that points to the root called test. | ||
this.mappings[ "/tests" ] = getDirectoryFromPath( getCurrentTemplatePath() ); | ||
|
||
// any orm definitions go here. | ||
|
||
// request start | ||
public boolean function onRequestStart( String targetPage ){ | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"author":"", | ||
"bugs":"", | ||
"changelog":"", | ||
"contributors":[], | ||
"dependencies":{ | ||
"testbox":"^5.3.0+5" | ||
}, | ||
"description":"", | ||
"devDependencies":{}, | ||
"documentation":"", | ||
"homepage":"", | ||
"ignore":[ | ||
"**/.*", | ||
"/test/", | ||
"/tests/" | ||
], | ||
"installPaths":{ | ||
"testbox":"testbox/" | ||
}, | ||
"instructions":"", | ||
"keywords":[], | ||
"license":[ | ||
{ | ||
"type":"", | ||
"URL":"" | ||
} | ||
], | ||
"location":"ForgeboxStorage", | ||
"name":"My Package", | ||
"private":false, | ||
"projectURL":"", | ||
"reinitWatchDelay":500, | ||
"reinitWatchDirectory":"", | ||
"reinitWatchPaths":"", | ||
"repository":{ | ||
"type":"", | ||
"URL":"" | ||
}, | ||
"scripts":{}, | ||
"shortDescription":"A sweet package", | ||
"slug":"my-package", | ||
"testbox":{ | ||
"bundles":"", | ||
"directory":"tests.specs", | ||
"excludes":"", | ||
"labels":"", | ||
"options":{}, | ||
"recurse":true, | ||
"reporter":"", | ||
"runner":"http://127.0.0.1:60378/runner.cfm", | ||
"testBundles":"", | ||
"testSpecs":"", | ||
"testSuites":"", | ||
"verbose":true, | ||
"watchDelay":500, | ||
"watchPaths":"**.cfc" | ||
}, | ||
"type":"modules", | ||
"version":"0.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<cfsetting showDebugOutput="false"> | ||
<!--- Executes all tests in the 'specs' folder with simple reporter by default ---> | ||
<cfparam name="url.reporter" default="simple"> | ||
<cfparam name="url.directory" default="tests.specs"> | ||
<cfparam name="url.recurse" default="true" type="boolean"> | ||
<cfparam name="url.bundles" default=""> | ||
<cfparam name="url.labels" default=""> | ||
<cfparam name="url.excludes" default=""> | ||
<cfparam name="url.reportpath" default="#expandPath( "/tests/results" )#"> | ||
<cfparam name="url.propertiesFilename" default="TEST.properties"> | ||
<cfparam name="url.propertiesSummary" default="false" type="boolean"> | ||
<cfparam name="url.editor" default="vscode"> | ||
<cfparam name="url.bundlesPattern" default="*Spec*.cfc|*Test*.cfc"> | ||
|
||
<!--- Code Coverage requires FusionReactor ---> | ||
<cfparam name="url.coverageEnabled" default="false"> | ||
<cfparam name="url.coveragePathToCapture" default="#expandPath( '/root' )#"> | ||
<cfparam name="url.coverageWhitelist" default=""> | ||
<cfparam name="url.coverageBlacklist" default="/testbox,/coldbox,/tests,/modules,Application.cfc,/index.cfm"> | ||
<!---<cfparam name="url.coverageBrowserOutputDir" default="#expandPath( '/tests/results/coverageReport' )#">---> | ||
<!---<cfparam name="url.coverageSonarQubeXMLOutputPath" default="#expandPath( '/tests/results/SonarQubeCoverage.xml' )#">---> | ||
<!--- Enable batched code coverage reporter, useful for large test bundles which require spreading over multiple testbox run commands. ---> | ||
<!--- <cfparam name="url.isBatched" default="false"> ---> | ||
|
||
<!--- Include the TestBox HTML Runner ---> | ||
<cfinclude template="/testbox/system/runners/HTMLRunner.cfm" > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/** | ||
* My first spec file | ||
*/ | ||
component extends="testbox.system.BaseSpec" { | ||
|
||
/*********************************** LIFE CYCLE Methods ***********************************/ | ||
|
||
function beforeAll(){ | ||
// setup the entire test bundle here | ||
variables.salvador = 1; | ||
} | ||
|
||
function afterAll(){ | ||
// do cleanup here | ||
} | ||
|
||
/*********************************** BDD SUITES ***********************************/ | ||
|
||
function run(){ | ||
/** | ||
* describe() starts a suite group of spec tests. It is the main BDD construct. | ||
* You can also use the aliases: story(), feature(), scenario(), given(), when() | ||
* to create fluent chains of human-readable expressions. | ||
* | ||
* Arguments: | ||
* | ||
* @title Required: The title of the suite, Usually how you want to name the desired behavior | ||
* @body Required: A closure that will resemble the tests to execute. | ||
* @labels The list or array of labels this suite group belongs to | ||
* @asyncAll If you want to parallelize the execution of the defined specs in this suite group. | ||
* @skip A flag that tells TestBox to skip this suite group from testing if true | ||
* @focused A flag that tells TestBox to only run this suite and no other | ||
*/ | ||
describe( "A spec", () => { | ||
/** | ||
* -------------------------------------------------------------------------- | ||
* Runs before each spec in THIS suite group or nested groups | ||
* -------------------------------------------------------------------------- | ||
*/ | ||
beforeEach( () => { | ||
testbox = 0; | ||
testbox++; | ||
} ); | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Runs after each spec in THIS suite group or nested groups | ||
* -------------------------------------------------------------------------- | ||
*/ | ||
afterEach( () => { | ||
foo = 0; | ||
} ); | ||
|
||
/** | ||
* it() describes a spec to test. Usually the title is prefixed with the suite name to create an expression. | ||
* You can also use the aliases: then() to create fluent chains of human-readable expressions. | ||
* | ||
* Arguments: | ||
* | ||
* @title The title of this spec | ||
* @body The closure that represents the test | ||
* @labels The list or array of labels this spec belongs to | ||
* @skip A flag or a closure that tells TestBox to skip this spec test from testing if true. If this is a closure it must return boolean. | ||
* @data A struct of data you would like to bind into the spec so it can be later passed into the executing body function | ||
* @focused A flag that tells TestBox to only run this spec and no other | ||
*/ | ||
it( "can test for equality", () => { | ||
expect( testbox ).toBe( 1 ); | ||
} ); | ||
|
||
it( "can have more than one expectation to test", () => { | ||
testbox = testbox * 8; | ||
// type checks | ||
expect( testbox ).toBeTypeOf( "numeric" ); | ||
// dynamic type methods | ||
expect( testbox ).toBeNumeric(); | ||
// delta ranges | ||
expect( testbox ).toBeCloseTo( expected = 10, delta = 2 ); | ||
} ); | ||
|
||
it( "can have negative expectations", () => { | ||
testbox = testbox * 8; | ||
// type checks | ||
expect( testbox ).notToBeTypeOf( "usdate" ); | ||
// dynamic type methods | ||
expect( testbox ).notToBeArray(); | ||
// delta ranges | ||
expect( testbox ).notToBeCloseTo( expected = 10, delta = 2 ); | ||
} ); | ||
|
||
xit( "can have tests that can be skipped easily like this one by prefixing it with x", () => { | ||
fail( "xit() this should skip" ); | ||
} ); | ||
|
||
it( | ||
title = "can have tests that execute if the right environment exists (lucee only)", | ||
body = () => { | ||
expect( server ).toHaveKey( "lucee" ); | ||
}, | ||
skip = ( !isLucee() ) | ||
); | ||
|
||
it( | ||
title = "can have tests that execute if the right environment exists (Adobe only)", | ||
body = () => { | ||
expect( server ).notToHaveKey( "lucee" ); | ||
}, | ||
skip = ( isLucee() ) | ||
); | ||
} ); | ||
} | ||
|
||
private function isLucee(){ | ||
return ( structKeyExists( server, "lucee" ) ); | ||
} | ||
|
||
} |