【问题标题】:Getting "junit.framework.AssertionFailedError: Forked Java VM exited abnormally" Exception获取“junit.framework.AssertionFailedError:分叉 Java VM 异常退出”异常
【发布时间】:2012-03-10 13:18:45
【问题描述】:

我有一个用于 JUnit 测试的 java 程序,我在 netbeans IDE 中编写了该程序,我正在用单线程测试一个类。 当我要编译它时,它工作正常并显示结果 100% 成功,但是 当我试图运行这个程序时,我遇到了一个异常 -

测试套件:glb.chatmeter.crawler.yahoolocal.YahooBusinessDataTest 测试运行:1,失败:1,错误:0,经过时间:0.057 秒

测试用例:警告(junit.framework.TestSuite$1):失败 在 glb.chatmeter.crawler.yahoolocal.YahooBusinessDataTest 中找不到测试 junit.framework.AssertionFailedError:在 glb.chatmeter.crawler.yahoolocal.YahooBusinessDataTest 中找不到测试

测试套件:glb.chatmeter.crawler.yahoolocal.YahooBusinessDataTest 测试运行:1,失败:0,错误:1,经过时间:0 秒

测试用例:glb.chatmeter.crawler.yahoolocal.YahooBusinessDataTest:null:导致错误 分叉的 Java VM 异常退出。请注意,报告中的时间并不反映直到 VM 退出的时间。 junit.framework.AssertionFailedError:分叉的 Java VM 异常退出。请注意,报告中的时间并不反映直到 VM 退出的时间。 在 org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154)

是它的netbean问题还是别的什么?有人帮我吗谢谢。

我的代码是这样的-

public class BusinessDataTest {

    String url = "http://local.com/info-66122628-andy-richards-house-painting-mesa";
    Integer[] locId = {1354};
    String customerDetail ="Business Name";

    public BusinessDataTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Test
    public void testGetFullDataOfBusiness() {
        System.out.println("getFullDataOfBusiness");
        BusinessData instance = new BusinessData();
        Integer expResult = 4;
        Integer result = instance.getFullDataOfBusiness(url, customerDetail);
        System.out.println("Result : " + result);
        assertEquals(expResult, result);
    }
}

【问题讨论】:

  • 您是否在测试套件中放置了任何调用退出或关闭的代码?
  • 是 JUnit4 还是 JUnit3?如果是 JUnit4,请确保您没有从 TestCase 继承并且您正在使用@Test 注释。
  • @Alexander :不,不调用退出或关闭。
  • @Ben 使用 JUnit4 并且不继承 TestCase
  • 这个错误是关于 YahooBusinessDataTest 的。您上面粘贴的代码没有“雅虎”。您确定您正在运行正确的测试吗?

标签: java junit netbeans-6.9


【解决方案1】:

这看起来像是 Netbeans 中的一个错误 - 请参阅 Bug 204729

【讨论】:

    猜你喜欢
    • 2013-03-06
    • 2010-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-19
    • 1970-01-01
    • 2012-02-06
    相关资源
    最近更新 更多