简体   繁体   English

为 vertx 数据库访问编写单元测试用例(postgres)

[英]Writing unit test cases for vertx database access (postgres)

I am writing Unit test cases but struck at writing Unit test cases for database access.我正在编写单元测试用例,但对编写用于数据库访问的单元测试用例感到震惊。

I found following links but still didn't understand how to use it.我找到了以下链接,但仍然不明白如何使用它。 where to write initial schema and configure.在哪里编写初始模式和配置。 https://github.com/eclipse-vertx/vertx-sql-client/blob/d96e53f80c0066b377c43efbd1c6466bb0d06e51/vertx-pg-client/README.adoc https://github.com/eclipse-vertx/vertx-sql-client/blob/d96e53f80c0066b377c43efbd1c6466bb0d06e51/vertx-pg-client/README.adoc

it says > mvn test -Dembedded.postgres.version=9.6

 https://dzone.com/articles/using-embedded-postgresql-databases-for-unit-testi

My Queries:我的查询:

  • How do we write Unit test cases in data base access level我们如何在数据库访问级别编写单元测试用例
  • I am trying this embedded database approach is it correct?我正在尝试这种嵌入式数据库方法是否正确? or is there any other way.或者有没有其他方法。

Please guide me how do we write UT for this senario.请指导我如何为这个场景编写 UT。

I would recommend using testcontainers if you can run containers on your development machine.如果您可以在开发机器上运行容器,我建议您使用testcontainers

Testcontainers lets you configure and start various databases in a container. Testcontainers 允许您在容器中配置和启动各种数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Unitils针对Postgres数据库运行单元测试时发生NullPointerException - NullPointerException while running unit test against Postgres database with Unitils 有没有办法使用嵌入式数据库进行单元测试来测试 Postgres Jsonb 查询? - Is there a way where we can test Postgres Jsonb queries using embedded database for Unit Testing? 如何在Rails中测试各种测试用例的Postgres触发功能? - How to test postgres trigger functions for various test cases in rails? Django单元测试针对多个Postgres模式失败 - Django unit test failing for multiple Postgres schemas Javascript nodeJs Postgres pg 单元测试 - Javascript nodeJs Postgres pg unit test 为我的 Postgres 对象编写基本的测试代码 - Writing basic test code for my Postgres objects Django 测试在某些情况下使用错误的数据库 - Django test uses wrong database in some cases 将 dataframe 写入 Postgres 数据库 psycopg2 - Writing dataframe to Postgres database psycopg2 如何优化将这些数据写入Postgres数据库 - How to optimize writing this data to a postgres database 从 Powershell 中的 Postgres 数据库读取和写入 Linux - Reading and writing from a Postgres database in Powershell for Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM