Created
June 28, 2016 10:56
-
-
Save aliaspooryorik/ba165f1c7d3cfd95fe6a8fe0b52a038f to your computer and use it in GitHub Desktop.
testbox runner
This file contains hidden or 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
<cfsetting showDebugOutput="false" enablecfoutputonly="true" requesttimeout="36000"> | |
<cfparam name="url.reporter" default="simple"> | |
<cfparam name="url.directory" default="unittests"> | |
<cfparam name="url.recurse" default="true"> | |
<cfparam name="url.labels" default=""> | |
<cfparam name="url.bundles" default=""> | |
<cfparam name="url.reportpath" default="#GetDirectoryFromPath(getCurrentTemplatePath())#"> | |
<cfparam name="url.propertiesFilename" default="TEST.properties"> | |
<cfparam name="url.propertiesSummary" default="false"> | |
<cfset runner = new testbox.system.TestBox(directory={mapping=url.directory, recurse=url.recurse}, labels=url.labels)> | |
<cfset results = runner.run(reporter=url.reporter)> | |
<cfif url.propertiesSummary> | |
<cfset testResult = runner.getResult()> | |
<cfset errors = testResult.getTotalFail() + testResult.getTotalError()> | |
<cfsavecontent variable="propertiesReport"><cfoutput><cfif errors>test.failed=true<cfelse>test.passed=true</cfif> | |
test.labels=#arrayToList(testResult.getLabels())# | |
test.bundles=#URL.bundles# | |
test.directory=#url.directory# | |
total.bundles=#testResult.getTotalBundles()# | |
total.suites=#testResult.getTotalSuites()# | |
total.specs=#testResult.getTotalSpecs()# | |
total.pass=#testResult.getTotalPass()# | |
total.fail=#testResult.getTotalFail()# | |
total.error=#testResult.getTotalError()# | |
total.skipped=#testResult.getTotalSkipped()#</cfoutput></cfsavecontent> | |
<cfset fileWrite(url.reportpath & "/" & url.propertiesFilename, propertiesReport)> | |
</cfif> | |
<cfif url.reporter eq "ANTJunit"> | |
<!--- Produce individual test files due to how ANT JUnit report parses these. ---> | |
<cfset xmlReport = xmlParse(results)> | |
<cfloop array="#xmlReport.testsuites.XMLChildren#" index="thisSuite"> | |
<cfset fileWrite(url.reportpath & "/TEST-" & thisSuite.XMLAttributes.package & ".xml", toString(thisSuite))> | |
</cfloop> | |
</cfif> | |
<cfoutput>#results#</cfoutput> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment