简体   繁体   中英

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
  2. Commit
  3. Executes the packaged procedure returning a value
  4. Updates the database value to '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.

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|

part to be

!|Execute|update my_table set .....|

and then I don't need

|Commit|

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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