English 中文(简体)
有效测试数据库的备份
原标题:Effectively test a database backend

我有一个数据库支持的申请,可悲的是,它很少对其数据库进行测试。 我试图加快有效测试数据库。

至今,我学会:

  • test the ability of the application to put/fetch data to the database
  • use mock DB s to test object/relation-mapping code

www.un.org/Depts/DGACM/index_spanish.htm 我仍在努力执行第一点。 看来,测试的唯一办法是将数据列入实际表格。 但当然,用户不希望看到我的测试数据。 这里指的是目前由伪装成像的Im:

begin a transaction
insert a few rows
check that no error has occurred
 select  the rows back out
check that no error has occurred, check that data out matches data in
tell the test framework that it s successful
abort the transaction

这是一种最佳做法,还是某种可怕的反家长? 任何更好的建议?

最佳回答

您的用户肯定不去看你的测试数据,因为生产试验实际上很不好! 你应努力创造试验环境,并在那里进行测试。

我发现的一个解决办法是建立一个单独的数据库,用一些已知的数据充实数据库,并利用这些数据进行一体化测试。 保证在每次测试后清理你的数据库,因为测试案例应当独立。

利用测试数据库中的交易并不是这种坏的做法,因为你可以确认事情,然后收回交易,但我担心,你将重新采用将承诺使用数据库的代码,从而改变随后测试的参数。 当然,如果贵国的银行支持冻结的交易,那就是一个大宗交易,但并非所有的银行都这样做。

问题回答

是的,我们应当有3个不同的环境,如牛津、卡片和生产环境。 你们不应在生产数据中发挥作用,因为数据有时复制到一些分发的数据库,如果你们不知道复制数据,就会产生不必要的问题。

~Temruzinn





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签