Logging method calls
We can log all the method calls with the following entry in our Suite Configuration File:
<suiteConfig>
...
<Slim.Operators>
<Replace with="fitSharp.Slim.Operators.InvokeLogged">InvokeLibrary</Replace>
</Slim.Operators>
</suiteConfig>The log is written to a file named invoke.log.Analyzing Test Pages
We can also run an analysis of the Slim tests, to list all the method calls, without running the tests. This is a two-step process:
- extract the Slim instructions with a FitNesse command:
java -jar pathToFitNesse/fitnesse.jar -c "MySuite?instruction" -b instruction.txt - analyze the Slim instructions:
pathTofitSharp/Runner -c analysis.config.xml
analysis.config.xml looks like this:<suiteConfig>
<Settings>
<runner>fitSharp.Slim.Analysis.Report</runner>
</Settings>
<fitSharp.Slim.Analysis.Settings>
<Input>instruction.txt</Input>
<Output>analysis.txt</Output>
</fitSharp.Slim.Analysis.Settings>
<ApplicationUnderTest>
<addNamespace>My.Application.NameSpace</addNamespace>
<addAssembly>pathTo/MyApplication.dll</addAssembly>
</ApplicationUnderTest>
</suiteConfig>The output lists the page names and method calls found:MySuite.MyPageOne|My.SampleClass:SampleClass(0) MySuite.MyPageOne|My.SampleClass:SampleMethod(0) MySuite.MyPageTwo|My.SampleClass:SampleClass(1) MySuite.MyPageTwo|My.SampleClass:SampleMethodWithParm(1)The numbers in parentheses indicate the number of parameters. Some method calls may not be recognized if the method name is dynamically generated when the test is run.