Skip to content

Instantly share code, notes, and snippets.

@jamiejackson
Created April 22, 2016 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamiejackson/98236d89e47f8e2bcced9d0234537a3c to your computer and use it in GitHub Desktop.
Save jamiejackson/98236d89e47f8e2bcced9d0234537a3c to your computer and use it in GitHub Desktop.
custom testbox runner (failing) attempt
/**
********************************************************************************
Copyright Since 2005 TestBox Framework by Luis Majano and Ortus Solutions, Corp
www.coldbox.org | www.ortussolutions.com
********************************************************************************
* A simple HTML reporter
*/
component
accessors=true
{
// property name="displayTemplate" type="string";
function init(
// required string displayTemplate
){
// this.setDisplayTemplate( displayTemplate );
// writeLog("init: " & getCurrentTemplatePath());
return this;
}
/**
* Get the name of the reporter
*/
function getName(){
return "CustomizableHtml";
}
/**
* Do the reporting thing here using the incoming test results
* The report should return back in whatever format they desire and should set any
* Specifc browser types if needed.
* @results.hint The instance of the TestBox TestResult object to build a report on
* @testbox.hint The TestBox core object
* @options.hint A structure of options this reporter needs to build the report with
*/
any function runReport(
required testbox.system.TestResult results,
required testbox.system.TestBox testbox,
struct options={}
){
// content type
getPageContext().getResponse().setContentType( "text/html" );
// bundle stats
bundleStats = arguments.results.getBundleStats();
// prepare base links
baseURL = "?";
if( structKeyExists( url, "method") ){ baseURL&= "method=#URLEncodedFormat( url.method )#"; }
if( structKeyExists( url, "output") ){ baseURL&= "output=#URLEncodedFormat( url.output )#"; }
// prepare incoming params
if( !structKeyExists( url, "testMethod") ){ url.testMethod = ""; }
if( !structKeyExists( url, "testSpecs") ){ url.testSpecs = ""; }
if( !structKeyExists( url, "testSuites") ){ url.testSuites = ""; }
if( !structKeyExists( url, "testBundles") ){ url.testBundles = ""; }
// prepare the report
writeLog(getCurrentTemplatePath());
savecontent variable="local.report"{
// include this.getDisplayTemplate();
"/lib/testbox/system/reports/assets/simple.cfm"
}
return local.report;
}
}
...
testSuite = createObject( "component", "mxunit.framework.TestSuite" ).TestSuite();
reporter = new lib.com.icfi.testbox.system.reports.CustomizableHtmlReporter(
displayTemplate = "foo" // not really used yet
);
tb = new testbox.system.TestBox(reporter=reporter);
results = tb.run(bundles=url.selectedTests);
...
Lucee 4.5.2.018 Error (expression)
Message Component [lib.com.icfi.testbox.system.reports.CustomizableHtmlReporter] has no accessible Member with name [TYPE]
Detail enable [trigger data member] in admininistrator to also invoke getters and setters
Stacktrace The Error Occurred in
/var/www/vmhost/apps/project/cfml/deployment_root/lib/testbox/system/TestBox.cfc: line 298
296: // Do we have reporter type and options
297: if( isStruct( variables.reporter ) ){
298: iData.type = buildReporter( variables.reporter.type );
299: if( structKeyExists( variables.reporter, "options" ) ){
300: iData.options = variables.reporter.options;
called from /var/www/vmhost/apps/project/cfml/deployment_root/lib/testbox/system/TestBox.cfc: line 100
called from /var/www/vmhost/apps/project/cfml/deployment_root/wwwroot/test/runner.cfm: line 164
Java Stacktrace Component [lib.com.icfi.testbox.system.reports.CustomizableHtmlReporter] has no accessible Member with name [TYPE]
at lucee.runtime.ComponentImpl.get(ComponentImpl.java:1633):1633
at lucee.runtime.util.VariableUtilImpl.get(VariableUtilImpl.java:255):255
at lucee.runtime.PageContextImpl.get(PageContextImpl.java:1436):1436
at system.testbox_cfc$cf.udfCall1(/var/www/vmhost/apps/project/cfml/deployment_root/lib/testbox/system/TestBox.cfc:298):298
at system.testbox_cfc$cf.udfCall(/var/www/vmhost/apps/project/cfml/deployment_root/lib/testbox/system/TestBox.cfc):-1
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:229):229
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:766):766
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:742):742
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1590):1590
at system.testbox_cfc$cf.udfCall1(/var/www/vmhost/apps/project/cfml/deployment_root/lib/testbox/system/TestBox.cfc:100):100
at system.testbox_cfc$cf.udfCall(/var/www/vmhost/apps/project/cfml/deployment_root/lib/testbox/system/TestBox.cfc):-1
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:643):643
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1778):1778
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:773):773
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1600):1600
at test.runner_cfm$cf.call(/var/www/vmhost/apps/project/cfml/deployment_root/wwwroot/test/runner.cfm:164):164
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:951):951
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:903):903
at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:223):223
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:35):35
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2262):2262
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2225):2225
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:456):456
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:47):47
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729):729
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291):291
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206):206
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52):52
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239):239
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206):206
at org.apache.catalina.filters.RemoteIpFilter.doFilter(RemoteIpFilter.java:892):892
at org.apache.catalina.filters.RemoteIpFilter.doFilter(RemoteIpFilter.java:928):928
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239):239
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206):206
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217):217
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106):106
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502):502
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142):142
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79):79
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88):88
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518):518
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091):1091
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673):673
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500):1500
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456):1456
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142):1142
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617):617
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61):61
at java.lang.Thread.run(Thread.java:745):745
Timestamp 4/22/16 8:53:09 AM CDT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment