简体   繁体   English

如何从DBFit测试中持久保存更改

[英]How to persist changes from inside DBFit test

I need to test a packaged procedure's output, according to a specific value in a database table. 我需要根据数据库表中的特定值测试打包过程的输出。 So, I created a test which: 因此,我创建了一个测试:

  1. Updates the database value to NULL 将数据库值更新为NULL
  2. Commit 承诺
  3. Executes the packaged procedure returning a value 执行返回值的打包过程
  4. Updates the database value to 'N' 将数据库值更新为“ N”
  5. Commit 承诺
  6. Executes the packaged procedure again returning another value 再次执行打包过程,返回另一个值

It seems that the database value is never commited and so the packaged procedure returns always the same value. 似乎数据库值从未提交,因此打包过程始终返回相同的值。 Here is the test: 这是测试:

!path lib/*.jar

!|dbfit.OracleTest|
!|ConnectUsingFile|DBConnections/DBConnection.properties|

|set option|fixed length string parsing|true|

|Update|my_table|
|col_value=|col_name|
|NULL|val|

|Commit|

!|Execute Procedure|pckg.proc|
|birth_date_|gender_|first_name_|last_name_|?|                 
|NULL|F|Rita|Rita|>>ref_cur1|

|Update|my_table|
|col_value=|col_name|
|N|val|

|Commit|

!|Execute Procedure|pckg.proc|
|birth_date_|gender_|first_name_|last_name_|?|                 
|NULL|F|Rita|Rita|>>ref_cur2|

!2.4. Compare expected values and actual values

!|Query|<<ref_cur1|
|j_status|
|-32|

!|Query|<<ref_cur2|
|j_status|
|-39|

|Rollback|

The problem is that it always return the same status, according to the value of the database column before the test starts. 问题在于,在测试开始之前,它总是根据数据库列的值返回相同的状态。 If it is NULL from the beginning, then both return values are -39 and if it is 'N' from the beginning, then both return values are -32. 如果从头开始为NULL,则两个返回值均为-39,如果从头开始为'N',则两个返回值均为-32。

Any ideas on how to persist the changes? 关于如何保留更改的任何想法?

Well I got the answer and it is that I have to change the 好吧,我得到了答案,那就是我必须改变

|Update|my_table| |更新| my_table |

part to be 成为一部分

!|Execute|update my_table set .....| !|执行|更新my_table设置..... |

and then I don't need 然后我不需要

|Commit| |提交|

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

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