gpt4 book ai didi

unit-testing - Coldfusion - 找不到测试箱

转载 作者:行者123 更新时间:2023-12-04 04:15:10 25 4
gpt4 key购买 nike

我有一个 coldfusion 应用程序,我想开始为其编写单元测试。我找到了 testbox,并认为它会是一个很好用的测试库。我关注了installation instructions ,但是当我尝试运行我的第一个测试时,我的冷聚变应用程序抛出错误。我下载了 zip 文件并放入我的 C 盘,将映射添加到我的 application.cfc,但它抛出以下错误(见下文)。谁能帮我调试为什么找不到文本框?

错误

Invalid CFML construct found on line 2 at column 1.
ColdFusion was looking at the following text:
testbox


The error occurred in C:/inetpub/wwwroot/tests/main.cfc: line 2
1 : // Create TestBox object
2 : testbox = new testbox.system.TestBox();
3 : ​
4 : // You can add fluent specs via addDirectory(), addDirectories(), addBundles()

应用程序.cfc

component {
this.name = "A TestBox Runner Suite " & hash( getCurrentTemplatePath() );
// any other application.cfc stuff goes below:
this.sessionManagement = true;

// any mappings go here, we create one that points to the root called test.
this.mappings[ "/tests" ] = getDirectoryFromPath( getCurrentTemplatePath() );
// Map back to its root
this.mappings[ "/testbox" ] = expandPath( "C:/testbox/" );

// any orm definitions go here.

// request start
public boolean function onRequestStart( String targetPage ){
return true;
}
}

主.cfc

// Create TestBox object
testbox = new testbox.system.TestBox();

// You can add fluent specs via addDirectory(), addDirectories(), addBundles()
testbox.addDirectory( "specs" );

// Run tests and produce reporter results
testbox.run()

// Run tests and get raw testbox.system.TestResults object
testbox.runRaw()

// Run tests and produce reporter results from SOAP, REST, HTTP
testbox.runRemote()

测试箱目录。 enter image description here

最佳答案

尝试将映射更改为 C:\testbox\testbox\ ,或将 \testbox\testbox 文件夹的内容上移一级。我认为您可能解压缩到太多文件夹。第二个testbox 文件夹中是否有system 文件夹?您希望确保映射指向包含实际 TestBox 文件的文件夹。

关于unit-testing - Coldfusion - 找不到测试箱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52445888/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com