如何测试期望cmd行参数的并发Java程序? [英] How do I test a concurrent Java program which expects cmd line arguments?
问题描述
我有一个Java程序,它的主要方法(在主类)期望命令行参数。程序也是并发的(使用线程和东西)。
I have a Java program which its main method (in the main class) expects command line arguments. The program is also concurrent (uses threads and stuff).
我想对程序进行大量重构。在我开始重构之前,我想为主要方法创建一个测试套件。我想用不同的cmd行参数测试主要方法。我想要在每个重构步骤后自动运行这些测试。如何创建一个传递cmd行参数的测试?
I want to do massive refactoring to the program. Before I start refactoring I would like to create a test suit for the main method. I would like to test the main method with different cmd line arguments. I'll want to run these tests automatically after each refactoring step I make. How do I create a test which passes cmd line arguments?
我不能使用JUnit,因为我知道它不能很好地与并发程序。我也不知道你是否可以传递cmd行参数与JUnit。
I cannot use JUnit because as far as I know it doesn't work well with concurrent programs. I'm also not sure if you can pass cmd line arguments with JUnit.
我使用eclipse。
I'm using eclipse.
推荐答案
看看multithreadedtc。 http://code.google.com/p/multithreadedtc/
Take a look at multithreadedtc. http://code.google.com/p/multithreadedtc/
这篇关于如何测试期望cmd行参数的并发Java程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!