动态联合测试
作为我的研究最终项目的一部分,我必须制作一个 J2EE 应用程序,允许用户运行 JUnit 测试(没有任何经验,他们所要做的就是单击并查看结果),显然它必须是某种修改测试并创建的方法新的(上传新的测试文件...) 您能否向我指出允许我动态加载和运行测试的正确技术? 预先感谢您的帮助
As part of my study final project I have to make a J2EE application that allows users to run JUnit tests(without any experience what they have to do is to click and see the result), obviously it must be some way to modify tests and create new ones (upload new test files ...)
could you point me to the right technology which allows me to load and run tests on the fly??
thank you in advance for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以查看 Pax Exam OSGi 测试工具 (1) 的实现(来源)。该工具动态地从 JUnit 测试生成 OSGi 包,并在测试 OSGi 容器内运行它们。
您可以为 J2EE 实现相同的方法。
希望它可以帮助您分析和估计您的项目范围。
干杯,
Dmytro
(1):http://wiki.ops4j.org/display/paxexam/Pax +考试
you can take a look at implementation (sources) of Pax Exam OSGi testing tool (1). This tool generates OSGi bundles from JUnit tests on the fly and runs them inside test OSGi container.
You can implement the same approach for J2EE.
Hope it helps you to analyze and make an estimate your project bounds.
Cheers,
Dmytro
(1): http://wiki.ops4j.org/display/paxexam/Pax+Exam
您可以创建自己的 JUnit 测试运行程序实现,该运行程序具有在运行时动态加载测试 JAR 和依赖项 JAR 的选项。查看 JUnit API 中的
JUnitCore
类和相关类,例如Result
。还要研究动态 JAR 加载。JUnitCore:
http://kentbeck.github.com/junit/javadoc/latest/
动态 JAR 加载:
我应该如何在运行时动态加载 Jars?
http://sourceforge.net/projects/jcloader/
You could create your own implementation of a JUnit test runner that has an option for dynamically loading test JARs and dependency JARs during runtime. Take a look at the
JUnitCore
class and related classes in the JUnit APIs such asResult
. Also look into dynamic JAR loading.JUnitCore:
http://kentbeck.github.com/junit/javadoc/latest/
Dynamic JAR loading:
How should I load Jars dynamically at runtime?
http://sourceforge.net/projects/jcloader/