Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获得;junit.framework.AssertionFailedError:Forked Java VM异常退出;例外情况_Java_Junit_Netbeans 6.9 - Fatal编程技术网

获得;junit.framework.AssertionFailedError:Forked Java VM异常退出;例外情况

获得;junit.framework.AssertionFailedError:Forked Java VM异常退出;例外情况,java,junit,netbeans-6.9,Java,Junit,Netbeans 6.9,我有一个用于JUnit测试的java程序,我在netbeans IDE中编写了这个程序,在这里我用单线程测试一个类。 当我准备编译这篇文章时,它运行良好,显示出100%成功的结果,但是 当我试图运行这个程序时,我得到一个异常- Testsuite:glb.chatmeter.crawler.yahoolocal.YahooBusinessDataTest 测试运行:1,失败:1,错误:0,运行时间:0.057秒 Testcase:警告(junit.framework.TestSuite$1):失

我有一个用于JUnit测试的java程序,我在netbeans IDE中编写了这个程序,在这里我用单线程测试一个类。 当我准备编译这篇文章时,它运行良好,显示出100%成功的结果,但是 当我试图运行这个程序时,我得到一个异常-

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

Testcase:警告(junit.framework.TestSuite$1):失败 在glb.chatmeter.crawler.yahoolocal.YahooBusinessDataTest中未找到任何测试 junit.framework.AssertionFailedError:在glb.chatmeter.crawler.yahoolocal.YahooBusinessDataTest中未找到任何测试

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

Testcase: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);
    }
}

这看起来像是Netbeans中的一个bug-请参见

您是否在测试套件中放置了调用exit或shutdown的代码?是JUnit4还是JUnit3?如果是JUnit4,请确保您没有从TestCase继承,并且您正在使用
@Test
注释。@Alexander:没有,没有调用exit或shutdown。@Ben使用JUnit4而没有继承TestCase错误说明YahooBusinessDataTest。上面粘贴的代码没有“yahoo”。您确定正在运行正确的测试吗?