Instancio 不在日志中显示测试失败消息

问题描述 投票:0回答:1

我尝试使用 Instancio 生成用于自动化 UI 测试的数据(特别是使用 Selenium 填写注册表)。 所以我写了一个简单的代码:

@Test
    public void randomVolunteerRegTest(){
        driver = TestUtilities.getDriver("chrome");
        Volunteer volunteer = Instancio.create(Volunteer.class);
        registrationTest(volunteer);
        Assertions.assertEquals(volunteer.getPassword(), volunteer.getConfirmPassword());
    }

使用 Junit5 进行断言

很明显,测试每次都会失败,因为比较的值总是不同的

但在官方文档页面上写道,在测试断言失败的情况下,应将消息扔到日志中,指示用于生成允许重现该情况的数据的实例种子。但我没有得到,只有这个:

org.opentest4j.AssertionFailedError: 
Expected :PLQ
Actual   :RUOYWWDNQ

所以我很困惑为什么它不起作用,我做错了什么吗?

尝试接收带有种子实例的日志消息以重现失败的测试

java junit5 instancio
1个回答
0
投票

您的测试班上有

@ExtendWith(InstancioExtension.class)
吗?需要申报延期才能报告种子:

@ExtendWith(InstancioExtension.class)
class ExampleTest {

    @Test
    void example() {
        // ...
    }
}

文档:https://www.instancio.org/user-guide/#junit-jupiter-integration

© www.soinside.com 2019 - 2024. All rights reserved.