Forum Discussion

j416's avatar
j416
Occasional Contributor
13 years ago

Fixtures / Runner.CallMethod

Hi,



I would like to implement fixtures for my tests, that is, I want to initialise (reset and start) some things, then run a set of tests, then tear it down (clean up and close). I was thinking I would implement this by throwing in an array of methods to call, and have something like (pseudo DelphiScript):



procedure RunTests(tests);

begin

<meta http-equiv="content-type" content="text/html; charset=utf-8" />  // - init things here - //

  loop through tests and for each do:

    Runner.CallMethod(test);

<meta http-equiv="content-type" content="text/html; charset=utf-8" />  // - tear down things here - //

end;



...to be able to do something like:



procedure Main;

begin

  RunTests('test1', 'test2', 'test3');

end;



<meta http-equiv="content-type" content="text/html; charset=utf-8" />Although, in the documentation for Runner.CallMethod, I read the following:

  "The Runner.CallMethod method is obsolete and it is supported for backward compatibility only."

I wonder, what should I be using in place of it, to call a method by name in a script?



Also, is there a better recommended way of doing this, or am I on the right track?



I would much appreciate any information you can give.

Thank you very much.



Johan

13 Replies