Skip to content

Instantly share code, notes, and snippets.

@adamcameron
Created May 18, 2022 19:33
Show Gist options
  • Save adamcameron/838b30252bb0a390bdf324a8ab10b753 to your computer and use it in GitHub Desktop.
Save adamcameron/838b30252bb0a390bdf324a8ab10b753 to your computer and use it in GitHub Desktop.
Harness to pull in all the test Gists from github and then run them on trycf.com
<cfscript>
cfhttp(
method = "get",
url = "https://gist.githubusercontent.com/adamcameron/816ce84fd991c2682df612dbaf1cad11/raw/tinyTestFramework.cfm",
result = "frameworkCodeResponse",
throwOnError = true
);
frameworkCode = frameworkCodeResponse.fileContent;
testSuites = [
"Tests for misc functions that don't fit another category" = {
guid = "332e3cda31fa933cfe3a783be07bc59e",
file = "ttfOtherFunctionsTest.cfm"
},
"Tests for matcher functions" = {
guid = "b006d2c420dd4cbe369b6c809c15ea83",
file = "ttfMatcherFunctionsTest.cfm"
},
"Tests for lifecycle functions" = {
guid = "f93c3e12885f2913bfc8351ba1ed8911",
file = "ttfLifeCycleFunctionsTest.cfm"
}
]
engineUrls = [
"ColdFusion 2021" = "https://acf14-sbx.trycf.com/getremote.cfm",
"Lucee 5" = "https://lucee5-sbx.trycf.com/lucee5/getremote.cfm"
]
writeOutput('<div class="tinyTest">');
testSuites.each((label, suite) => {
writeOutput("<h3>#label#</h3>");
cfhttp(
method = "get",
url = "https://gist.githubusercontent.com/adamcameron/#suite.guid#/raw/#suite.file#",
result = "testCodeResponse",
throwOnError = true
);
testCode = testCodeResponse.fileContent;
engineUrls.each((engine, engineUrl) => {
cfhttp(method="post", url=engineUrl, result="testRunResponse") {
cfhttpparam(type="formField", name="setupcode", value=frameworkCode);
cfhttpparam(type="formField", name="code", value=testCode);
cfhttpparam(type="formField", name="asserts", value="");
}
writeOutput("<h4>#engine#</h4>");
writeOutput(testRunResponse.fileContent)
writeOutput("<hr>")
})
})
writeOutput("</div>")
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment