-
Notifications
You must be signed in to change notification settings - Fork 348
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
3 changed files
with
44 additions
and
26 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
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,24 +1,36 @@ | ||
<cfscript> | ||
function exitCode( required numeric code ) { | ||
var exitcodeFile = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "/.exitcode"; | ||
FileWrite( exitcodeFile, code ); | ||
if (code == 1) { | ||
cfheader(statuscode="500",statustext="Tests Failed"); | ||
} | ||
} | ||
try { | ||
reporter = cgi.server_protocol == "CLI/1.0" ? "text" : "simple"; | ||
testbox = new testbox.system.TestBox( options={}, reporter=reporter, directory={ | ||
recurse = true | ||
, mapping = "tests" | ||
, filter = function( required path ){ return true; } | ||
} ); | ||
writeOutput( testbox.run() ); | ||
resultObject = testbox.getResult(); | ||
errors = resultObject.getTotalFail() + resultObject.getTotalError(); | ||
exitCode( errors ? 1 : 0 ); | ||
} catch ( any e ) { | ||
writeOutput( "An error occurred running the tests. Message: [#e.message#], Detail: [#e.detail#]" ); | ||
exitCode( 1 ); | ||
} | ||
</cfscript> | ||
<cfparam name="url.reporter" default="simple" type="variablename"> | ||
<cfset plainText = url.reporter IS "text" OR url.reporter IS "mintext"> | ||
<cfsetting requesttimeout="150" enablecfoutputonly="#plainText#"> | ||
<cfif plainText> | ||
<cfcontent type="text/plain"> | ||
</cfif> | ||
|
||
<strong>Test Environment</strong>: | ||
<cfif server.coldfusion.productname contains "ColdFusion"> | ||
<cfoutput>Adobe ColdFusion #server.coldfusion.productversion#</cfoutput> | ||
<cfelseif structKeyExists(server, "lucee")> | ||
<cfoutput>Lucee #server.lucee.version#</cfoutput> | ||
<cfelseif structKeyExists(server, "railo")> | ||
<cfoutput>Railo #server.railo.version#</cfoutput> | ||
<cfelse> | ||
<cfoutput>#server.coldfusion.productname#</cfoutput> | ||
</cfif> | ||
<cfoutput> on #server.os.name# #server.os.version#</cfoutput> | ||
<cfset system = createObject("java", "java.lang.System")> | ||
<cfoutput> running Java #system.getProperty("java.version")# | ||
|
||
</cfoutput> | ||
|
||
<cfset r = new testbox.system.TestBox( directory="tests", reporter=url.reporter ) > | ||
<cfoutput>#r.run()#</cfoutput> | ||
<cfset resultObject = r.getResult()> | ||
<cfset errors = resultObject.getTotalFail() + resultObject.getTotalError()> | ||
<cfif errors GT 0> | ||
<cfheader statuscode="500" statustext="Tests Failed"> | ||
</cfif> | ||
|
||
<cfif NOT plainText> | ||
<cfoutput> | ||
<a href="run.cfm?ts=#GetTickCount()#">ReRun</a> | ||
</cfoutput> | ||
</cfif> |
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