【发布时间】:2014-04-19 12:13:26
【问题描述】:
我不知道如何解释它,但我会尽力而为。
我有这个项目,客户希望我创建一个比赛。一个人必须上传他的 Java 代码,另一个人必须上传他的 JUnit 测试。 我的应用程序应该获取这 2 个文件并在上传的代码上运行上传的测试。
现在我知道如何让用户上传他们的文件,但我一点也不知道如何实际运行测试。谁能帮我解决这个问题?
这是我目前得到的代码:
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == codeB)
{
//Get the code
File dir = new File("..");
fc.setCurrentDirectory(dir);
int returnVal = fc.showOpenDialog(this);
if (returnVal == fc.APPROVE_OPTION)
{
codeF = fc.getSelectedFile();
codeV.setText(codeF.getPath());
}
else
{
System.out.println("Cancel");
}
}
if (e.getSource() == testB)
{
//Get the test
File dir = new File("..");
fc.setCurrentDirectory(dir);
int returnVal = fc.showOpenDialog(this);
if (returnVal == fc.APPROVE_OPTION)
{
testF = fc.getSelectedFile();
testV.setText(testF.getPath());
}
else
{
System.out.println("Cancel");
}
}
if (e.getSource() == run)
{
//Run the tests on the code
}
【问题讨论】:
-
我一整天都在努力让它工作,但我不能让它太工作。我正在使用 JDK,但加载类也一直失败。
标签: java unit-testing junit automated-tests