首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在junit5环境中运行junit4测试,所有测试用例都失败

在junit5环境中运行junit4测试,所有测试用例都失败
EN

Stack Overflow用户
提问于 2019-02-23 12:00:35
回答 1查看 117关注 0票数 0

我正在尝试在JUnit5测试环境中使用JUnit4。实际上,我现在已经升级了我的pom,使用了更高版本的MOckito和POwerMock.Until,所有的测试都是基于JUnit4的。我将平台和老式依赖项添加到我的pom.xml中。现在,我的JUnit4测试用例没有运行。

早期的pom.xml依赖项

代码语言:javascript
复制
    <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>1.9.5</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.powermock</groupId>
                <artifactId>powermock-module-junit4</artifactId>
                <version>1.6.1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.powermock</groupId>
                <artifactId>powermock-api-mockito</artifactId>
                <version>1.6.1</version>
                <scope>test</scope>
            </dependency>

    Latest pom.xml dependencies



        <dependency>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
                <version>5.3.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>2.23.4</version>
                <scope>test</scope>
            </dependency>
<dependency>
                <groupId>org.powermock</groupId>
                <artifactId>powermock-module-junit4</artifactId>
                <version>2.0.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>


<groupId>org.powermock</groupId>
                    <artifactId>powermock-api-mockito2</artifactId>
                    <version>1.7.4</version>
                    <scope>test</scope>
                </dependency>


    i m getting below errors

     Errors: 
    [ERROR]   IntegratorAccessUpdateTest.testBeanProperties:13 » NullPointer
    [ERROR]   ActionHistoryTest.testBeanProperties » StackOverflow
    [ERROR]   ApplicationPreferenceManagerTest.testGetBoolean » NoClassDefFound org/powermoc...
    [ERROR]   ApplicationPreferenceManagerTest.testGetString » NoClassDefFound org/powermock...
    [ERROR]   CommonValidatorsDispatcherTest.setUp:25 » IllegalState Could not initialize pl...
    [ERROR]   CommonValidatorsDispatcherTest.setUp:25 » IllegalState Could not initialize pl...


  How can i remove these errors, I am not sure that changing each and every class   is feasible.is there is any compatibility issue with the versions? why is it   showing stackoverflow error?
EN

回答 1

Stack Overflow用户

发布于 2019-02-24 03:56:08

Junit提供了关于如何从Junit4升级到Junit5的指导。https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54838115

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档