简体   繁体   English

如何使用通过翻译Gunit文件制作的Antlr生成的junit文件

[英]How do I use the Antlr generated junit file made by translating a gunit file

I am trying to make unit tests for multiple return values in Antlr. 我正在尝试对Antlr中的多个返回值进行单元测试。 I have regular unit tests working using gunit. 我有使用gunit进行的常规单元测试。 However, I am not too sure what to do with the junit Testgrammar.java file that is generated as per the instructions at http://www.antlr.org/wiki/display/ANTLR3/gUnit+-+Grammar+Unit+Testing 但是,我不太确定如何处理按照http://www.antlr.org/wiki/display/ANTLR3/gUnit+-+Grammar+Unit+Testing中的说明生成的junit Testgrammar.java文件

I've tried running: 我试过跑步:

java -cp "./antlr.jar" Testgrammar.java java -cp“ ./antlr.jar” Testgrammar.java

but I get the following error: 但我收到以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: Testgrammar/java 线程“主”中的异常java.lang.NoClassDefFoundError:Testgrammar / java

您可以像运行其他Java应用程序一样运行它:使用类名而不是文件名。

java -cp "./antlr.jar" Testgrammar

It needs to be compiled linking to the build output of the grammar files and then run with: 需要对其进行编译以链接到语法文件的生成输出,然后使用以下命令运行:

java org/junit/runner/JUnitCore Testgrammar java org / junit / runner / JUnitCore测试语法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM