From 1f264e9c2ed11aee953c9c7e896a3d1bec3d2627 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 25 May 2021 09:30:27 -0600 Subject: [PATCH 01/15] version bump --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index 0d38aa5..892d2f6 100644 --- a/box.json +++ b/box.json @@ -1,6 +1,6 @@ { "name":"TestBox", - "version":"4.3.1", + "version":"4.4.0", "location":"https://downloads.ortussolutions.com/ortussolutions/testbox/@build.version@/testbox-@build.version@.zip", "author":"Ortus Solutions ", "slug":"testbox", From b71fb5f8b123ab1b0dc3b7e1b35bd181006b786a Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 27 May 2021 10:32:26 -0600 Subject: [PATCH 02/15] TESTBOX-311 #resolve CF error variable [THISBUNDLE] doesn't exist when running tests --- system/reports/assets/simple.cfm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/reports/assets/simple.cfm b/system/reports/assets/simple.cfm index 93493b4..186d446 100644 --- a/system/reports/assets/simple.cfm +++ b/system/reports/assets/simple.cfm @@ -536,7 +536,7 @@ code { - +
From 0df6fbc4d67690cb97abad11dd6337ef3bf6d343 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 27 May 2021 11:11:13 -0600 Subject: [PATCH 03/15] Improving whitespace crap cfml produces --- system/reports/MinTextReporter.cfc | 7 ++++++- system/reports/TextReporter.cfc | 15 ++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/system/reports/MinTextReporter.cfc b/system/reports/MinTextReporter.cfc index 4f3a16d..d883bf4 100644 --- a/system/reports/MinTextReporter.cfc +++ b/system/reports/MinTextReporter.cfc @@ -39,7 +39,12 @@ component extends="TextReporter" { savecontent variable="local.report" { include "assets/mintext.cfm"; } - return trim( local.report ); + return reReplace( + trim( local.report ), + "[\r\n]+", + chr( 10 ), + "all" + ); } } diff --git a/system/reports/TextReporter.cfc b/system/reports/TextReporter.cfc index b798864..9a7d82e 100644 --- a/system/reports/TextReporter.cfc +++ b/system/reports/TextReporter.cfc @@ -39,7 +39,12 @@ component extends="BaseReporter" { savecontent variable="local.report" { include "assets/text.cfm"; } - return trim( local.report ); + return reReplace( + trim( local.report ), + "[\r\n]+", + chr( 10 ), + "all" + ); } /** @@ -49,13 +54,13 @@ component extends="BaseReporter" { */ function getStatusIndicator( required status ){ if( arguments.status == "error" ){ - return "!! "; + return "!!"; } else if ( arguments.status == "failed" ) { - return "X "; + return "X"; } else if ( arguments.status == "skipped" ) { - return "- "; + return "-"; } else { - return "√ "; + return "√"; } } From 37fe86a49618f49dea3030a31cba1875f7ebb369 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Thu, 27 May 2021 14:01:38 -0400 Subject: [PATCH 04/15] Escape tags in coverage output so that the output isn't broken. --- system/coverage/browser/CodeBrowser.cfc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/coverage/browser/CodeBrowser.cfc b/system/coverage/browser/CodeBrowser.cfc index e4dc4a3..d779eb9 100644 --- a/system/coverage/browser/CodeBrowser.cfc +++ b/system/coverage/browser/CodeBrowser.cfc @@ -99,6 +99,9 @@ component accessors=true { var relPathToRoot = repeatString( "../", levelsFromRoot - 1 ); var brush = right( fileData.relativeFilePath, 4 ) == ".cfm" ? "coldfusion" : "javascript"; + // Escape closing script tags to avoid breaking out of code display early + fileContents = REReplace(fileContents, '', '</script>', 'all'); + savecontent variable="local.fileTemplate" { include "templates/file.cfm"; } From c4fcd556caaf40d15bd5a04861cde260c481f569 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 27 May 2021 16:04:52 -0600 Subject: [PATCH 05/15] TESTBOX-314 #resolve text and min text whitespace management --- system/reports/assets/mintext.cfm | 111 ++++++++++++++---------------- system/reports/assets/text.cfm | 93 +++++++++++-------------- 2 files changed, 92 insertions(+), 112 deletions(-) diff --git a/system/reports/assets/mintext.cfm b/system/reports/assets/mintext.cfm index f14d3fd..c67f775 100644 --- a/system/reports/assets/mintext.cfm +++ b/system/reports/assets/mintext.cfm @@ -8,9 +8,6 @@ _____________________________________________________________ [Passed: #thisBundle.totalPass#] [Failed: #thisBundle.totalFail#] [Errors: #thisBundle.totalError#] [Skipped: #thisBundle.totalSkipped#] [Suites/Specs: #thisBundle.totalSuites#/#thisBundle.totalSpecs#] #space()# - - - #space()# @@ -19,23 +16,18 @@ _____________________________________________________________ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #space()# #thisBundle.globalException.type#:#thisBundle.globalException.message#:#thisBundle.globalException.detail# - - - #thisContext.template#:#thisContext.line# - #thisContext.codePrintPlain ?: ""# - + +#thisContext.template#:#thisContext.line# +#thisContext.codePrintPlain ?: ""# + #space()# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - -#genSuiteReport( suiteStats, thisBundle )# - +#genSuiteReport( suiteStats, thisBundle )# - - #space()# #space()# @@ -44,7 +36,6 @@ Final Stats ================================================================================= #space()# [Passed: #results.getTotalPass()#] [Failed: #results.getTotalFail()#] [Errors: #results.getTotalError()#] [Skipped: #results.getTotalSkipped()#] [Bundles/Suites/Specs: #results.getTotalBundles()#/#results.getTotalSuites()#/#results.getTotalSpecs()#] - #space()# @@ -54,7 +45,6 @@ Code Coverage [Total Coverage: #numberFormat( results.getCoverageData().stats.percTotalCoverage*100, '9.9' )#%] #space()# - #space()# TestBox: #space( 6 )# v#testbox.getVersion()# @@ -65,7 +55,6 @@ Labels: #space( 7 )# #arrayToList( results.getLabels() )# √ Passed #space( 2 )# - Skipped #space( 2 )# !! Exception/Error #space( 2 )# X Failure - @@ -79,54 +68,54 @@ Labels: #space( 7 )# #arrayToList( results.getLabels() )# + - - - - #tabs#( #getStatusIndicator( arguments.suiteStats.status )# ) #arguments.suiteStats.name# #chr(13)# + - - - - - - #tabsNext# ( #getStatusIndicator( local.thisSpec.status )#) #local.thisSpec.name# (#local.thisSpec.totalDuration# ms) #chr(13)# - - - - #space()# - #tabsNext# ! Failure: #local.thisSpec.failMessage# #local.thisSpec.failDetail# #chr(13)# - #space()# - - - - - #space()# - #tabsNext# X Error: #local.thisSpec.error.message# #local.thisSpec.error.detail# #chr(13)# - #space()# - - - - #tabsNext# -> #thisStack.template#:#thisStack.line# - - - #space()# - #left( local.thisSpec.error.stackTrace, 1500 )# #chr(13)##chr(13)# - #space()# - - - - - - - #genSuiteReport( local.nestedSuite, arguments.bundleStats, arguments.level + 1 )# - - + Suite Name - - + --->#tabs#( #getStatusIndicator( arguments.suiteStats.status )# ) #arguments.suiteStats.name# #chr(13)##tabsNext# ( #getStatusIndicator( local.thisSpec.status )# ) #local.thisSpec.name# (#local.thisSpec.totalDuration# ms) #chr(13)##space()##chr(13)##tabsNext# ! Failure: #local.thisSpec.failMessage# #local.thisSpec.failDetail# #chr(13)##space()##chr(13)##space()##chr(13)##tabsNext# X Error: #local.thisSpec.error.message# #local.thisSpec.error.detail# #chr(13)##space()##chr(13)##tabsNext# -> #thisStack.template#:#thisStack.line##chr(13)##space()##chr(13)##tabsNext# #left( local.thisSpec.error.stackTrace, 1500 )# #chr(13)##chr(10)##space()##chr(13)##genSuiteReport( local.nestedSuite, arguments.bundleStats, arguments.level + 1 )# + \ No newline at end of file diff --git a/system/reports/assets/text.cfm b/system/reports/assets/text.cfm index 3dfb89f..453623c 100644 --- a/system/reports/assets/text.cfm +++ b/system/reports/assets/text.cfm @@ -7,9 +7,7 @@ _____________________________________________________________ #getBundleIndicator( thisBundle )##thisBundle.path# (#thisBundle.totalDuration# ms) [Passed: #thisBundle.totalPass#] [Failed: #thisBundle.totalFail#] [Errors: #thisBundle.totalError#] [Skipped: #thisBundle.totalSkipped#] [Suites/Specs: #thisBundle.totalSuites#/#thisBundle.totalSpecs#] -#space()# - - +#space()# #space()# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -25,14 +23,9 @@ _____________________________________________________________ #space()# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - - - -#genSuiteReport( suiteStats, thisBundle )# - + +#genSuiteReport( suiteStats, thisBundle )# - #space()# #space()# @@ -41,7 +34,6 @@ Final Stats ================================================================================= #space()# [Passed: #results.getTotalPass()#] [Failed: #results.getTotalFail()#] [Errors: #results.getTotalError()#] [Skipped: #results.getTotalSkipped()#] [Bundles/Suites/Specs: #results.getTotalBundles()#/#results.getTotalSuites()#/#results.getTotalSpecs()#] - #space()# @@ -51,7 +43,6 @@ Code Coverage [Total Coverage: #numberFormat( results.getCoverageData().stats.percTotalCoverage*100, '9.9' )#%] #space()# - #space()# TestBox: #space( 6 )# v#testbox.getVersion()# @@ -62,59 +53,59 @@ Labels: #space( 7 )# #arrayToList( results.getLabels() )# √ Passed #space( 2 )# - Skipped #space( 2 )# !! Exception/Error #space( 2 )# X Failure - - + + - #tabs#( #getStatusIndicator( arguments.suiteStats.status )# ) #arguments.suiteStats.name# #chr(13)# + Suite Name - - - #tabsNext#( #getStatusIndicator( local.thisSpec.status )# ) #local.thisSpec.name# (#local.thisSpec.totalDuration# ms) #chr(13)# + --->#tabs#( #getStatusIndicator( arguments.suiteStats.status )# ) #arguments.suiteStats.name# #chr(13)# - - #space()# - #tabsNext# ! Failure: #local.thisSpec.failMessage# #local.thisSpec.failDetail# #chr(13)# - #space()# - + Specs - - - #space()# - #tabsNext# X Error: #local.thisSpec.error.message# #local.thisSpec.error.detail# #chr(13)# - #space()# - - - - #tabsNext# -> #thisStack.template#:#thisStack.line# - - - #space()# - #left( local.thisSpec.error.stackTrace, 1500 )# #chr(13)##chr(13)# - #space()# - - + --->#tabsNext#( #getStatusIndicator( local.thisSpec.status )# ) #local.thisSpec.name# (#local.thisSpec.totalDuration# ms) #chr(13)# - - - #genSuiteReport( local.nestedSuite, arguments.bundleStats, arguments.level + 1 )# - - + If Spec Failed + + --->#space()##tabsNext# ! Failure: #local.thisSpec.failMessage# #local.thisSpec.failDetail# #chr(13)# + #space()# +#space()# + #tabsNext# X Error: #local.thisSpec.error.message# #local.thisSpec.error.detail# #chr(13)##tabsNext#-> #thisStack.template#:#thisStack.line# + +#space()# +#left( local.thisSpec.error.stackTrace, 1500 )# #chr(13)##chr(13)# +#space()# +#genSuiteReport( local.nestedSuite, arguments.bundleStats, arguments.level + 1 )# From 97d3a2c33783338f70aeec4b6c9f1e6c4df6b812 Mon Sep 17 00:00:00 2001 From: robmarzialetti Date: Mon, 31 May 2021 22:04:43 +0200 Subject: [PATCH 06/15] Some item of array can be NULL With full null support, some item of array can be NULL. With this, the key "label" broker to loop. --- system/reports/assets/simple.cfm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/system/reports/assets/simple.cfm b/system/reports/assets/simple.cfm index 186d446..7b30d8c 100644 --- a/system/reports/assets/simple.cfm +++ b/system/reports/assets/simple.cfm @@ -282,8 +282,10 @@

