2

Can someone explain how to use TestAdapter concept in Microsoft's Spec Explorer, to export tests..say, in .CSV format?

I tried browsing through, but no clear answers anywhere. Prefer to get the solution in C#

1 Answers1

0

Your idea is good, if your tests are completely deterministic. In this case you have no methods of type "public static event" in your test adpater and so you are not listening to responses from your system under test and your explored graphs do not show any diamonds and finally you have no if-clauses in your test-case code.

In this simple case you can simply add to every test adapter method a very simple write-to-file command and you write e.g. the name of the method and the arguments.

If you have non-determinism (if-clauses) this simple approach is not really working, because you will not traverse all branches in the control flow of your test-case. In this case you can traverse the test case with the use of the method described here:

http://social.msdn.microsoft.com/Forums/en-US/d1c9f98f-4588-4516-8d51-be2590300f85/using-specexplorer-with-silverlight?forum=specexplorer

or directly using the Microsoft.SpecExplorer.ObjectModel. An example for this is the Requirements report you find in the Spec Explorer examples.

goofy
  • 549
  • 2
  • 7
  • What's meant by TestAdapter; how do I create that in code? Any documentation that you can point me to? – HappyWaters Jan 29 '14 at 08:21
  • There is an extremly good video tutorial [here](http://social.msdn.microsoft.com/Forums/en-US/9155dc4f-61f4-4e4a-a0f4-9111628aa886/the-full-effective-modelbased-testing-with-spec-explorer-class-is-now-available?forum=specexplorer) a full documentation [here](http://msdn.microsoft.com/en-us/library/ee620518.aspx) and of course the wizard, all the examples and the Blog and Forum. – goofy Jan 29 '14 at 16:59
  • THanks; I'm not exactly new to the concept of modelling. I've also watched the first 3 parts of the video tutorial you're referring to. Still, I've not found the answer I need - specifically, how to use TestAdapter? – HappyWaters Jan 30 '14 at 09:51
  • The example used [here](http://social.msdn.microsoft.com/Forums/pt-BR/a1168cac-42c9-45bf-8305-3d0109ace8ec/cord-script-in) or the sailboat example and some other have implemented test adapters. E.g. the sailboat-example plots a position into a window in the c#-file "implementation.cs". This is a good example for your application: You could just change the code a little bit so the position-change is written to a CSV-file. – goofy Jan 30 '14 at 18:49
  • I feel so stupid here, but I've ask again. I looked at the SailBoat example. It can generate TestSuite.cs from the machine TEstSuite. Is this file same as the TestAdapter? If it's, where should I change the code? If it's not, which other file should change? What code should I put? Thanks a lot for offering to help! – HappyWaters Jan 31 '14 at 04:21
  • Keep on with your research, Spec Explorer is worth the long way. According to the exact definition in the [Blog](http://blogs.msdn.com/b/specexplorer/archive/2009/11/23/connecting-your-tests-to-an-implementation.aspx) both examples Sailboat and Accumulator have no test adapter, because they implement in the test adapter directly the trivial SUT. This is why the "test adapter" in both examples is in the files "implementation.cs". TestSuite.cs contains only the test cases. – goofy Jan 31 '14 at 18:21
  • The methods you find in "implementation.cs" are called [actions](http://msdn.microsoft.com/en-us/library/ee620493.aspx). Complexer projects do not contain the SUT in the actions, but a remote access to the SUT via an API etc. This is where you change the code. In your case you can clear the body of the actions and just add a write-to file command. Please run the test cases for the Sailboat and the Accumulator example, try out the debugger and try adding your code. – goofy Jan 31 '14 at 18:23