Fitnesse 无法在 Java 中引用外部 API?

发布于 2024-10-05 14:27:10 字数 264 浏览 0 评论 0原文

Fitnesse 无法测试我的应用程序。 我正在研究 Java,并在类路径中定义了三件事: 1)fitnesse.jar的路径 2)我的代码需要的另一个jar文件(xstream.jar)的路径。 (这个 jar 也包含在我的项目的构建路径中)。 3)我的fixture类的类路径。

Fitnesse 显示“java.lang.NoClassDefFoundError: com/thoughtworks/xstream/XStream ” 谁能帮忙,这件事真的让我的整个工作陷入困境!

fitnesse is not able to test my application.
I am working on Java and have defined three things in the class path :
1) path to fitnesse.jar
2) path to another jar file(xstream.jar) which my code requires. (this jar is included in the build path of my project also).
3) class path of my fixture class.

Fitnesse is showing "java.lang.NoClassDefFoundError: com/thoughtworks/xstream/XStream
"
can anyone please help, this thing has really made my whole work stuck up !!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

日裸衫吸 2024-10-12 14:27:10

我最近也遇到了类似的问题。我的解决方案是设置正确的工作目录。我使用以下启动蝙蝠完成了这项工作:

call java -DBaseDir=D:\MyBaseDir -DmyPath=D:\MyBaseDir\someSubDirs\bin -DmyLibraryPath="%PATH%;.;D:\MyBaseDir\someSubDirs\lib" -jar D:\MyBaseDir\Fitnesse\fitnesse.jar -d D:\MyBaseDir\Fitnesse\ -r MySuite -p 8080

请注意启动参数:-d 用于工作目录。也许这会让您进一步了解去哪里寻找。

I had recentley similar problems. My resolution was to set the correct working dir. I got this work with use of the followin start bat:

call java -DBaseDir=D:\MyBaseDir -DmyPath=D:\MyBaseDir\someSubDirs\bin -DmyLibraryPath="%PATH%;.;D:\MyBaseDir\someSubDirs\lib" -jar D:\MyBaseDir\Fitnesse\fitnesse.jar -d D:\MyBaseDir\Fitnesse\ -r MySuite -p 8080

Be aware of the start parameters: -d is used for the working dir. Perhaps this gives you some further idea where to look.

原来是傀儡 2024-10-12 14:27:10

它没有在您的 CLASSPATH 中找到 xstream 库,您需要仔细检查 Fitnesse 是否正在选择它。

It's not finding the xstream lib in your CLASSPATH, you'll need to double check that Fitnesse is picking that up.

老旧海报 2024-10-12 14:27:10

不确定错误的原因,但我通过使用 testifywizard 在 FitNesse 上取得了良好的开端设置一个测试项目并随后复制 FitNesse 位。

Not sure about the reason for your errors, but I got a good start with FitNesse by using testifywizard to set up a testproject and copy the FitNesse bits afterwards.

孤独岁月 2024-10-12 14:27:10

我认为这就是您在 FitNesse 中定义类路径的方式(注意 poc 之前的 \):

!path D:\poc\lib\xstream.jar 

确保 D:\poc\lib 文件夹中确实有 xstream.jar。但是您不需要在类路径中添加fitnesse.jar,因为FitNesse框架已经默认添加了fitnesse.jar。

执行测试后,您可以通过单击测试 wiki 页面右上角的“黄色三角形”(如果测试失败)或“蓝色 I”(如果测试成功)图标来检查 FitNesse 使用的类路径。

I think this is how your classpath should be defined in FitNesse (note \ before poc):

!path D:\poc\lib\xstream.jar 

Make sure you indeed have xstream.jar in D:\poc\lib folder. But you don't need to add fitnesse.jar in the classpath since it is already added by default by FitNesse framework.

After you execute your test, you can check the classpath used by FitNesse by clicking on 'Yellow Triangle' (if test fails) or 'Blue I' (if test succeeds) icon on top-right of your test wiki page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文