11
Views
1
Comments
How to Mock the data in unit testing in outsystems.
Question

Hello,

I am doing BDD and during testing data actually reflecting in database. How to mock the data.??

Thanks in Advance


Hi Ram ,


when you are testing your application with database , data has to be stored in your database in order to have proper store/retrieval purpose. So once you complete your unit testing if you want to clean the data from database.

1. If you are testing in QA and you will push your code to  Upper environments then you don't have to worry about the data you created in your QA ENV.

2. Still if you want to delete the data , There are two ways to do it

  I.  Soft Delete:  Create IsDelete flag in your data base for every entity with default value False.  

              Write a timer to make all records as IsDelete as True.(Where you can use Advance SQL for bulk                           updates).

  II.  Hard Delete: Create timer to delete all the data from your database (Here also you can use advance SQL)

                      But here you need to be more careful about your referential Integrity. So Delete child first and then                main.


Hope this helps.


Regards,

Rama