Steps to create WCFWeb service unit test for load test

Nov 19, 2009 at 3:30 PM

Hi,

This is Karthigeyan.

I have downloaded the kit Release20090615CodePlex and followed the complete steps as instructed in the LAB word document for creating the unit test for WCF Web service. I have followed all the necessary steps to reach the exercise 3. However, I am stuck at the step 6 in teh exercise 3

This is the instrcution to be followed in step 6 “c:\program files\wcfunit\wcfunit” CompileTimeScenario <trace file>  SampleConfig.xml

I have provided the folwoing in the SDK prompt

"c:\program files\wcfunit\wcfunit" CompileTimeScenario "c:\Documents and Settings\karthigeyan_raju\My Documents\Release20090615CodePlex\Lab\2008\SampleClientProxy\ConsoleClient"  SampleConfig.xml

and got the message WCF Load Test Generator Version 3.0.0.0
The assembly C:\Documents and Settings\karthigeyan_raju\My Documents\Release200
0615CodePlex\Lab\2008\SampleClientProxy\ConsoleClient\bin\Debug does not exist.

Please suggest me where I am going wrong.

EXERCISE 3 – GENERATING THE UNIT TESTS FROM THE TRACE
Estimated time to complete this exercise: 10 min.
In this exercise the command-line tool is used to generate unit test code for calling the WCF service from the data in the trace file and the assembly containing the generated proxy.
Carry out the following steps.
1. Create a new test project in Visual Studio. Delete the tests added by the project template as these are not needed.

2. Add a reference to the following assemblies:

System.ServiceModel
System.Runtime.Serialization (version 3.0.0.0)

If you cannot see these assemblies browse for them in the following path:

C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0

3. In the directory containing the test project create a file called SampleConfig.xml with the following contents:

<?xml version='1.0' encoding='utf-8' ?>
<WcfUnitConfiguration xmlns='http://microsoft.com/wcfunit'
                           testMethodMode='ScenarioMethodOnly'
                           operationTimerMode='IncludeOperationTimers'>
       <assembly fileName="<path to ConsoleClient.exe>"/>
     <soapActions soapActionMode='Include'>
     </soapActions>
</WcfUnitConfiguration>

Note that <path to ConsoleClient.exe>  must be replaced with the path to the actual ConsoleClient executable.
4. Open an SDK command prompt and change the directory to the one containing the test project.

5. Execute the following command:

svcutil /o:proxy.cs /config:app.config http://localhost:8090/service?wsdl

bearing in mind that the WCF service must still be running.
6. Run the command-line tool using the following command:

“c:\program files\wcfunit\wcfunit” CompileTimeScenario <trace file>  SampleConfig.xml

where the <trace file> is the path to the compile_time_proxy.svclog file created in the previous exercise.

7. The tool should produce the following output:

Parsed message with action http://tempuri.org/IArithmetic/Add [OK]
Parsed message with action http://tempuri.org/IArithmetic/Subtract [OK]

8. Two files called CompileTimeScenario.cs and CompileTimeScenario.stubs will have been produced. Add these files to the test project (need to show all files in the Add Exising Item dialog).

9. Rename CompileTimeScenario.stubs to CompileTimeScenario.Stubs.cs, ignoring the warning from Visual Studio about the file becoming unusable.

10. Also add the proxy.cs and app.config files located in the test project folder to the project.

11. The solution should now build and a unit test called CompileTimeScenario should appear in the Test View.

12. Make sure that the sample service is running.

13. Run the CompileTimeScenario unit test. This will make the same two calls that the ConsoleClient made.

 

Coordinator
Nov 19, 2009 at 5:14 PM

I suspect that you have not included the actual name of the exe file in the entry in the XML config file at step 3. It should be:

C:\Documents and Settings\karthigeyan_raju\My Documents\Release2000615CodePlex\Lab\2008\SampleClientProxy\ConsoleClient\bin\Debug\ConsoleClient.exe

Regards

Rob

Nov 20, 2009 at 5:52 AM

Hi Robjarrat,

The entry in the step 3 has been made as suggested by you in the previous post. Now the follwoing message is noticed in the step 6.

