Java 我能够通过ant build.xml编译JUnit程序,但在执行它时,我遇到了一个异常
我对JUnit和ant是新手。我怀疑build.xml是否正确。我能够通过目标中的compile标记生成.class文件。但我无法执行该文件。当我尝试执行下面脚本中的Java 我能够通过ant build.xml编译JUnit程序,但在执行它时,我遇到了一个异常,java,ant,junit4,Java,Ant,Junit4,我对JUnit和ant是新手。我怀疑build.xml是否正确。我能够通过目标中的compile标记生成.class文件。但我无法执行该文件。当我尝试执行下面脚本中的test标记时。我得到了java.lang.ClassNotFoundException,这就是我被卡住的地方 同样的程序在EclipseIDE中工作良好。。但不能仅通过ant执行 我已经多次验证了java和ant的类路径。天气也很好 我正试图从过去三天中解决这个问题,但问题仍然存在 谁来帮帮我 <target name="c
test
标记时。我得到了java.lang.ClassNotFoundException
,这就是我被卡住的地方
同样的程序在EclipseIDE中工作良好。。但不能仅通过ant执行
我已经多次验证了java和ant的类路径。天气也很好
我正试图从过去三天中解决这个问题,但问题仍然存在
谁来帮帮我
<target name="compile" description = "Compiling java code">
<javac srcdir="D:/AntBuilder/src" destdir="D:/AntBuilder/build" classpath= "D:/AntBuilder/dist/lib" includeantruntime="true" />
</target>
<target name="test" depends="compile" description="Execute Unit Tests" >
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<formatter type="xml" />
<test name="automation.LogInTest" />
<classpath>
<pathelement location="D:/AntBuilder/dist/lib"/>
<pathelement location="D:/AntBuilder/build"/>
</classpath>
</junit>
</target>
根据stacktrace,它无法找到WEbDriver.exe。下载文件并将其放置在所有JAR所在的位置 现在已经解决了这个问题
问题在于在lib文件夹中添加jar文件。除了selenium-java-2.41.0.jar文件之外,我们还需要下载一个jar文件。。selenium-server-standalone-2.41.0.jar找不到哪个类?显示stacktrace!java.lang.ClassNotFoundException:automation.LogInTest automation是一个包。我已经在Itan中编写了类名LogInTest,并且在包
automation
中编写了您的类名LogInTest
?您可以在文件夹D:/AntBuilder/dist/lib
或D:/AntBuilder/build
中的一个文件夹中看到compiles类Hi-Jens,我的源代码存在于srcdir中。在D:/AntBuilder/build中成功生成的class文件中,我已将junit jar文件放置在D:/AntBuilder/dist/lib中stacktrace中是否存在“由”异常?如果没有,请仔细检查D:/AntBuilder/build/automation/LogInTest.class
是否存在。复制粘贴名称以检查拼写错误。嗨,Neha,谢谢你提供的信息。。我还为浏览器添加了可执行文件。。