AbstractTransactionalTestNGSpringContextTests测试用例更新cassandra数据库

问题描述 投票:0回答:1
@SpringBootTest(classes = RepositoryMain.class)
@ActiveProfiles({"dev"})
public class EmployeeTest extends AbstractTransactionalTestNGSpringContextTests {

    @Autowired
    private EmployeeRepository employeeRepository;

    @Test
    public void testAddEmployee() {
        /// some logic
    }
}

testAddEmployee()测试用例将一条记录插入到Cassandra数据库employee表中。当我为MySQL存储库编写相同的测试时,它在测试用例前后均保持MySQL状态不变。

为什么AbstractTransactionalTestNGSpringContextTests不适用于Cassandra?是因为Cassandra不支持提交和汇总功能吗?

spring-boot cassandra spring-data-jpa testng integration-testing
1个回答
1
投票

为什么AbstractTransactionalTestNGSpringContextTests不适用于Cassandra?是因为Cassandra不支持提交和汇总功能吗?

是,这个正确。

您在MySQL中看到的数据库清理是通过回滚实现的,但是不适用于Cassandra。

您必须明确进行清理。

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