Simulate AForm
Trevor W.
Tucson, AZ

Jun 6, 2018
5 Posts

Simulate AForm

Is it possibly to pass a form OnEvent procedure as a parameter to the SetSimulateProcedures procedure? I have already simulated all of my necessary functions using the Test variables to decide which values should be returned on simulation. When running the same procedures from a form I get an error since there is no test variables (ex. Test.Min, Test.Max) while running the form. Is it possible to simulate the OnClick procedure of a button on my form in order to simulate this procedure and if so, how?

Solution Available
DrATEasy (Ron Y.)
Mission Viejo, CA

Jun 6, 2018
255 Posts

Re: Simulate AForm

You can do it, I attached an example, let me know if it works for you:

The OnInit will setup the simulation

  SetSimulateProcedures("Form1.btn1.OnClick")

The OnSimulate:

sProc=procCallee
if sProc="SimulateTest.Form1.btn1.OnClick"
    OnClick()
...


File Attachment:
SimulateFormEvent.zip

Trevor W.
Tucson, AZ

Jun 6, 2018
5 Posts

Re: Simulate AForm

I am running my simulation at the driver level so I had to put Program1.Form1.btn1.OnClick but that passed without hitting any asserts or errors I had put in. My problem if it will help anyone else was that I was putting Program1.Forms.Form1.btn1.OnClick, unnecessarily adding the forms to my path list.

Trevor W.
Tucson, AZ

Jun 6, 2018
5 Posts

Re: Simulate AForm

I put the solution you suggested and SetSimulateProcedures returned True, but it never actually enters into the OnSimulate event and still runs the normal OnClick procedure. I also ran your example code and it has the same problem, it says that the simulation is set, but it never actually calls the simulated procedure and instead just runs the normal form1.btn1.OnClick procedure. Looks like the example code is missing a step, any idea what that is?



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]