2

I am trying to have all of my database actions rolled back after my test executes. I have included the using block inside the Execute method of my test. But every time that my code calls to the SAVE() method of the SOOrderEntry it immediately gets added to the database. I am fairly new to Acumatica.

                {
                    using (TestExecution.CreateTestCaseGroup("Execute: SO301000_SOOrderEntryExt_HoldReserve (2) Test"))
                    {
                        var maint = new SO301000_SOOrderEntryExt();
                        maint.OpenScreen();

                        using (TestExecution.CreateTestStepGroup("Group1"))
                        {
                            maint.Insert();

                            ModifyForm(maint, "SH", "C000000000", "MAIN");

                            maint.Save(); // after the save it is written to the DB immediately
                              
                        }
                     }
                  }
mbargar13
  • 45
  • 5
  • I guess it's not clear to me what it is you'd like to happen? If you are just testing the UI entry screen, then I would suggest you just not Save at the end. The document will be left in the cache without being persisted to the database. – Patrick Chen Mar 14 '22 at 15:43
  • This is using the Test SDK, since I am still new to Acumatica. When I use Entity Framework in other projects that do an Integration test. I usually just wrap the test in a transaction to be able to roll it back to what it looked like before the test ran. We need to the Save data as that fires events that we are verifying is correct. Hope that helps. – mbargar13 Mar 14 '22 at 19:17

0 Answers0