集成测试自动化-检查数据库值 [英] Integration Testing automation - checking DB values

查看:66
本文介绍了集成测试自动化-检查数据库值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在创建集成测试自动化过程中遇到问题.

I'm dealing now with a problem during creating automation of integration test.

我想:

  1. 通过硒RC输入数据
  2. 在导入后检查数据库中的值是否正确.

我对那些测试的逻辑有疑问.现在,我按以下步骤进行操作:在一个测试中,我生成随机数据(该人的名字,姓氏等).然后,通过从数据库中进行简单选择,我获得了唯一的person_id键(我假设如果名字和姓氏都长8个字符,则可以将随机生成的字符串视为唯一的),然后在下一个查询中使用此id.

I've got problem with logic of those tests. Now I do it as it follows: in one test I generate random data (first name, last name, etc of the person). Then, by simple select from DB I obtain unique person_id key (I assumed that if first and last name are both 8 characters long, random generated strings I can treat them as unique) and then use this id in next queries.

此方法正确吗?如果没有,我该如何处理?

Is this method correct? If not, how can I deal with it?

推荐答案

此集成测试的目的是什么?

What exactly is the purpose of this integration test?

如果您正在测试数据库适配器层,那么是否需要使用Web UI?您可以直接使用适配器.

If you're testing your DB adaptor layer, then is there any need to use the Web UI? You can exercise the adaptor directly.

如果您正在测试Web UI,是否需要将数据实际存储在数据库中?您可以使用模拟(或其他某种形式的测试双精度)检查值.

If you're testing the Web UI is there any need to actually store data in a database? You can check the values using a mock (or some other sort of test double).

如果您要进行端到端2端略读测试,是否有必要检查实际数据值(实际交互成功与否)?如果答案是肯定的,那么测试应该遵循以下原则:

If you're doing an end-2-end skim test, is it necessary to check the actual data values (over and above the success of the actual interaction)? And if the answer is yes, maybe the test should be along the lines of:

Given I have registered as "Random Person"
When I retrieve my details
Then my name is displayed correctly.

这篇关于集成测试自动化-检查数据库值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