C:\Documents and Settings\karthigeyan_raju\My Documents\Visual Studio 2008\Proje
cts\WCFProjectTest\WCFProjectTest>
C:\Documents and Settings\karthigeyan_raju\My Documents\Visual Studio 2008\Proje
cts\WCFProjectTest\WCFProjectTest>"c:\program files\wcfunit\wcfunit" CompileTime
Scenario C:\Documents and Settings\karthigeyan_raju\My Documents\Release20090615
CodePlex\Lab\2008\SampleClientProxy\ConsoleClient  SampleConfig.xml
WCF Load Test Generator Version 3.0.0.0
Usage: wcfunit ScenarioName TraceFileName ConfigurationFileName [TimingsFile]
Example: wcfunit MyScenario app_messages.svclog config.xml

Coordinator
Nov 20, 2009 at 7:00 AM

What you need to do is put the path and name of the exe into the SampleConfig.xml file so that it looks like this:

<?xml version='1.0' encoding='utf-8' ?>
<WcfUnitConfiguration xmlns='http://microsoft.com/wcfunit'
                           testMethodMode='ScenarioMethodOnly'
                           operationTimerMode='IncludeOperationTimers'>
       <assembly fileName="C:\Documents and Settings\karthigeyan_raju\My Documents\Release2000615CodePlex\Lab\2008\SampleClientProxy\ConsoleClient\bin\Debug\ConsoleClient.exe"/>
     <soapActions soapActionMode='Include'>
     </soapActions>
</WcfUnitConfiguration>

Then you invoke wcfunit passing the name of the trace file as the second parameter. In your second post above you seem to be passing the name of a directory instead in the second parameter, and you have not put quotes around it either, which you need because the path contains spaces.

I hope this helps.

Regards

Rob

Nov 30, 2009 at 9:01 AM

Hi RobJorratt,

 

I have put the name of the exe as per you suggestion and is as follows.

<?xml version='1.0' encoding='utf-8' ?>
<WcfUnitConfiguration xmlns='http://microsoft.com/wcfunit'
                           testMethodMode='ScenarioMethodOnly'
                           operationTimerMode='IncludeOperationTimers'>
  <assembly fileName="C:\Documents and Settings\karthigeyan_raju\My Documents\Release20090615CodePlex\Lab\2008\SampleClientProxy\ConsoleClient\bin\Debug\ConsoleClient.exe"/>
 
    <soapActions soapActionMode='Include'>
    </soapActions>
  </WcfUnitConfiguration>

In the Lab document, it was specified as “c:\program files\wcfunit\wcfunit” CompileTimeScenario <trace file>  SampleConfig.xml

where the <trace file> is the path to the compile_time_proxy.svclog file created in the previous exercise. in teh th step. I am stuck here.

I have passed as follows
"c:\program files\wcfunit\wcfunit" CompileTimeScenario C:\Documents and Settings\karthigeyan_raju\My Documents\Release20090615CodePlex\Lab\2008\SampleClientProxy\ConsoleClient\compile_time_proxy.svclog  SampleConfig.xml 

and got the following message.

C:\Documents and Settings\karthigeyan_raju\My Documents\Visual Studio 2008\Proje
cts\WCFProjectTest\WCFProjectTest>"c:\program files\wcfunit\wcfunit" CompileTime
Scenario C:\Documents and Settings\karthigeyan_raju\My Documents\Release20090615
CodePlex\Lab\2008\SampleClientProxy\ConsoleClient\compile_time_proxy.svclog  Sam
pleConfig.xml
WCF Load Test Generator Version 3.0.0.0
Usage: wcfunit ScenarioName TraceFileName ConfigurationFileName [TimingsFile]
Example: wcfunit MyScenario app_messages.svclog config.xml

Could you please correct the syntax or the format of the command "c:\program files\wcfunit\wcfunit" CompileTimeScenario C:\Documents and Settings\karthigeyan_raju\My Documents\Release20090615CodePlex\Lab\2008\SampleClientProxy\ConsoleClient\compile_time_proxy.svclog  SampleConfig.xml 



 

Coordinator
Nov 30, 2009 at 2:05 PM

It looks like you have not put quotes around the path to the trace file, as the path contains spaces you must enclose it in quotes. The command line becomes (note the quotes highlighted in red):

"c:\program files\wcfunit\wcfunit" CompileTimeScenario "C:\Documents and Settings\karthigeyan_raju\My Documents\Release20090615CodePlex\Lab\2008\SampleClientProxy\ConsoleClient\compile_time_proxy.svclog"  SampleConfig.xml 

I hope this helps

Regards

Rob

Dec 1, 2009 at 5:08 AM

Hi Robjarratt,

Your sugestion worked fine. I got the CompileTimeScenario.cs and CompileTimeScenario.stubs files created successfully. Thank you very much.