Professional Documents
Culture Documents
Authors Raj Kamal (rajkamal@microsoft.com) Vipul Mehta (vmehta@microsoft.com ) Ranjit Gupta (rankumar@microsoft.com ) Gunjan Jain (gunjain@microsoft.com ) Microsoft Services - Global Delivery, India
Page 1
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Contents Objective .................................................................................................................................................. 3 Importance of Web Service Automation ................................................................................................... 3 Ideal Candidates ....................................................................................................................................... 4 Test Approach Identify your goal (Functional Test or Performance Test or Both) ................................... 4 Test Objective .................................................................................................................................................. 4 Choosing the appropriate Test Type (Unit Test or Web Test) ......................................................................... 5 Sample Lab Application: Web Service Automation ................................................................................... 6 Web Services Automation Unit Test Walkthrough ................................................................................. 7 Creating a new Unit Test Project / Reusing Sample Template Unit Test Project ............................................ 7 Unit Test Automation Design & Development (WCF & ASMX based services) ............................................. 13 Web Services Automation Web Test Walkthrough ............................................................................... 19 Creating a new Web Test Project / Reusing Template Web Test Project...................................................... 20 WebTest Automation Design & Development (WCF & ASMX based services) ............................................. 24 Automation Execution & Deployment (Unit Test/Web Test)................................................................... 29 Web Service Performance Testing using Unit Test/Web Test + Load Test ............................................... 32 Web Services Helper Documentation for Unit Test & Web Test Add-ins ................................................. 38 Tools to speed up Web Services Testing .................................................................................................. 50 WCF Load Test ............................................................................................................................................... 50 Web Test Plug In for Silverlight + RIA based services .................................................................................... 54 Web Services Automation Benefits ......................................................................................................... 55 Appendix ................................................................................................................................................ 56 i. Getting Started with VS 2010 Unit Test & Web Test .............................................................................. 56
Walkthrough: Creating and Running Unit Tests ............................................................................................ 56 Web Performance Test Walkthroughs .......................................................................................................... 56 Introduction to WCF Testing ......................................................................................................................... 56 ii. Deploying Sample Web Services Application ................................................................................... 56 Step 1: Deploy sample DB ...................................................................................................................... 56 Step 2. Deploy our services .................................................................................................................... 57 Step 3. Run Sample Client apps .............................................................................................................. 62 iii. iv. v. Sample Restful Services .................................................................................................................... 64 Request/Request XML for services not supported by Fiddler/ WCFTestClient ................................ 64 Binding & Hosting configuration & consideration ............................................................................ 65
Page 2
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
vi.
Objective
This artifact will provide Web Services Automation guidance for Functional & Performance Testing leveraging VS 2010. The document will provide recommendation on using either Unit Test or Web Test for functional testing depending on your project and test objective as will be later covered in the document. Load Test will be used for Performance Testing in both cases. The primary objective is to propose a viable web services test automation approach & reusable libraries to customers, partners and consultant. It will also be a step in standardizing web services automation using VS 2010 platform across the Industry and filling the gaps by extending our tools as suggested in the talk. The document can also be used as a quick jump start guide for beginners to get started on Web Services Automation Testing. Other than the guidance included in this document, key deliverable will primarily consists of the following: a) Unit Test & Web Test Template projects for Web services testing b) Reusable libraries for Unit Test c) Reusable Add-ins (Extraction & Validation Rules) for Web Test that can be reused to reduce automation development effort drastically. d) Performance Testing using Load Test once the Web Tests/Unit Tests are in place. e) Sample Web Services application for beginners to gets started
Pre-requisites:
Ensure you have downloaded and deployed WebServiceAutomation_SampleApp that contains sample Web services projects (WCF/ASMX/WF etc.) that you can use to getting started with Web Services automation. Verify you have downloaded our sample Template projects WebServiceAutomation_SampleUnitTest and WebServiceAutomation_SampleWebTest that contain sample unit test/web test which you can reuse / customize for your needs Ensure you have downloaded our Reusable Libraries for Unit Testing (WebServicesTesting.Automation.UnitTest.Helper.dll) & Web Test (WebServicesTesting.Automation.WebTest.Helper.dll) Visual Studio 2010, SQL Server Express or higher version, IIS (Internet Information Server 6.0 or above
Page 3
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Web Services (WCF/ASMX) due to their worldwide implementation and popularity but limited test tool support, often raises the question around testing them effectively. Testers are craving to find effective ways to Test Web Services. Even VS 2010 doesnt have dedicated test types for verifying Web Services (like for UI, there is Coded UI and for DB there is Database Unit Test) which results in low test coverage and nonstandardization of proven ways to test web services especially WCF 4.0 Web Services. Web Services Testing in VS 2010 so far has been not been given a first-class citizen treatment and this guidance will bridge that gap by making it much easier and effective. In this agile development era, we are moving to a model where UI is ever changing and consummation of web services is taking the centre stage and hence this layer attention it truly deserves by shifting the onus from UI testing to Web Services based validation. Traditionally teams have also used Fiddler and other 3 Party tools for the same purpose (many times for manual testing alone) but as Web services have different needs, the knowledge harvested doesnt get reused to its potential in future engagements
rd
Ideal Candidates
If your application is consuming APIs exposed by other upstream systems or 3rd Parties If your application is exposing APIs to be consumed by the downstream applications When your UI is dynamic and constantly changing and cost/maintenance of UI automation is much more. When your business logic and rules are primarily implemented using services (ASMX, WCF & Workflow Services) and testing at this layer is much faster and efficient. When you need to come up with a common automation framework for web services that can be used to validate both functional and performance aspect of the web services with minimum effort.
Test Approach Identify your goal (Functional Test or Performance Test or Both)
When we understand and realize the importance of Web Services Automation, the next challenge is to select the right Test approach and Test Type before jumping into automation design and implementation.
Test Objective
It is important to answer the basic question Why do you want to do Web Services Testing? and that will help you decide the right kind of Test you should choose to automate them. Lets begin with few possible answers To validate the functional behaviour of your application / APIs To validate the performance aspect of your application/ APIs To first validate the functionality and then also test the performance aspect of it. (a) + (b)
Page 4
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Now when you know about your test objective, you should also look at the technologies being used for your Web Services as that can make a difference as well. If you use Microsoft platform, chances are your services are built on: ASMX Legacy aps WCF New apps WF Window Workflow Foundation
Page 6
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Creating a new Unit Test Project / Reusing Sample Template Unit Test Project
You can create a new project from scratch or using our existing sample template project but its important to add your project to source control for version management and change tracking.
SL No. 1.
Topics Have you identifie d& marked the automat able tests as PLANNE D in Microso ft Test Manage r (MTM)
Description Open your test cases in Test Manager that you want to automate and mark Automation Status = Planned for those
Whereas the test which are not good candidates for automation are marked as Not Automated to show that they are out-of-scope for automation.
Page 7
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
This is an optional step if you dont want to run your test from Microsoft Test Manager and map your automation to manual test cases. We however recommend this.
2. a
Have you created new Test project & Added it to Source Control (TFS)?
Add project to Source Control by clicking the check box as shown and give appropriate name. 2.b Alternat ively, Open existing Test project and using it as Templat e
Launch Visual Studio, Browse and open existing WebServiceAutomation_SampleUnitTest template project and add it to Source control. You can change the properties as per your needs.
Page 8
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
For this sample template project we have SampleUnitTestCases.cs that contains all our sample reusable unit test cases.
Please find below a short description on the folder structure of the template project which will be used for case study: 1. Config: All your application configuration details that you need to run your test will go to app.config
Page 9
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Example:
2.
Common Libraries References: Add references to our reusable helper library WebServicesTesting.Automation.UnitTest.Helper.dll for Unit Test Web Services Testing (provided as part of the release and documented below)
3.
Service References: Add / update services reference to point to your web services and provide a logical name
Page 10
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
4.
Scripts: Your actual test are stored in these .cs files along with components like Test Initialize, Test Cleanup etc You can create a folder structure to organize your test methods by grouping them in multiple class files depending on the size of the project. It is advisable to group test belonging to same feature/functional module to be grouped together in a .CS file and given an appropriate name.
5.
Solution Configurations & Compilation Symbols With our template solution you get additional solution configuraiton which will help you run your same test for both functional and load test seamlessly by controlling the sections of the code that you may want to execute for functional and load testing For example. When you do load test, you might not want to do certain validation which makes sense for functional testing alone and these configurations will control that by just selecting the appropriate solution configuratio as shown below.
a)
Page 11
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
b) Configuration Functional Testing As shown below it uses a compilation symbol #WEBSERVICES_FUNCTIONAL_TESTING that is used in our test methods to control the behavior.
c)
Inside your test method, you will have code like this to control the behavior based on the solution configuration file that is selected
Page 12
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Unit Test Automation Design & Development (WCF & ASMX based services)
Now that you have your test project in place and our sample reusable unit test cases for automating common web services test scenario, in this section we will be walking you through few sample reusable tests that you can customize it for your own needs or create new unit test for your project scope. The approach shown below would remain same for WCF as well as ASMX based services and we have shown examples of both. Follow the below steps for Automation design guidance: Steps SL No. Global Settings a) Set the test context which provides information about and functionality for the current test run. Description
1.
b) Test Initialize: To perform steps before running each test like instantiating objects, defining global variables including connection strings etc.
c)
2a.
Sample Test scenario: Verifying Web service call response value against expected results Below is sample data driven test method for web services testing that comes with our template project for Unit Test. You can add your new test methods by modeling the below example. Step 1.
Page 13
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Create a new Test method / Modify our existing sample test method Step 2. Instantiate and invoke your web service method (in this example: ASMX based service) as shown in the code snippet below and get the results in a variable of appropriate data type In our sample example, the web service returns an integer datatype which we cast to String for comparison. Your services method can return any data type like int, double, decimal, bool, string etc and we can use the same helper method below to validate the response. Step 3. Get your expected results from data source of your choice as shown below.
Step 4.
Reuse our appropriate library / helper method for validating the web service response against expected results. In this example CompareString is a reusable method in our helper / library that can be called from your test methods to save effort related to validating the results and marking the test as pass/fail. Note: Depending on your test scenario, you need to choose different helper/library methods. The complete documentation about our reusable library method is given in sections below
2b
Sample Test scenario: Verifying Web service call results in database operation like Insert Below is sample test method when tester needs to validate if the web service call results into a Database Insert by validating the database for ensuring the transaction was committed. Instead of Insert, you might have different operations like update, delete etc.
Page 14
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Here the web service method Enroll_Student (in this case WCF based Service) is inserting a record into the database and the expected result is the query against the database to validate the operation to ensure transaction was committed.
Reuse our appropriate library / helper method for validating the web service response against expected results. In this example Verify_DBInsert is a reusable method in our helper / library that can be called from your test methods to save effort related to validating the database insert and marking the test as pass/fail. Note: Depending on your test scenario, you need to choose different helper/library methods. The complete documentation about our reusable library method is given in sections below Add New Test Methods / Reuse Existing Template Test Methods (Handling Complex Object Types)
2c
Use this approach as a generic way of comparing / validating web services response of various data types including user defined/abstract data types like Struct, Classes as well as primitive data types like Int, String, Dictionary, List etc. DTO (Data Transfer Objects) Having the results of a remote method available in an object instance makes it easy to pass this data to a test module or to compare it with the desired outcome It works by converting the service response (whether abstract or primitive data types) and expected results into standard generic objects which then are finally converted into XML for comparison with the help of our reusable library methods as described below in the example Sample Test scenario: Verifying Web service response which returns a Struct object against test data from database.
Page 15
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Step 1: Create Data structure for your object which your service returns as shown below (In this case it returns a Struct which contain elements like First_Name, Last_Name etc.
Step 2. This is an optional step for better organizing your code which invoked your web services and returns the response to the main test method for verification.
Page 16
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Step 4. You can read your data source (in this case database) and convert it into generic DTO object using reusable method in our library called DTO_PopulateDBResults which takes Dataset as input parameter. DTO Type should be same as the type of your complex object (in this case Student which is struct) List<Student> ExpectedStudentDTOList = null; ExpectedStudentDTOList = helper.DTO_PopulateDBResults<Student>(dt);
Step 5. In this step you call you Action code to get your web service response Actions.DTO_Action complexObj = new Actions.DTO_Action(); Object myObj = complexObj.ComplexObjectSample();
Step 6. Convert web services response into generic DTO using our generic library method called DTO_PopulateObject which accepts Object and structure of the object defined above as parameters. object ActualStudentDTOList = helper.DTO_PopulateObject<Student>(myObj, s1);
Step 7. Finally the generic DTO objects returned from expected results i.e. Test data source and Web services response are converted into XML and compared using our reusable library method called DTO_XMLComparison and accordingly marks the test method as pass/fail
Step 8. Expected and Actual XML files with the test method name are created under your folder c:\TestResults for your future reference. Please create this folder if it doesnt exist
3.
Make your scripts datadriven Irrespective of kind of test methods you have created above
Data-Driven Test Ensure every variable is parameterized by passing the test data to each test using data-driven capabilities in VS 2010. Right-click on the test method and select Properties, to view the properties of the test
To start making this a data-driven test, we have to first create a data source for the test to draw from. On the Data Connection String property, click the ellipse button to start the New Test Data Source Wizard There are three options for creating a data source: Database -- which allows you to connect to a database or Microsoft Excel spreadsheet CSV File -- which allows you to use a comma-delimited file XML File -- which allows you to use an XML file
Page 18
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
When you add a data source A Data Source attribute is added to the Test method. [DataSource("System.Data.SqlClient", "Data Source=(local);Initial Catalog=Sample_DB;Integrated Security=True", "Sample_App", DataAccessMethod.Sequential), TestMethod]
4.
This is an optional step if you dont want to run your test from Microsoft Test Manager and map your automation unit test to manual test cases. We however recommend this.
Repeat the above steps for all your test scenarios against your web services to be tested. After you write and debug your scripts its important to run them in a batch or as part of a suite. There are various way to do that and factors to keep in mind as we will see in next section.
Page 19
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Creating a new Web Test Project / Reusing Template Web Test Project
You can create a new project from scratch or using our existing sample template project but its important to add your project to source control for version management and change tracking.
SL No. 1.
Topics
Description
Have you created new Test project & Added it to Source Control (TFS)?
Add project to Source Control by clicking the check box as shown 2. Alternat ively, Open existing Test project and using it as Templat e
Launch Visual Studio, Browse and open existing WebServiceAutomation_SampleWebTest template project and add it to Source control. You can change the properties as per your needs.
Page 20
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Please find below a short description on the folder structure of the template project which will be used for case study:
1.
Common Libraries References: a) Add references to our reusable helper library WebServicesTesting.Automation.WebTest.Helper.dll for WebTest based Web Services Testing (provided as part of the release and documented below)
Page 21
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
c)
Page 22
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
2.
Service References: Add / update services reference to point to your web services and provide a logical name
3.
You can create a folder structure to organize your test methods by grouping them in multiple class files depending on the size of the project. It is advisable to group test belonging to same feature/functional module to be grouped together in a .CS file and given an appropriate name.
For this sample template project we have many reusable webtest that can be reused / customized for your needs.
Page 23
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
4.
Test Data: You can choose to have you test data as CSV or XML or Database as support by Visual Studio Testing framework for making your test data driven.
WebTest Automation Design & Development (WCF & ASMX based services)
Now that you have your test project in place, in this section we will be walking you through our sample reusable Web test for automating common web services test scenario that you can customize it for your own needs or create new additional Web tests for your project scope. Follow the below steps for Automation design guidance: S No. Steps Add New Web Test / Reuse Existing Templat e Web Test (Datase t Verifica tion for WCF/ ASMX Service) Description Sample Test scenario: Verifying Web service method that returns a dataset against the expected test data from Database If you are adding a new web test from scratch then follow the steps: Step 1. Open your web service method request XML by launching WCFTestClient utility or any other way you are comfortable with.
1a.
Step 2. Add a new Web Test or Reuse our existing template Web Test and customize them
Page 24
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Step 3. Right click the node and press Add Web Service Request and provide your web service URL
Step 4. Right click the node and press Add Header and provide SOAPAction value as shown below by retrieving it from request XML of Step 1.
Step 5. Add <string body> a) From your request XML as shown below, extract Envelope and Body (you shouldnt copy Header part)
Page 25
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <Display xmlns="http://tempuri.org/" /> </s:Body> </s:Envelope> b) Add this to to you string body now
Step 6. Add our reusable Validation and Extraction Rule called DatasetValidation that reads the expected data from database using SQL query and validate it against the response from web services by using XPathExpression
Note: Depending on your test scenario, you may need to choose different Extraction and Validation Rule complete documentation about our reusable library method is given in sections below
1b.
Sample Test scenario: Verifying Web service method parameters and response values against expected test data.
Page 26
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Test
Step 6. Add our reusable Extraction Rule called ParameterExtraction and provide XPathExpression for example Enroll_Student and it will retrieve all the parameters name and their respective values and store it inside ContextParam
Step 7. Step 6. Add our reusable Validation Rule called ParamValidation and provide ParamValues that contain expected test data as shown below along with contextParam name as defined in Step 6.
Page 27
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Step 8 & 9. As shown in this web test you can also add our reusable ServiceResponseExtraction and ServiceResponseValidation rules from our helper class for validating the response values against expected test data. Step 8. After you run this web test, the result will show Pass / Fail with context tab showing the discrepancies if any.
Note: Depending on your test scenario, you may need to choose different helper/library methods. The complete documentation about our reusable library method is given in sections below
2.
Data-Driven Test Ensure every variable is parameterized by passing the test data to each test using data-driven capabilities in VS 2010.
Page 28
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
To start making this a data-driven test, we have to first create a data source for the test to draw from. On the Data Connection String property, click the ellipse button to start the New Test Data Source Wizard There are three options for creating a data source: Database -- which allows you to connect to a database or Microsoft Excel spreadsheet CSV File -- which allows you to use a comma-delimited file XML File -- which allows you to use an XML file
Repeat the above steps for all your test scenarios against your web services to be tested. After you write and debug your scripts its important to run them in a batch or as part of a suite. There are various way to do that and factors to keep in mind as we will see in next section.
After automation design and debugging is completed, you can now run and deploy your automation scripts using the below steps:
SL No. 1.
Areas
Description
Test Settings a) Data and Diagnostic: Enable appropriate diagnostic are selected as shown below (Code Coverage, Event Log, Test Impact etc.)
b) Define other settings like Roles, Test Timeouts, Setup and Clean scripts
2.
Grouping & Classifying Test Methods using various parameters It lets you run groups of tests based on their assigned categories without the requirement to maintain test lists.
Go to Test View and you can filter and view your tests by setting these parameters
Page 30
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
MSTest.EXE Options: MSTest.exe is the command-line command that is used to run tests. This command has several options that you can use to customize your test run. You can specify these options in any order on the MSTest.exe command line. Example: mstest /testcontainer:"C:\ WebServiceAutomation_SampleUnitTest" /test:testproject32\generic Refer to http://msdn.microsoft.com/en-us/library/ms182489.aspx
3.
TCM.exe or Test Execution from Microsoft Test Manager (Optional though recomme nded)
a) If you have mapped you automation unit test with test cases in Microsoft Test Manager then you can use TCM.exe as shown below to run your web service test and it will also update your test cases results in MTM without any custom code. You dont need to use MSTest.exe in that case Example: tcm run /create /title:title /planid: id /collection:CollectionURL /teampro ject:project (suiteid:id /configid:configid | /querytext: query) [/settingsn ame:name] [/owner:owner] [/builddir:directory] [/testenvironment:na me] [/login:username,[password]] [/include] Refer to : http://msdn.microsoft.com/en-us/library/dd465192.aspx & http://msdn.microsoft.com/en-us/library/ff942469.aspx
b)You can also Run Automated Tests from a Test Plan Using Microsoft Test Manager. To run the latest version of your automated test, you must make sure that the correct build is selected for your test plan. You must also use a physical or virtual environment to run your automated tests. This is out of scope of this guidance however we recommend this the most. Refer to: http://msdn.microsoft.com/en-us/library/dd553270.aspx
Page 31
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Web Service Performance Testing using Unit Test/Web Test + Load Test
Now when you have your Web Services Test automated either using Unit Test or Web Test as suggested in this guidance above, you can go ahead and create you Load Test to performance test your web services. SL No. 1. Areas Configura tion Load Testing Description
a)
Ensure you have selected our custom solution configuration for Load Test i.e. Debug Load Test
b) As shown below it uses a compilation symbol #WEBSERVICES_LOAD_TESTING that is used in our test methods to control the behavior.
c)
Inside your test methods, you will have code like this to control the behavior based on the solution configuration file that is selected
Page 32
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
2.
Creating Load Test using Web Services Unit Test or Web Test (Designed in above sections)
Page 33
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Step 5. This is the most important step where you have an option to select Unit Test or Web Test to be added to your Load test depending on the kind of approach you had selected for your Web services automation above Press Add and select your Web Services Unit Test OR Web Services Web Tests created in the sections above that you want to performance test
Page 34
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Step 6. Refer to below section for adding custom web services counters other than standard counters that you may want to monitor
Page 35
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Our sample Unit Test and WebTest template project has this reusable SampleLoadTest.loadtest sample load test for you to model your load tests around.
3.
For Web services Load testing, we recommend you adding following custom counters against the web services server (where the web services are hosted): ServiceModelEndPoint 3 ServiceModelEndPoint 4 ServiceModelOperation ServiceModelServices
Page 36
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Please follow Adding custom counters set using Load Test Editor for detailed steps. Step 1. Open you load test. Right click you counter set and add Custom Counter Sets Step 2. Right click and now click Add Counters Select Performance Category to include counters related to Web Services as shown below
Tip: You can enable performance counters for a WCF service through the app.config configuration file of the WCF service as follows: <configuration>
Page 37
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
<system.serviceModel> <diagnostics performanceCounters="All" /> </system.serviceModel> </configuration> Sample Load Test Summary Report
Web Services Helper Documentation for Unit Test & Web Test Add-ins
This section provides documentation of the complete list of reusable helper functions (WebServicesTesting.Automation.WebTest.Helper.dll) and web add-ins (WebServicesTesting.Automation.UnitTest.Helper.dll) for your reference and usage. We have shown few of these in sample walkthrough above to give you a glimpse of the same.
Page 38
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Category
Title
Description
Lookup Verification
Verifies the Scalar value or multiple scalar values of even different data types returned by services against expected results
This method will let you compare the scalar values of different types like <INT>, <STRING> etc. returned by the service method call converting them to <string>against the expected values
Unit Method Signature & Example invoke call public void CompareStringArray(i nt condition, string query, string[] ArrgetAgeActual) Example: obj.CompareStringArr ay(2, query, ArrgetAgeActual);
Web Custom Extension (Extraction & Validation Rules) For scalar value Extraction Rule ServiceResponseExtraction Context Parameters 1.XpathExpression 2.ContextParam Validation Rule ServiceResponseValidation Context Parameters 1.Expected 2.ContextParam For multiple values Validation Rule DataSetValidation Context Parameters 1.ConnString 2.Query 3.XPathExpression 4.ContextParam The validation rule extracts the dictionary returned by web service from xml and compares with the expected dataset based on the query
Lookup Verification
Verifies the values of <DICTIONAR Y> data type returned by services against the expected results
This method will let you compare the <Dictionary> <key, value> values returned by service method call against the expected values <key, value>.
public void CompareDictionaryWi thExpectedArray(Dicti onary<int, string> ActualDic, string[,] ArrgetAgeExpected) Example : obj.CompareDictionar yWithExpectedArray(c ol_Symbols, ArrgetAgeExpected);
Validation Rule DataSetValidation Context Parameters 1.ConnString 2.Query 3.XPathExpression 4.ContextParam The validation rule extracts the dictionary returned by webservice from xml and compares with the expected dataset based on the query
Page 39
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Lookup Verification
Verifies the values of <LIST> data type returned by services against the expected results
This method will let you compare the values of data type <LIST> returned by service method call against the expected values
Validation Rule DataSetValidation Context Parameters 1.ConnString 2.Query 3.XPathExpression 4.ContextParam The validation rule extracts the List returned by webservice from xml and compares with the expected dataset based on the query
Lookup Verification
This method will let you compare the result set returned by service method call against the expected result set
Method Prototype public void Verify_Dataset(string ConnString, string Query, DataSet dst)
Validation Rule DataSetValidation Context Parameters 1.ConnString 2.Query 3.XPathExpression 4.ContextParam The validation rule extracts the dataset returned by webservice from xml and compares with the expected dataset based on the query
Method Invocation UnitTest help = new UnitTest(); help.Verify_Dataset(c onn, query, set);
Lookup Verification
Verifies the row count of the values returned by Web Services against expected result
This method will let you validate the row count of the values/list/datas et returned by service method call against the expected row count
Method Prototype public void Verify_RowCountData Set(int expected, int actual) Method Invocation UnitTest help = new UnitTest(); help.Verify_RowCount DataSet(expected, actual);
This method extracts the row count and stores the value to Context Param specified by the user. Validation Rule RowValidation Context Parameters 1.ConnString
Page 40
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
2.Query 3.ContextParam 4.ContextParam This method validates the value set to the context param and the one returned by the specified query
Metadata Verification
This method validates the XML file to make sure it fits to your application's needs to prevent any exception in your code. To check whether the XML document conforms to an XSD Schema, the document must be validated against that XSD Schema
Method Prototype public bool Verify_Schema(string targetNameSpace, string xsdPath,string requestXml) Event Handler to raise error private static void ValidationEventHandl er(object sender, System.Xml.Schema.V alidationEventArgs arg) Method Invocation UnitTest help = new UnitTest(); bool validation = help.Verify_Schema(ta rgetNameSpace ,XsdP ath,requestXml);
Metadata Verification
Verifies that web service methods exist and their parameters definition (like input parameters, return type) against expected result
This method will let you smoke test / BVT if the expected list of Web Service methods exists and their definition like input parameters and return type matches.
Method Prototype public void Verify_methodPrototy pe(object myObject, string Methodname, string paramlist, string returnTypelist) Method Invocation UnitTest help = new UnitTest(); help.Verify_methodPr ototype(obj, methodlist, paramlist, returnTypelist);
Extraction Rule ParameterExtraction Context Parameters 1.XpathExpression 2.ContextParam This method extracts the parameter passed to the request and set to the contextparam Validation Rule ParamValidation Context Parameters 1.ParamValues 2.ContextParam
Page 41
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
This method validates the value set to the context param and the Values passed to the ParamValues The above extraction & validation rule is used to validate the parameter passed The below extraction & validation rule is used to validate value returned by the webservice Extraction Rule ServiceResponseExtraction Context Parameters 1.XpathExpression 2.ContextParam Validation Rule ServiceResponseValidation Context Parameters 1.Expected 2.ContextParam Transactional Verification Verifies that called web service method creates the output file as expected This method verifies the output file (e.g. CSV, XML, TXT) has got created by the web service method call Method Prototype public void Verify_FileCreation(str ing FilePath) Method Invocation UnitTest help = new UnitTest(); help.Verify_FileCreati on("D:\\employees.x ml"); Validation Rule FileCreationValidation Context Parameters 1.FilePath
Transactional Verification
Verifies that web service INSERTS/CR EATES a new record into the database
This method verifies the web service call results into new record insertion in a given database
Method Prototype public void Verify_DbInsert(string ConnString, string Query, string expected) Method Invocation UnitTest help = new UnitTest(); help.Verify_DbInsert(c onn, query, expected);
Extraction Rule ParameterExtraction Context Parameters 1.XpathExpression 2.ContextParam This method extracts the parameter passed to the request and set to the contextparam
Page 42
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
This method validates the contextparam and the values returned by the query Transactional Verification Verifies that web service UPDATES existing records into the database This method verifies the web service call results into update of existing record(s) in the given database Method Prototype public void Verify_DBUpdate(strin g ConnString, string Query, string expected) Method Invocation UnitTest help = new UnitTest(); help.Verify_DBUpdate (conn, query, expected); Extraction Rule ParameterExtraction Context Parameters 1.XpathExpression 2.ContextParam This method extracts the parameter passed to the request and set to the contextparam
Validation Rule UpdateDbValidation Context Parameters 1.ConnString 2.ContextParam 3.Query 4.ContextParam This method validates the contextparam and the values returned by the query Transactional Verification Verifies that web service DELETES records into a database This method verifies the web service call results into deletion of existing record(s) from a given database Method Prototype public void Verify_DBDelete(strin g ConnString, string Query) Method Invocation UnitTest help = new UnitTest(); help.Verify_DBDelete( conn, query); Validation Rule DeleteDbValidation Context Parameters 1.ConnString 2.Query This method verifies the rows returned by query is 0
Page 43
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Workflow service
Verify that web service executed the workflow and end result is as expection
_________For this one we just need a test method in our test file instead of a separate helper method____
Sample code to verify the result returned by the workflow IDictionary<string, object> _d = new Dictionary<string, object>() { { "userArgument", arg } }; _d = WorkflowInvoker.Invo ke(new Workflow1(), _d); Int32 outPut = (Int32)_d["OutputValu e"]; Assert.AreEqual(expec ted, outPut); output can be validated with expected for its correctness var ServiceendPoint = new EndpointAddress(new Uri("http://localhost:9 1/Service1.svc"), EndpointIdentity.Crea teDnsIdentity("MyWe bSite")); var binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.Messag e; binding.Security.Mess age.ClientCredentialTy pe = MessageCredentialTyp e.UserName;
WorkFlow cannot be invoked. We can invoke the web service to verify the result returned by service method against the expected result. Extraction Rule ServiceResponseExtraction Context Parameters 1.XpathExpression 2.ContextParam Validation Rule ServiceResponseValidation Context Parameters 1.Expected 2.ContextParam
Authentication
Verifies that user credentials & certificate are validated against the server to authenticate the user trying to access the web service
This method verifies the user credentials and certificate to ensure that he is authenticated to get the results from the web service
Page 44
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
result.ClientCredential s.ServiceCertificate.Au thentication.Certificat eValidationMode = X509CertificateValidat ionMode.None; result.ClientCredential s.UserName.UserNam e = auth_username; result.ClientCredential s.UserName.Password = auth_passwd; time = result.GetServertime() ; } Encryption Verifies that web service is encrypting the message/tra nsport layer when returning data This method will verify that web service is encrypting and decrypting the data as required by business. Configuration appConfig = ConfigurationManager .OpenExeConfiguratio n(ConfigurationUserLe vel.None); ServiceModelSectionG roup serviceModel = ServiceModelSectionG roup.GetSectionGroup (appConfig); Console.WriteLine("Co nfiguration Name : Address : Binding : Contract"); foreach (ChannelEndpointEle ment endpoint in serviceModel.Client.E ndpoints) { if (endpoint.Contract == "Auth_Service.IService 1") { binding_used = endpoint.Binding; break; } else { } }
Page 45
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Auth_Service.Service1 Client result = new Auth_Service.Service1 Client(); result.ClientCredential s.ServiceCertificate.Au thentication.Certificat eValidationMode = X509CertificateValidat ionMode.None; result.ClientCredential s.UserName.UserNam e = auth_username; result.ClientCredential s.UserName.Password = auth_passwd; string time = result.GetServertime() ; TestContext.WriteLine ("Bindings used by this contract is " + binding_used);
Caching
Verifies that data returned by called web service is returned from cache
_________For this one we just need a test method in our test file instead of a separate helper method____ Caching is frequently used as an optimization in distributed systems. It can be used to avoid re-doing computations or complex database access when the results remain valid for an extended period of time.
string url = "http://localhost/Cach e/Service1.svc/xml/12 "; Uri uri = new Uri(url); WebRequest request = (HttpWebRequest)We bRequest.Create(uri); request.Method = "GET"; HttpWebResponse response = (HttpWebResponse)re quest.GetResponse(); Stream receiveStream = response.GetRespons eStream(); StreamReader readStream = new StreamReader(receive
Extraction Rule CacheExtraction Context Parameters 1.XpathExpression 2.ContextParam 3.Delay To test caching two request should be made before caching expire and one after caching expire. Parameter Delay has to be passed for the second request And plugin DelayPlugin should be associated with the second service CacheOutcomePlugin ContextParameters 1.ContextParam1 2.ContextParam2 3.ContextParam3
Page 46
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
In this case, subsequent requests for the same information can be served with the cached version rather than repeat the processing with the associated overheads.
Stream, Encoding.UTF8); string firstResponse = readStream.ReadLine( ); Above code snippet shows to retrieve server response. To test caching two request should be made befor cache expires and should be validated. string url = "http://localhost/Cach e/Service1.svc/xml/12 "; Uri uri = new Uri(url); WebRequest request = (HttpWebRequest)We bRequest.Create(uri); request.Method = "GET"; HttpWebResponse response = (HttpWebResponse)re quest.GetResponse(); Stream receiveStream = response.GetRespons eStream(); StreamReader readStream = new StreamReader(receive Stream, Encoding.UTF8); string firstResponse = readStream.ReadLine( ); Above code snippet shows to retrieve server response.
Caching
Verifies that data returned by called web service is returned from database when cache is expired
_________For this one we just need a test method in our test file instead of a separate helper method____
made before caching expire and one after caching expire and should be validated. Non-XML Data Verifies that called web service method sends/retur ns non-xml data (like blob, image) as expected Verifies that called web service method if implemente d as asynchrono us then returns the data as expected at a later point in time This method will verify that web service method is storing or retrieving the non XML data like blob from file system or database This method verifies the asynchronous behavior of web service method as expected and implemented. Refer our reusable [TestMethod] public void VerifyNonXMLData()
Asynchronous messaging
Verify that service returns appropriate error message when there is a fault exception like underlying database connectivity issue to ensure exception and error handling
This method will verify that web service method that is called handles the exceptions like timeout, connectivity/net working issue as expected
<serviceDebug includeExceptionDetai lInFaults="True" /> Set the IncludeExceptionDetai lInFaults property to true to instruct to return managed exception information to the client in SOAP faults to ease debugging try { WCFServiceRef.Servic e1Client obj = new WCFServiceRef.Servic e1Client(); obj.Display();
Extraction Rule ExceptionExtraction ContextParameter 1.contextParam Validation Rule ExceptionValidation ContextParameter 1.contextParam 2.ErrorMsg ExceptionPlugin ContextParameter 1.contextParam Plugin is used to pass/fail the test case contextParam name provided in extraction/validation/plugin
Page 48
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
} catch (FaultException e) { string str = e.Message.ToString(); TestContext.WriteLine (str); } Merge Verifies the result obtained from multiple web services calls by merging them matches against consolidated expected output This method verifies when similar result is obtained from multiple web services and then need to be validated against single expected result set Think of a scenario where you are getting similar result from various source - each a different web service call. The tester wants to validate the consolidated output from these services by comparing it against expected values It works by converting the service response (whether abstract or primitive data types) and expected results into standard generic objects which then are finally converted into XML for comparison with the help of our reusable library methods as WCFServiceRef.Servic e1Client obj = new WCFServiceRef.Servic e1Client(); string expected = "5 Test"; string exmaple1 = obj.mergeExample().T oString(); string example2 = obj.mergeExample1(); string actual = exmaple1 + " "+ example2; Assert.AreEqual(expec ted, actual);
should be same
Extraction Rule ServiceResponseExtraction Context Parameters 1.XpathExpression 2.ContextParam The extraction rule is used with both the request to extract the response from the server Associate the validation rule nd with the 2 request Validation Rule MergeTwoServcResponseVali dation ContextParameter Context Parameters 1. ContextParam1 2.ContextParam2 3.expected
DTO (Data Transfer Objects) based validation is a generic way to validate web services response of any data type against expected result by converting them into generics
public List<T> DTO_PopulateObject< T>(object DTOObject, object myObj) public List<T> DTO_PopulateDBResul ts<T>(DataTable dt) where T : class public bool DTO_XmlComparison( Object ExpectedDTOList, Object ActualDTOList, Type ObjectType)
Page 49
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
objects
Examples: ExpectedStudentDTOL ist = helper.DTO_Populate DBResults<Student>(d t); object ActualStudentDTOList = helper.DTO_Populate Object<Student>(myO bj, s1);
Page 50
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
2.
Click on Next
3.
Give the path of the executable, its your application exe files, in this case its the sample App application which we are using for the generation of unit test.
Page 51
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
4.
Click on Run, will run the application and load the data as expected.
5.
Test the application; change the values in the List of Students to fire the service with different set of Data. Once this is done, close the application. And click on Next on the New WCF Service Test Generator wizard
6.
There will be screen which depicts what all methods were invoked when we navigated the application with different set of inputs.
Page 52
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
7.
Click Next, Now we need to add the Dll/exe which define the contracts which are implemented for the WCF service which we have consumed.
8.
Click on finish and the Unit tests are created for actions which we have performed on the Application.
Page 53
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
2. After Recording is completed it adds a reference to the runtime assembly to project, and adds the web service plugin to the Web Test
Page 54
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
4. Right click on the selected node, and select Add Extraction Rule or Add Validation Rule from the context menu.
Reference- <http://blogs.msdn.com/b/mahipalkante/archive/2010/04/07/web-test-plugins-forweb-service-messages.aspx>
This will also help to scale up when doing performance testing to ensure that web services behave as per SLA and as-expected when put under lot of stress and load. As a performance engineer, you will be able to do effective performance (load/stress) testing of web services along with validating their behaviour. As developer/consultant, you will be able to use web services automation as part of continuous Integration to improve the build and code quality. As a support engineer, you can also run automation tests quickly to find the culprit such an unintentional regression impact and that will help in debugging and troubleshooting critical failures.
Appendix
i. Getting Started with VS 2010 Unit Test & Web Test
Walkthrough: Creating and Running Unit Tests Web Performance Test Walkthroughs Introduction to WCF Testing
ii.
Page 56
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
This project contains the WCF services will be consumed by Sample_APP_UI. It contains the contract as well as the implementation of the contracts. This project also uses the LinQ feature for integration with the database.
Below is sample step to deploy services on your machine i) Launch solution and publish WcfService project to FileSystem
ii)
Add an application to your IIS and provide the File system directory and App pool details
Page 57
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
iii)
b) Sample ASMX Web Services This project contains the services which are built on ASMX types. These services are also consumed by the Sample_App_UI. For deployment follow the steps given in above step (a).
Page 59
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Note: You can skip this as well if your scope doesnt include testing ASMX based services
c)
This project contains the sample WCF service which is consumed by the workflow application. For deployment follow the steps given in above step (a). Note: You can skip this as well if your scope doesnt include testing Workflow based services
d) Sample Authentication Project This project contains the WCF service which entails the authenticate service. We have used the UserNamePasswordValidator validate method for the verification of the client credentials to authenticate the client. The main intent is to check the authentication of the client, so this service has 1 contract implemented GetServertime which returns the current time at the server.
Page 60
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Note: You can skip this as well if your scope doesnt include testing Authentication of your services e) Sample Non-XML Data Project This project contains the WCF service which is required for returning the non xml data from the service. For this case we are using the service to return the image file using the stream. There are two response from the service implemented under this project. Buffered response Streamed response
Note: You can skip this as well if your scope doesnt include testing of Non-XML based response from web services f) Sample Web Services Caching Project
This project contains a WCF service which contains the service representing the cache behaviour of the WCF service. For this project we have leveraged the Asp.Net cache in the WCF. The response is cached for 60 seconds if the request URL doesnt changes. On changing the parameter to the request URL or elapse of 60 seconds the call again to this service returns the fresh response from the service.
Note: You can skip this as well if your web services dont use caching
g)
This project shows another feature of the WCF asynchronous call where in client sends a request to the server and continues with the regular task and on completion of the service i.e. response comes from server the required action is performed using the response received.
Page 61
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
For this example we have used client making the Asynchronous call using the call-back mechanism. This project contains the contract as well as the Windows client which uses the service return. Note: You can skip this as well if your web services dont use Asynchronous calls Step 3. Run Sample Client apps a) Sample UI application This is the main project in the solution which consumes different services WCF and ASMX. This project is a sample app to demonstrate the services when consumed from UI and their return
Note: Please update the service reference to point to the URL of the our sample web services (WCF and ASMX) as shown below by using Configure service reference
Page 62
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
You can now run sample UI app that consumes WCF and ASMX based services. b) Sample Authentication Console Application This project in the solution contains the client which will test service, and provide the valid credentials so that the service returns the valid return.
This is a console based application which hosts the Auth_Service and send the valid credentials to test it. c) Sample Workflow Console Application
This is a Workflow project which uses the WCF services with in the workflow, and executes the rest of action in the workflow.
This project is just a sample to be demonstrated on how the services are integrated with the WF app.
Page 63
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
iii.
iv.
Page 64
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
Reusable Code snippet: ImageServc.StreamingServiceClient ClientHandle = new ImageServc.StreamingServiceClient(); ResponseXmlInterceptingBehavior responseXmlInterceptingBehaviour = new ResponseXmlInterceptingBehavior(); ClientHandle.Endpoint.Behaviors.Add(responseXmlInterceptingBehaviour); OutputFile = ClientHandle.GetData("Dryden"); string requestXml = responseXmlInterceptingBehaviour.ResponseXmlInterceptor.RequestXml;
v.
Page 65
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com
vi.
Page 66
Web Services Test Automation Guidance using VS 2010 - Unit Test & Web Test, Design Document, Final Prepared by Raj Kamal, rajkamal@microsoft.com