并行集成测试处理数据库计数
我正在并行运行集成测试,但是我有一个测试,可以计算一个表中的行数,但数量可能会因在测试运行之前进行的许多测试而有所不同。
在春季或JUNIT中是否有任何机制可以使我确保测试运行时,该表是干净的,以使计数总是1?
谢谢
I'm running my integration tests in parallel but I have one tests that counts the number of rows in one table but the number can vary depending on many tests have run before that tests runs.
Is there any mechanism in Spring or Junit that would allow me to make sure that when that tests runs that table is clean so that the count would always be 1?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在Junit类中使用注释前:
这是通过考虑,您的其他测试真的不在乎db表行是否在执行之前被清除,因为
@beforeeach
将对每个执行您运行的测试。You can use
BeforeEach
annotation within Junit class:This is by considering, your other test's wont really care if db table rows get cleared before execution as
@BeforeEach
will get executed for every tests you run.