diff --git a/readme.md b/readme.md index bbf4afc..ad21514 100755 --- a/readme.md +++ b/readme.md @@ -17,7 +17,7 @@ ---- -TestBox is a Behavior Driven Development (BDD) and Test Driven Development (TDD) framework for ColdFusion (CFML). It also includes mocking and stubbing capabilities via its internal MockBox library. +TestBox is a Behavior Driven Development (BDD) and Test Driven Development (TDD) framework for [BoxLang JVM Language](https://www.boxlang.io) and ColdFusion (CFML). It also includes mocking and stubbing capabilities via its internal MockBox library. ## License @@ -70,6 +70,7 @@ Join us in our Ortus Community and become a valuable member of this project [Tes ## Requirements +* BoxLang 1+ * Lucee 5+ * Adobe ColdFusion 2018+ @@ -77,8 +78,7 @@ Join us in our Ortus Community and become a valuable member of this project [Tes You can visit the TestBox documentation page to view all of its features and capabilities. To install TestBox just drop it in your web root as `/testbox` or -create a mapping in your CFML administrator or `Application.cfc` that points to the -directory you installed TestBox and create the mapping `/testbox` that points to it. +create a mapping `/testbox` that points to it. You can also use [CommandBox](https://www.ortussolutions.com/products/commandbox) to install and leverage TestBox for commandline executions, test generations, watchers and much more: diff --git a/server-boxlang@1.json b/server-boxlang@1.json new file mode 100644 index 0000000..31111aa --- /dev/null +++ b/server-boxlang@1.json @@ -0,0 +1,33 @@ +{ + "app":{ + "cfengine":"boxlang@be", + "serverHomeDirectory":".engine/boxlang" + }, + "name":"coldbox-boxlang", + "force":true, + "openBrowser":false, + "web":{ + "directoryBrowsing":true, + "http":{ + "port":"8599" + }, + "rewrites":{ + "enable":true + }, + "aliases":{ + "/testbox":"./" + } + }, + "JVM":{ + "heapSize":"1024" + }, + "cfconfig":{ + "file":".cfconfig.json" + }, + "env":{ + "BOXLANG_DEBUG": true + }, + "scripts" : { + "onServerInitialInstall":"install bx-compat" + } +} diff --git a/system/Application.cfc b/system/Application.cfc index c0091c7..f1d29ce 100644 --- a/system/Application.cfc +++ b/system/Application.cfc @@ -2,7 +2,7 @@ * Copyright Since 2005 TestBox Framework by Luis Majano and Ortus Solutions, Corp * www.ortussolutions.com * --- - * This is the base Application.cfc for the TestBox testing suite + * This is the base Application for the TestBox testing suite * Whenever you are running tests from within TestBox Core */ component { diff --git a/system/BaseSpec.cfc b/system/BaseSpec.cfc index e538489..ddfc538 100644 --- a/system/BaseSpec.cfc +++ b/system/BaseSpec.cfc @@ -786,7 +786,7 @@ component { /** * Add custom matchers to your expectations * - * @matchers The structure of custom matcher functions to register or a path or instance of a CFC containing all the matcher functions to register + * @matchers The structure of custom matcher functions to register or a path or instance of a class containing all the matcher functions to register */ function addMatchers( required any matchers ){ // register structure @@ -796,7 +796,7 @@ component { return this; } - // Build the Matcher CFC + // Build the Matcher var oMatchers = ""; if ( isSimpleValue( arguments.matchers ) ) { oMatchers = new "#arguments.matchers#"( ); @@ -821,7 +821,7 @@ component { /** * Add custom assertions to the $assert object * - * @assertions The structure of custom assertion functions to register or a path or instance of a CFC containing all the assertion functions to register + * @assertions The structure of custom assertion functions to register or a path or instance of a class containing all the assertion functions to register */ function addAssertions( required any assertions ){ // register structure @@ -831,7 +831,7 @@ component { return this; } - // Build the Custom Assertion CFC + // Build the Custom Assertion var oAssertions = ""; if ( isSimpleValue( arguments.assertions ) ) { oAssertions = new "#arguments.assertions#"( ); @@ -886,7 +886,7 @@ component { } /** - * Run a BDD test in this target CFC + * Run a BDD test in this target * * @spec The spec definition to test * @suite The suite definition this spec belongs to @@ -1265,7 +1265,7 @@ component { } /** - * Runs a xUnit style test method in this target CFC + * Runs a xUnit style test method in this target * * @spec The spec definition to test * @testResults The testing results object @@ -1465,7 +1465,7 @@ component { /************************************** MOCKING METHODS *********************************************/ /** - * Make a private method on a CFC public with or without a new name and returns the target object + * Make a private method on a class public with or without a new name and returns the target object * * @target The target object to expose the method * @method The private method to expose @@ -1627,7 +1627,7 @@ component { * Create an empty stub object that you can use for mocking * * @callLogging Add method call logging for all mocked methods. Defaults to true - * @extends Make the stub extend from certain CFC + * @extends Make the stub extend from certain class * @implements Make the stub adhere to an interface */ function createStub( diff --git a/system/CollectionExpectation.cfc b/system/CollectionExpectation.cfc index aaed522..f32132f 100644 --- a/system/CollectionExpectation.cfc +++ b/system/CollectionExpectation.cfc @@ -2,7 +2,7 @@ * Copyright Since 2005 TestBox Framework by Luis Majano and Ortus Solutions, Corp * www.ortussolutions.com * --- - * The CollectionExpectation CFC holds a collection and behaves like an expectation + * The CollectionExpectation holds a collection and behaves like an expectation * that automatically unrolls the collection to verify every element */ component accessors="true" { diff --git a/system/Expectation.cfc b/system/Expectation.cfc index 12262af..76cad87 100644 --- a/system/Expectation.cfc +++ b/system/Expectation.cfc @@ -2,7 +2,7 @@ * Copyright Since 2005 TestBox Framework by Luis Majano and Ortus Solutions, Corp * www.ortussolutions.com * --- - * The Expectation CFC holds a current expectation with all the required matcher methods to provide you + * The Expectation class holds a current expectation with all the required matcher methods to provide you * with awesome BDD expressions and testing. */ component accessors="true" { @@ -113,7 +113,7 @@ component accessors="true" { // throw exception throw( type = "InvalidMethod", - message = "The dynamic/static method: #arguments.missingMethodName# does not exist in this CFC", + message = "The dynamic/static method: #arguments.missingMethodName# does not exist in this class", detail = "Available methods are #structKeyArray( this ).toString()#" ); } diff --git a/system/MockBox.cfc b/system/MockBox.cfc index 5ee5339..a2efd0f 100644 --- a/system/MockBox.cfc +++ b/system/MockBox.cfc @@ -136,7 +136,7 @@ component accessors=true { return createMock( className = "testbox.system.mockutils.Stub", callLogging = arguments.callLogging ); } // Generate the class + Create it + Remove it - return prepareMock( variables.mockGenerator.generateCFC( argumentCollection = arguments ) ); + return prepareMock( variables.mockGenerator.generateClass( argumentCollection = arguments ) ); } /** @@ -624,7 +624,7 @@ component accessors=true { ) ) ) { - // If an object and CFC, just use serializeJSON + // If an object and a class, just use serializeJSON serializedArgs &= serializeJSON( getMetadata( argOrderedTree[ arg ] ) ); } else { // Get obj rep diff --git a/system/TestBox.cfc b/system/TestBox.cfc index 1deb9c3..2ad760d 100644 --- a/system/TestBox.cfc +++ b/system/TestBox.cfc @@ -13,7 +13,7 @@ component accessors="true" { property name="codename"; // The main utility object property name="utility"; - // The CFC bundles to test + // The class bundles to test property name="bundles"; // The labels used for the testing property name="labels"; @@ -38,8 +38,8 @@ component accessors="true" { /** * Constructor * - * @bundles The path, list of paths or array of paths of the spec bundle CFCs to run and test - * @directory The directory to test which can be a simple mapping path or a struct with the following options: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the CFC found, it must return true to process or false to continue process ] + * @bundles The path, list of paths or array of paths of the spec bundle classes to run and test + * @directory The directory to test which can be a simple mapping path or a struct with the following options: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the class found, it must return true to process or false to continue process ] * @directories Same as @directory, but accepts an array or list * @reporter The type of reporter to use for the results, by default is uses our 'simple' report. You can pass in a core reporter string type or an instance of a testbox.system.reports.IReporter * @labels The list or array of labels that a suite or spec must have in order to execute. @@ -114,6 +114,17 @@ component accessors="true" { ); } ); + directoryList( modulesPath, true, "path", "ModuleConfig.bx" ) + .map( ( item ) => item.replaceNoCase( "ModuleConfig.bx", "" ) ) + .each( ( path ) => { + registerModule( + "testbox" & arguments.path + .replaceNoCase( variables.TESTBOX_PATH, "" ) + .reReplace( "[\\\/]", ".", "all" ) + .reReplace( "\.$", "", "all" ) + ); + } ); + // Activate Modules variables.modules.registry.each( ( moduleName, config ) => activateModule( moduleName ) ); @@ -249,7 +260,7 @@ component accessors="true" { /** * Register a directory to test * - * @directory A directory to test which can be a simple mapping path or a struct with the following options: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the CFC found, it must return true to process or false to continue process ] + * @directory A directory to test which can be a simple mapping path or a struct with the following options: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the class found, it must return true to process or false to continue process ] */ any function addDirectory( required any directory, boolean recurse = true ){ // inflate directory? @@ -271,7 +282,7 @@ component accessors="true" { /** * Constructor * - * @directories A set of directories to test which can be a list of simple mapping paths or an array of structs with the following options: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the CFC found, it must return true to process or false to continue process ] + * @directories A set of directories to test which can be a list of simple mapping paths or an array of structs with the following options: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the class found, it must return true to process or false to continue process ] */ any function addDirectories( required any directories, boolean recurse = true ){ if ( isSimpleValue( arguments.directories ) ) { @@ -286,7 +297,7 @@ component accessors="true" { /** * Add bundles to the TestBox `bundles` target to test * - * @bundles The path, list of paths or array of paths of the spec bundle CFCs to run and test + * @bundles The path, list of paths or array of paths of the spec bundle classess to run and test */ any function addBundles( required any bundles ){ if ( isSimpleValue( arguments.bundles ) ) { @@ -302,8 +313,8 @@ component accessors="true" { * Run me some testing goodness, this can use the constructed object variables or the ones * you can send right here. * - * @bundles The path, list of paths or array of paths of the spec bundle CFCs to run and test - * @directory The directory to test which can be a simple mapping path or a struct with the following options: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the CFC found, it must return true to process or false to continue process ] + * @bundles The path, list of paths or array of paths of the spec bundle classes to run and test + * @directory The directory to test which can be a simple mapping path or a struct with the following options: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the class found, it must return true to process or false to continue process ] * @reporter The type of reporter to use for the results, by default is uses our 'simple' report. You can pass in a core reporter string type or an instance of a testbox.system.reports.IReporter. You can also pass a struct if the reporter requires options: {type="", options={}} * @labels The list or array of labels that a suite or spec must have in order to execute. * @excludes The list or array of labels that a suite or spec must not have in order to execute. @@ -311,7 +322,7 @@ component accessors="true" { * @testBundles A list or array of bundle names that are the ones that will be executed ONLY! * @testSuites A list or array of suite names that are the ones that will be executed ONLY! * @testSpecs A list or array of test names that are the ones that will be executed ONLY! - * @callbacks A struct of listener callbacks or a CFC with callbacks for listening to progress of the testing: onBundleStart,onBundleEnd,onSuiteStart,onSuiteEnd,onSpecStart,onSpecEnd + * @callbacks A struct of listener callbacks or a class with callbacks for listening to progress of the testing: onBundleStart,onBundleEnd,onSuiteStart,onSuiteEnd,onSpecStart,onSpecEnd * @eagerFailure If this boolean is set to true, then execution of more bundle tests will stop once the first failure/error is detected. By default this is false. */ any function run( @@ -346,15 +357,15 @@ component accessors="true" { /** * Run me some testing goodness but give you back the raw TestResults object instead of a report * - * @bundles The path, list of paths or array of paths of the spec bundle CFCs to run and test - * @directory The directory to test which can be a simple mapping path or a struct with the following options: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the CFC found, it must return true to process or false to continue process ] + * @bundles The path, list of paths or array of paths of the spec bundle classes to run and test + * @directory The directory to test which can be a simple mapping path or a struct with the following options: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the class found, it must return true to process or false to continue process ] * @labels The list or array of labels that a suite or spec must have in order to execute. * @excludes The list or array of labels that a suite or spec must not have in order to execute. * @options A structure of configuration options that are optionally used to configure a runner. * @testBundles A list or array of bundle names that are the ones that will be executed ONLY! * @testSuites A list or array of suite names that are the ones that will be executed ONLY! * @testSpecs A list or array of test names that are the ones that will be executed ONLY! - * @callbacks A struct of listener callbacks or a CFC with callbacks for listening to progress of the testing: onBundleStart,onBundleEnd,onSuiteStart,onSuiteEnd,onSpecStart,onSpecEnd + * @callbacks A struct of listener callbacks or a class with callbacks for listening to progress of the testing: onBundleStart,onBundleEnd,onSuiteStart,onSuiteEnd,onSpecStart,onSpecEnd * @eagerFailure If this boolean is set to true, then execution of more bundle tests will stop once the first failure/error is detected. By default this is false. */ testbox.system.TestResult function runRaw( @@ -486,7 +497,7 @@ component accessors="true" { /** * Run me some testing goodness, remotely via SOAP, Flex, REST, URL * - * @bundles The path or list of paths of the spec bundle CFCs to run and test + * @bundles The path or list of paths of the spec bundle classes to run and test * @directory The directory mapping to test: directory = the path to the directory using dot notation (myapp.testing.specs) * @recurse Recurse the directory mapping or not, by default it does * @reporter The type of reporter to use for the results, by default is uses our 'simple' report. You can pass in a core reporter string type or a class path to the reporter to use. @@ -693,11 +704,11 @@ component accessors="true" { /***************************************** PRIVATE ************************************************************/ /** - * This method executes the tests in a bundle CFC according to type. If the testing was ok a true is returned. + * This method executes the tests in a bundle class according to type. If the testing was ok a true is returned. * - * @bundlePath The path of the Bundle CFC to test. + * @bundlePath The path of the Bundle class to test. * @testResults The testing results object to keep track of results - * @callbacks The callbacks struct or CFC + * @callbacks The callbacks struct or class * * @throws BundleRunnerMajorException */ @@ -760,9 +771,9 @@ component accessors="true" { } /** - * Creates and returns a bundle CFC with spec capabilities if not inherited. + * Creates and returns a bundle class with spec capabilities if not inherited. * - * @bundlePath The path to the Bundle CFC + * @bundlePath The path to the Bundle class * * @throws AbstractComponentException - When an abstract component exists as a spec */ @@ -806,7 +817,7 @@ component accessors="true" { /** * Get an array of spec paths from a directory * - * @directory The directory information struct to test: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the CFC found, it must return true to process or false to continue process ] + * @directory The directory information struct to test: [ mapping = the path to the directory using dot notation (myapp.testing.specs), recurse = boolean, filter = closure that receives the path of the class found, it must return true to process or false to continue process ] */ private function getSpecPaths( required directory ){ var results = []; diff --git a/system/TestResult.cfc b/system/TestResult.cfc index 3306c54..e006779 100644 --- a/system/TestResult.cfc +++ b/system/TestResult.cfc @@ -34,7 +34,7 @@ component accessors="true" { property name="coverageEnabled" type="boolean"; property name="coverageData" type="struct"; - // CFML Engine Information + // Engine Information property name="CFMLEngine"; property name="CFMLEngineVersion"; diff --git a/system/compat/runner/DirectoryTestSuite.cfc b/system/compat/runner/DirectoryTestSuite.cfc index db7c779..7f3bb15 100644 --- a/system/compat/runner/DirectoryTestSuite.cfc +++ b/system/compat/runner/DirectoryTestSuite.cfc @@ -24,7 +24,7 @@ name ="excludes" required="false" default ="" - hint ="list of Tests, in cfc notation, to exclude. uses ListContains so it's as greedy as possible. Currently does not support ant-style syntax or whole-directory filtering" + hint ="list of Tests, in class notation, to exclude. uses ListContains so it's as greedy as possible. Currently does not support ant-style syntax or whole-directory filtering" > @@ -39,7 +39,7 @@ name ="getComponentPath" access ="remote" returntype="string" - hint ="Given a directory path, returns the corresponding CFC package according to CFMX" + hint ="Given a directory path, returns the corresponding class package according to CFMX" output ="false" > diff --git a/system/compat/runner/Results.cfc b/system/compat/runner/Results.cfc index 97eec8a..9b8c949 100644 --- a/system/compat/runner/Results.cfc +++ b/system/compat/runner/Results.cfc @@ -61,9 +61,9 @@ component { private function filterExcludes( required path ){ var excludes = getOptions().excludes; - var cfcName = listFirst( getFileFromPath( arguments.path ), "." ); + var className = listFirst( getFileFromPath( arguments.path ), "." ); - return ( listFindNoCase( excludes, cfcName ) ? false : true ); + return ( listFindNoCase( excludes, className ) ? false : true ); } } diff --git a/system/coverage/data/CoverageGenerator.cfc b/system/coverage/data/CoverageGenerator.cfc index 7c15039..b154c50 100644 --- a/system/coverage/data/CoverageGenerator.cfc +++ b/system/coverage/data/CoverageGenerator.cfc @@ -194,7 +194,7 @@ component accessors=true { // Overrides for buggyiness ************************************************************************ - // On Adobe, the first line of CFCs seems to always report as being executable but not running whether it's a comment or a component declaration + // On Adobe, the first line of classes seems to always report as being executable but not running whether it's a comment or a component declaration if ( theFile.right( 4 ) == ".cfc" && currentLineNum == 1 && !covered && line.startsWith( "/" & "*" diff --git a/system/mockutils/MockGenerator.cfc b/system/mockutils/MockGenerator.cfc index 4de01de..3c1a156 100644 --- a/system/mockutils/MockGenerator.cfc +++ b/system/mockutils/MockGenerator.cfc @@ -344,30 +344,36 @@ A mock generator - + - + - var udfOut = createObject( "java", "java.lang.StringBuilder" ).init( "" ); - var genPath = expandPath( instance.mockBox.getGenerationPath() ); - var tmpFile = ""; - var cfcPath = ""; - var oStub = ""; - var local = {}; - var stubCode = ""; + var udfOut = createObject( "java", "java.lang.StringBuilder" ).init( "" ); + var genPath = expandPath( instance.mockBox.getGenerationPath() ); + var tmpFile = ""; + var classPath = ""; + var oStub = ""; + var local = {}; + var stubCode = ""; // Create CFC Signature udfOut.append( "