The following data was collected in order as your tests ran via the debug() method:

-
#thisDebug.label#
- + +
#thisDebug.label#
+ +
@@ -628,4 +630,4 @@ code { - \ No newline at end of file + From a4a2bcb9bae2c46aba32a31fe978e404178de43b Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Wed, 2 Jun 2021 13:13:37 -0600 Subject: [PATCH 07/15] Fix chaining of `not` matchers #resolve TESTBOX-318 --- system/Expectation.cfc | 31 +++++++++++++++--------------- tests/specs/BDDInheritanceTest.cfc | 8 ++++++++ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/system/Expectation.cfc b/system/Expectation.cfc index 2a4f965..af38861 100644 --- a/system/Expectation.cfc +++ b/system/Expectation.cfc @@ -68,10 +68,7 @@ component accessors="true" { /** * Process dynamic expectations like any matcher starting with the word "not" is negated */ - function onMissingMethod( - required missingMethodName, - required missingMethodArguments - ){ + function onMissingMethod( required missingMethodName, required missingMethodArguments ){ // detect negation if ( left( arguments.missingMethodName, 3 ) eq "not" ) { // remove NOT @@ -80,18 +77,22 @@ component accessors="true" { len( arguments.missingMethodName ) - 3 ); // set isNot pivot on this matcher - this.isNot = true; + try { + this.isNot = true; - // execute the dynamic method - var results = invoke( - this, - arguments.missingMethodName, - arguments.missingMethodArguments - ); - if ( !isNull( results ) ) { - return results; - } else { - return; + // execute the dynamic method + var results = invoke( + this, + arguments.missingMethodName, + arguments.missingMethodArguments + ); + if ( !isNull( results ) ) { + return results; + } else { + return; + } + } finally { + this.isNot = false; } } diff --git a/tests/specs/BDDInheritanceTest.cfc b/tests/specs/BDDInheritanceTest.cfc index 0652cc6..5492cf2 100644 --- a/tests/specs/BDDInheritanceTest.cfc +++ b/tests/specs/BDDInheritanceTest.cfc @@ -62,6 +62,14 @@ component extends="testbox.system.BaseSpec" { expect( coldbox ).notToBe( 4 ); } ); + it( "can chain expectations", function(){ + expect( 8 ) + .toBeTypeOf( "numeric" ) + .toBeNumeric() + .notToBe( 4 ) + .toBeCloseTo( expected = 10, delta = 2 ); + } ); + // negations it( "can have negative expectations", function(){ coldbox = coldbox * 8; From 7d161e486ce280be3184a22ae7f13a6cbf5d5364 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 2 Jun 2021 15:32:20 -0500 Subject: [PATCH 08/15] TESTBOX-319 #resolve Fix HTTP Status Headers Being Removed By Reporters when resetting html head --- system/TestBox.cfc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/system/TestBox.cfc b/system/TestBox.cfc index c470cec..f2f8a28 100644 --- a/system/TestBox.cfc +++ b/system/TestBox.cfc @@ -167,11 +167,15 @@ component accessors="true" { variables.reporter = arguments.reporter; } // run it and get results - var results = runRaw( argumentCollection = arguments ); + var results = runRaw( argumentCollection = arguments ); // store latest results variables.result = results; // return report - return produceReport( results ); + var report = produceReport( results ); + // set response headers + sendStatusHeaders( results ); + + return report; } /** @@ -305,8 +309,6 @@ component accessors="true" { coverageService.endCapture( true ); - sendStatusHeaders( results ); - return results; } @@ -382,11 +384,10 @@ component accessors="true" { // run it and get results var results = runRaw( argumentCollection = arguments ); - // check if reporter is "raw" and if raw, just return it + // check if reporter is "raw" and if raw, just return it else output the results if ( variables.reporter.type == "raw" ) { return produceReport( results ); } else { - // return report writeOutput( produceReport( results ) ); } From 6b0872a1d277ee5580095565b231c31679f19e7f Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 2 Jun 2021 15:43:19 -0500 Subject: [PATCH 09/15] TESTBOX-315 #resolve ConsoleReporter fails with missing functions in assets/text TESTBOX-313 #resolve No matching function [SPACE] found --- system/reports/ConsoleReporter.cfc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/system/reports/ConsoleReporter.cfc b/system/reports/ConsoleReporter.cfc index c401576..5742cf2 100644 --- a/system/reports/ConsoleReporter.cfc +++ b/system/reports/ConsoleReporter.cfc @@ -2,9 +2,9 @@ * Copyright Since 2005 TestBox Framework by Luis Majano and Ortus Solutions, Corp * www.ortussolutions.com * --- - * A text reporter + * A text reporter that emits to the console via java System out. */ -component extends="BaseReporter" { +component extends="TextReporter" { function init(){ variables.out = createObject( "Java", "java.lang.System" ).out; @@ -41,14 +41,18 @@ component extends="BaseReporter" { // bundle stats variables.bundleStats = arguments.results.getBundleStats(); - // prepare the report savecontent variable="local.report" { include "assets/text.cfm"; } // send to console - variables.out.printLn( local.report ); + variables.out.printLn( reReplace( + trim( local.report ), + "[\r\n]+", + chr( 10 ), + "all" + ) ); return "Report Sent To Console"; } From 8e1f63e131a2bbe8531d344e8db98c26372b78cd Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 2 Jun 2021 15:58:18 -0500 Subject: [PATCH 10/15] TESTBOX-301 #resolve notToBeBetween seems to be the same as toBeBetween --- system/Expectation.cfc | 41 ++++++++++++------------------------ tests/specs/BetweenTests.cfc | 36 +++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 27 deletions(-) create mode 100644 tests/specs/BetweenTests.cfc diff --git a/system/Expectation.cfc b/system/Expectation.cfc index af38861..c49e6a8 100644 --- a/system/Expectation.cfc +++ b/system/Expectation.cfc @@ -104,22 +104,15 @@ component accessors="true" { ) ) { // remove the toBe to get the type. - var type = right( - arguments.missingMethodName, - len( arguments.missingMethodName ) - 4 - ); + var type = right( arguments.missingMethodName, len( arguments.missingMethodName ) - 4 ); // detect incoming message var message = ( - structKeyExists( - arguments.missingMethodArguments, - "message" - ) ? arguments.missingMethodArguments.message : "" + structKeyExists( arguments.missingMethodArguments, "message" ) ? arguments.missingMethodArguments.message : "" ); message = ( - structKeyExists( - arguments.missingMethodArguments, - "1" - ) ? arguments.missingMethodArguments[ 1 ] : message + structKeyExists( arguments.missingMethodArguments, "1" ) ? arguments.missingMethodArguments[ + 1 + ] : message ); // execute the method return toBeTypeOf( type = type, message = message ); @@ -199,10 +192,7 @@ component accessors="true" { * @expected The expected data * @message The message to send in the failure */ - function toBeWithCase( - required string expected, - message = "" - ){ + function toBeWithCase( required string expected, message = "" ){ arguments.actual = this.actual; if ( this.isNot ) { variables.assert.isNotEqual( argumentCollection = arguments ); @@ -241,10 +231,7 @@ component accessors="true" { * @typeName The typename to check * @message The message to send in the failure */ - function toBeInstanceOf( - required string typeName, - message = "" - ){ + function toBeInstanceOf( required string typeName, message = "" ){ arguments.actual = this.actual; if ( this.isNot ) { variables.assert.notInstanceOf( argumentCollection = arguments ); @@ -366,11 +353,7 @@ component accessors="true" { * @regex Match this regex against the message of the exception * @message The message to send in the failure */ - function toThrow( - type = "", - regex = ".*", - message = "" - ){ + function toThrow( type = "", regex = ".*", message = "" ){ arguments.target = this.actual; if ( this.isNot ) { variables.assert.notThrows( argumentCollection = arguments ); @@ -423,15 +406,19 @@ component accessors="true" { ){ arguments.actual = this.actual; if ( this.isNot ) { + var pass = false; try { variables.assert.between( argumentCollection = arguments ); + } catch ( Any e ) { + pass = true + } + if ( !pass ) { arguments.message = ( len( arguments.message ) ? arguments.message : "The actual [#this.actual#] is actually between [#arguments.min#] and [#arguments.max#]" ); variables.assert.fail( arguments.message ); - } catch ( Any e ) { - return this; } + return this; } else { variables.assert.between( argumentCollection = arguments ); } diff --git a/tests/specs/BetweenTests.cfc b/tests/specs/BetweenTests.cfc new file mode 100644 index 0000000..edb1521 --- /dev/null +++ b/tests/specs/BetweenTests.cfc @@ -0,0 +1,36 @@ +component extends=testbox.system.BaseSpec { + + function run(){ + describe( "Tests of TestBox behaviour", function(){ + it( "rejects 5 as being between 1 and 10", function(){ + expect( function(){ + expect( 5 ).notToBeBetween( 1, 10 ); + } ).toThrow(); + } ); + + it( "rejects 10 as being between 1 and 10", function(){ + expect( function(){ + expect( 10 ).notToBeBetween( 1, 10 ); + } ).toThrow(); + } ); + + it( "rejects 15 as being between 1 and 10", function(){ + expect( 15 ).notToBeBetween( 1, 10 ); + } ); + + it( "accepts 1 as being between 1 and 10", function(){ + expect( 1 ).toBeBetween( 1, 10 ); + } ); + + it( "accepts 5 as being between 1 and 10", function(){ + expect( 5 ).toBeBetween( 1, 10 ); + } ); + + it( "accepts 10 as being between 1 and 10", function(){ + expect( 10 ).toBeBetween( 1, 10 ); + } ); + } ); + } + +} + From 2335ae0257a72a41735661e9973a9b8b6c79b0a7 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 2 Jun 2021 16:04:23 -0500 Subject: [PATCH 11/15] acf compat --- system/Expectation.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Expectation.cfc b/system/Expectation.cfc index c49e6a8..c127dc7 100644 --- a/system/Expectation.cfc +++ b/system/Expectation.cfc @@ -410,7 +410,7 @@ component accessors="true" { try { variables.assert.between( argumentCollection = arguments ); } catch ( Any e ) { - pass = true + pass = true; } if ( !pass ) { arguments.message = ( From ee18f4a7892a0a77616bf15528ed13a3994a8a23 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 11 Jun 2021 11:01:42 -0500 Subject: [PATCH 12/15] adding skip messages --- system/reports/assets/simple.cfm | 6 +++++- tests/specs/BDDTest.cfc | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/system/reports/assets/simple.cfm b/system/reports/assets/simple.cfm index 7b30d8c..c3fa9c3 100644 --- a/system/reports/assets/simple.cfm +++ b/system/reports/assets/simple.cfm @@ -496,7 +496,11 @@ code { -
  • +
  • Date: Wed, 16 Jun 2021 10:37:48 -0500 Subject: [PATCH 13/15] adding more tests to test xml output formatting --- tests/specs/BDDTest.cfc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/specs/BDDTest.cfc b/tests/specs/BDDTest.cfc index 4664a20..0b3fc22 100644 --- a/tests/specs/BDDTest.cfc +++ b/tests/specs/BDDTest.cfc @@ -44,6 +44,11 @@ component extends="testbox.system.BaseSpec" { foo = 0; } ); + describe( "A nice /suite/with/slashes", function(){ + it( "can have slashes/inthe/it", function(){ + expect( true ).toBeTrue(); + }); + }); it( "can match strings with no case sensitivity", function(){ expect( "Luis" ).toMatch( "^luis" ); From a5639a795cba607ded4b3254dfcac7a9ae355b26 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 16 Jun 2021 10:53:51 -0500 Subject: [PATCH 14/15] TESTBOX-320 #resolve Runner tries to instantiate abstract classes --- system/TestBox.cfc | 31 ++++++++++++++++++++++++++----- tests/specs/AbstractClass.cfc | 11 +++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 tests/specs/AbstractClass.cfc diff --git a/system/TestBox.cfc b/system/TestBox.cfc index f2f8a28..5b4293f 100644 --- a/system/TestBox.cfc +++ b/system/TestBox.cfc @@ -276,6 +276,7 @@ component accessors="true" { if ( getComponentMetadata( thisBundlePath ).type eq "interface" ) { continue; } + // Execute Bundle testBundle( bundlePath = thisBundlePath, @@ -546,6 +547,8 @@ component accessors="true" { * @bundlePath The path of the Bundle CFC to test. * @testResults The testing results object to keep track of results * @callbacks The callbacks struct or CFC + * + * @throws BundleRunnerMajorException */ private function testBundle( required bundlePath, @@ -553,7 +556,12 @@ component accessors="true" { required callbacks ){ // create new target bundle and get its metadata - var target = getBundle( arguments.bundlePath ); + try{ + var target = getBundle( arguments.bundlePath ); + } catch( "AbstractComponentException" e ){ + // Skip abstract components + return this; + } // verify call backs if ( structKeyExists( arguments.callbacks, "onBundleStart" ) ) { @@ -604,13 +612,26 @@ component accessors="true" { /** * Creates and returns a bundle CFC with spec capabilities if not inherited. + * * @bundlePath The path to the Bundle CFC + * + * @throws AbstractComponentException - When an abstract component exists as a spec */ private any function getBundle( required bundlePath ){ - var bundle = createObject( - "component", - "#arguments.bundlePath#" - ); + try{ + var bundle = createObject( + "component", + "#arguments.bundlePath#" + ); + } catch( "Application" e ){ + if( findNoCase( "abstract component", e.message ) ){ + throw( + type : "AbstractComponentException", + message : "Skip abstract components" + ); + } + rethrow; + } var familyPath = "testbox.system.BaseSpec"; // check if base spec assigned diff --git a/tests/specs/AbstractClass.cfc b/tests/specs/AbstractClass.cfc new file mode 100644 index 0000000..8277349 --- /dev/null +++ b/tests/specs/AbstractClass.cfc @@ -0,0 +1,11 @@ +abstract component{ + + function init(){ + // This is an abstract class + } + + function run(){ + + } + +} \ No newline at end of file From ba63107d5e86028c82f94f368242639b64174fc3 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 16 Jun 2021 11:02:32 -0500 Subject: [PATCH 15/15] added latest changelog --- changelog.md | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/changelog.md b/changelog.md index eab5960..f267b6d 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ---- +## [4.4.0] => 2021-JUN-16 + +### Fixed + +- [TESTBOX-320](https://ortussolutions.atlassian.net/browse/TESTBOX-320) Runner tries to instantiate abstract classes +- [TESTBOX-319](https://ortussolutions.atlassian.net/browse/TESTBOX-319) Fix HTTP Status Headers Being Removed By Reporters when resetting html head +- [TESTBOX-318](https://ortussolutions.atlassian.net/browse/TESTBOX-318) Chaining "not" matchers before regular matchers doesn't work correctly +- [TESTBOX-316](https://ortussolutions.atlassian.net/browse/TESTBOX-316) Coverage output doesn't escape ending script tag +- [TESTBOX-315](https://ortussolutions.atlassian.net/browse/TESTBOX-315) ConsoleReporter fails with missing functions in assets/text +- [TESTBOX-313](https://ortussolutions.atlassian.net/browse/TESTBOX-313) No matching function \[SPACE\] found +- [TESTBOX-311](https://ortussolutions.atlassian.net/browse/TESTBOX-311) CF error variable \[THISBUNDLE\] doesn't exist when running tests + +### Changed + +- [TESTBOX-317](https://ortussolutions.atlassian.net/browse/TESTBOX-317) Full Null Support Some items of array can be NULL +- [TESTBOX-314](https://ortussolutions.atlassian.net/browse/TESTBOX-314) text and min text whitespace management +- [TESTBOX-301](https://ortussolutions.atlassian.net/browse/TESTBOX-301) notToBeBetween seems to be the same as toBeBetween + +---- + ## [4.3.1] => 2021-MAY-25 ### Fixed @@ -43,7 +63,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -* [TESTBOX-294](https://ortussolutions.atlassian.net/browse/TESTBOX-294) - root path in test browser not enforced +- [TESTBOX-294](https://ortussolutions.atlassian.net/browse/TESTBOX-294) - root path in test browser not enforced ---- @@ -51,13 +71,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -* [TESTBOX-281](https://ortussolutions.atlassian.net/browse/TESTBOX-281) - request.testbox: Component ... has no accessible Member with name [$TESTID] -* [TESTBOX-290](https://ortussolutions.atlassian.net/browse/TESTBOX-290) - Turning on "Prefix serialized JSON with" in ACF causes issues in code coverage report -* [TESTBOX-293](https://ortussolutions.atlassian.net/browse/TESTBOX-293) - Force properties file to have properties extension and escape special chars +- [TESTBOX-281](https://ortussolutions.atlassian.net/browse/TESTBOX-281) - request.testbox: Component ... has no accessible Member with name [$TESTID] +- [TESTBOX-290](https://ortussolutions.atlassian.net/browse/TESTBOX-290) - Turning on "Prefix serialized JSON with" in ACF causes issues in code coverage report +- [TESTBOX-293](https://ortussolutions.atlassian.net/browse/TESTBOX-293) - Force properties file to have properties extension and escape special chars ### Added -* [TESTBOX-291](https://ortussolutions.atlassian.net/browse/TESTBOX-291) - refactor usage of locks for debug utility in specs +- [TESTBOX-291](https://ortussolutions.atlassian.net/browse/TESTBOX-291) - refactor usage of locks for debug utility in specs ---- @@ -65,12 +85,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -* [TESTBOX-283] - Fix type on test results for bundlestats -* [TESTBOX-286] - `DebugBuffer` was being removed instead of resetting to empty for `getMemento` -* [TESTBOX-281] - `request.testbox` Component ... has no accessible Member with name [$TESTID] +- [TESTBOX-283] - Fix type on test results for bundlestats +- [TESTBOX-286] - `DebugBuffer` was being removed instead of resetting to empty for `getMemento` +- [TESTBOX-281] - `request.testbox` Component ... has no accessible Member with name [$TESTID] ### Added -* [TESTBOX-282] - Added cfml engine and version as part of the test results as properties -* [TESTBOX-284] - Update all reporters so they can just build and return the report with no content type or context repsonse resets -* [TESTBOX-285] - make `buildReporter` public in the testbox core +- [TESTBOX-282] - Added cfml engine and version as part of the test results as properties +- [TESTBOX-284] - Update all reporters so they can just build and return the report with no content type or context repsonse resets +- [TESTBOX-285] - make `buildReporter` public in the testbox core