【问题标题】:AbstractTransactionalTestNGSpringContextTests test case updates cassandra databaseAbstractTransactionalTestNGSpringContextTests 测试用例更新 cassandra 数据库
【发布时间】:2020-09-08 05:29:25
【问题描述】:
@SpringBootTest(classes = RepositoryMain.class)
@ActiveProfiles({"dev"})
public class EmployeeTest extends AbstractTransactionalTestNGSpringContextTests {

    @Autowired
    private EmployeeRepository employeeRepository;

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

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

为什么AbstractTransactionalTestNGSpringContextTests 不能与 Cassandra 一起使用?是因为 Cassandra 不支持提交和汇总功能吗?

【问题讨论】:

    标签: spring-boot cassandra spring-data-jpa testng integration-testing


    【解决方案1】:

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

    是的,这是正确的。

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

    您必须明确地进行清理。

    【讨论】:

      猜你喜欢
      • 2017-07-01
      • 2017-01-01
      • 2017-05-25
      • 1970-01-01
      • 1970-01-01
      • 2016-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多