假设我在 FitNesse 套件中有以下类路径定义:
!*> '''Classpath'''
!path /home/stewart/white space test/example-1.0.0-SNAPSHOT/target/test-classes
!path /home/stewart/white space test/example-1.0.0-SNAPSHOT/target/classes
!path /home/stewart/.m2/repository/org/fitnesse/fitnesse/20121220/fitnesse-20121220.jar
*!
我尝试了以下引用或转义形式:
- 香草空白:
!path /home/stewart/white space test/example-1.0.0-SNAPSHOT/target/classes
- 反斜杠:
!path /home/stewart/white\ space\ test/example-1.0.0-SNAPSHOT/target/classes
- 双反斜杠:
!path /home/stewart/white\\ space\\ test/example-1.0.0-SNAPSHOT/target/classes
- 双引号:!path
"/home/stewart/white space test/example-1.0.0-SNAPSHOT/target/classes"
- 单引号:!path
'/home/stewart/white space test/example-1.0.0-SNAPSHOT/target/classes'
- % 编码:
!path /home/stewart/white%20space%20test/example-1.0.0-SNAPSHOT/target/classes
- 使用 + 的:
!path /home/stewart/white+space+test/example-1.0.0-SNAPSHOT/target/classes
- Unicode 序列:
!path /home/stewart/white\u0020space\u0020test/example-1.0.0-SNAPSHOT/target/classes
- 带有额外反斜杠的 Unicode 序列:
!path /home/stewart/white\\u0020space\\u0020test/example-1.0.0-SNAPSHOT/target/classes
- 通配符:
!path /home/stewart/white*space*test/example-1.0.0-SNAPSHOT/target/classes
- FitNesse wiki 转义:
!path !-/home/stewart/white space test/example-1.0.0-SNAPSHOT/target/classes-!
使用香草空格和一些引用的空格,测试根本不运行,我得到错误:
Could not find or load main class space
根据错误日志,FitNesse 正试图用引号转义空格。FitServer
它使用以下命令调用:
java -cp fitnesse.jar:"/home/stewart/white space test/example-1.0.0-SNAPSHOT/target/test-classes":"/home/stewart/white space test/example-1.0.0-SNAPSHOT/target/classes":/home/stewart/.m2/repository/org/fitnesse/fitnesse/20121220/fitnesse-20121220.jar fit.FitServer linux-desktop 9123 10
由于某些转义测试确实运行,但它们失败了,因为 FitNesse 无法在类路径上找到固定装置,我认为这意味着空白(+、%20、\u0020 等)的替代品没有被解析为空白,但作为路径文字。
我开始认为在 FitNesse 中不可能做到这一点......
更新:我还尝试使用COMMAND_PATTERN
和CLASSPATH_PROPERTY
FitNesse 变量进行试验,详见有关自定义测试执行的文档
FitNesse 版本为 20121220。