简体   繁体   English

SAP功能模块的测试数据稳定吗?

[英]Stable test data for a SAP function module?

We extract data from SAP IS-U to create RDI which gets used to create PDF via caps .我们从 SAP IS-U 中提取数据以创建RDI ,该RDI用于通过caps创建 PDF。

We want to create automated integration tests.我们想创建自动化集成测试。

The function modules we want to test are not trivial.我们要测试的功能模块并不简单。 For example creating an annual invoice reads a lot of data in a lot of tables.例如,创建年度发票会读取大量表中的大量数据。 We need to be sure that all this data does not change.我们需要确保所有这些数据都不会改变。 Otherwise the tests will fail.否则测试将失败。

Therefore we need stable test data inside SAP.因此我们需要SAP内部稳定的测试数据。 Unfortunately we don't have this at the moment.不幸的是,我们目前没有这个。

The sap development systems get accessed by many people.许多人都可以访问 sap 开发系统。 And from time to time these systems get updated with data from the production system.这些系统不时会使用生产系统的数据进行更新。

How to get stable test data for SAP IS-U? SAP IS-U如何获得稳定的测试数据?

My personal opinion: the provider of the custom solution/component (in this case the IS-U) should provide stable test data.我的个人意见:定制解决方案/组件的提供者(在这种情况下是 IS-U)应该提供稳定的测试数据。 Otherwise every development team starts to create its own stable test data again and again.否则,每个开发团队都开始一次又一次地创建自己的稳定测试数据。

From our discussion under the question I could say that the simplest solution would be to request for a separate client in your test system where the data could not be updated by the periodical copy from the production.从我们在这个问题下的讨论中,我可以说最简单的解决方案是在您的测试系统中请求一个单独的客户端,其中数据无法通过生产的定期副本进行更新。 This would ensure that your data remain stable for your post conditions in your tests.这将确保您的数据在测试中的后期条件下保持稳定。

Look at the ABAP TestDouble Framework available since ABAP 740 SP09.查看自 ABAP 740 SP09 以来可用的ABAP TestDouble 框架 It was introduced exactly for this, for being independent on the productive database state and without changing production code.正是为此而引入的,因为它独立于生产数据库状态并且不更改生产代码。

The approach used to achieve this is called mocked DAO and described in the blogs below用于实现此目的的方法称为模拟 DAO,并在下面的博客中进行了描述

The mocking is achieved by creation of test double object and configuring method output values through cl_abap_testdouble class methods模拟是通过创建 test double 对象并通过cl_abap_testdouble类方法配置方法输出值来实现的

cl_abap_testdouble=>create( )
cl_abap_testdouble=>configure_call( )

Consider this whole blog series that describes DAO concept and TestDouble:考虑一下描述 DAO 概念和 TestDouble 的整个博客系列:

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM