Service-Oriented Architecture (SOA) and the corresponding Service-Oriented Computing (SOC) paradigm have received significant attention as major computer and software companies, such as IBM, Intel, Microsoft, HP, SAP, and Sun Microsystems, have embraced SOA, as well as government agencies such as U.S. Department of Defense (DoD). As more and more applications are built using SOA, actively and aggressively testing services and applications becomes crucial.
Web services are autonomous, modular components that can be described, published by service producers in service registry, and discovered and invoked by service consumers to compose the SOA applications. Aside from traditional functional and performance testing, interopertability and vulnerability testing also need to be performed to ensure services and applications built on them meet the requirements. A number of testing tools have been developed to assist SOA software engineers to test services and applications more efficiently.
SOAPSonar is a comprehensive SOA testing tool developed by the SOA testing leader, CrosscheckNet. SOAPSonar provides enterprise class SOA Web Services testing and diagnostics for ensuring reliable, robust services. It supports functional and regression testing, performance testing, interoperability testing, and vulnerability testing. For interoperability testing, SOAPSonar supports both design-time and run-time interoperability testing. Developers can run a set of comprehensive WSI Profile tests and reports issues in WSDL files that prevent services from interoperating with each other. For vulnerability and identity testing, it supports identity standards User Name, X.509 and SAML protocol, which are commonly used in the SOA development. Although, SOAPSonar provides supports of atomic service testing and operation chaining testing, it fails to provide dependency analysis for regresssion testing based on workflows, application templates, collaboration templates.
SOAPscope, an SOA development suite, provides a testing tool called SOAPscope Tester. Claimed by Mindreef, the company that developed SOAPscope, the testing support provided by SOAPscope is through the whole lifecylce of SOA development, SOAPscope is quality driven SOA. SOAPscopte tester allow developers to test web services by dynamically creating a request using the SOAPscopte UI, sending the request to the server, and displaying the results. It can run the functional tests stored in Test Suites automatically, however all test cases in the Test Suites have to be added manually as importing external testing cases is not supported(? needs to be verified). It can also create service simulation either by capturing SOAP messages or directly from a WSDL file. Unlike SOAPSonar, SOAPscopte does not support interoperability and vulnerability testng. SOAPscope Tester did not address issues with workflows, application templates and collaboration templates either, therefore its regression testing lacks dependency analysis and traceability.
ITKO LISA 4 SOA Testing and Validation suite, developed by ITKO, is a testing/simulation tool featured with Lisa Virtual Service Environment which captures service behavivors and virtualized them. Because of this virtual environment, development and testing is freed from havig to deploy. It supports functional and regression testing, end-to-end integration testing, performance testing as well as monitoring after deployment. All of LISA’s test functionaility is an independently developed platform, so it minizes the risk in complex, changing enterprise appplicaitons, however, it also hinders the sharing of test cases which, in return, is against the principle of SOA.
Tuesday, October 14, 2008
Subject of SOA Testing
General speaking, SOA Testing should do following things:1. SOA protocol testing. You need to test performance of SOAP protocols.2. Test and evaluate individual services. You need to write program to test the service that you want to use.3. Test an integrated application or composite services. You need to write program to test the composed web service and integrated application to see if they work as you wished.4. Quality of Service (QoS) evaluation. You need to evaluate the QoS. Because you can not get it directly from service contract or WSDL.5. Interoperability testing. You need to do conformance testing to ensure SOA protocol compliance.6. Regression testing. To guarantee modification correct.7. Load/Stressing testing. To make sure the service work well under some stressful condition.8. Monitor testing. You need to get runtime information from monitor testing.9. Security testing. You need to see if your service is secure enough.10. Testing service brokers. You need to test your service brokers can do normal things correctly such as registration and discovery.11. SOA testing and evaluation framework. You need to build up a good framework to perform all kinds of SOA testing.12. SOA testing tool testing. You need to decide if you need to use any SOA testing tool and which tools can guarantee your testing requirement.
A userful Webservice class file!
We want to share some useful web service help Charp class. You can use this class to dynamically call web service!
Dynamic call webservice can be divided into following steps:
1. download WSDL from given URL.
2. create and formate WSDL by using ServiceDescription class.
3. create client proxy class by using ServiceDescriptionImporter class.
4. dynamic create program enviroment for client proxy class by using CodeDom class.
5. invoke web service by using class reflection.
The source can be illustrated as WebServiceHelper class:
using System;using System.Data;using System.Configuration;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.CodeDom.Compiler;using System.Net;using System.CodeDom;using System.IO;using System.Collections.Generic;using System.Reflection;using Microsoft.CSharp;using System.Web.Services;using System.Web.Services.Protocols;using System.Web.Services.Description;using System.Xml.Serialization;
namespace WebServiceTest{ public class WebServiceHelper { static SortedList typeList = new SortedList(); static string getCachedKey(string url, string className) { return url.ToLower()+className; } static Type getTypeFromCash(string url, string className) { string myKey = getCachedKey(url,className); foreach(KeyValuePair pair in typeList) { if (myKey == pair.Key) { return pair.Value; } } return null; } static Type getTypeFromWebService(string url, string className) { //string @namespace = “WebServiceTest”; url = getUrl(url); if ((className == null) (className == “”)) { className = getWSClassName(url); }
//1. using webclient to download wsdl WebClient webClient = new WebClient(); Stream stream = webClient.OpenRead(url + “?WSDL”);
//2. create and serialize wsdl document ServiceDescription description = ServiceDescription.Read(stream);
//3. create client proxy class ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
importer.ProtocolName = “SOAP”; //assign transport protocol importer.Style = ServiceDescriptionImportStyle.Client; //create client proxy importer.CodeGenerationOptions = CodeGenerationOptions.GenerateProperties CodeGenerationOptions.GenerateNewAsync; importer.AddServiceDescription(description, null, null); //add WSDL document
//4. using CodeDom compile proxy class CodeNamespace nmspace = new CodeNamespace(); //You can define namespace for the proxy. Defalt is global. CodeCompileUnit unit = new CodeCompileUnit(); unit.Namespaces.Add(nmspace);
ServiceDescriptionImportWarnings warning = importer.Import(nmspace, unit); CodeDomProvider provider = CodeDomProvider.CreateProvider(”CSharp”);
CompilerParameters parameters = new CompilerParameters(); parameters.GenerateExecutable = false; parameters.GenerateInMemory = true; parameters.ReferencedAssemblies.Add(”System.dll”); parameters.ReferencedAssemblies.Add(”System.XML.dll”); parameters.ReferencedAssemblies.Add(”System.Web.Services.dll”); parameters.ReferencedAssemblies.Add(”System.Data.dll”); CompilerResults result = provider.CompileAssemblyFromDom(parameters, unit); if(true == result.Errors.HasErrors) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach(CompilerError ce in result.Errors) { sb.Append(ce.ToString()); sb.Append(Environment.NewLine); } throw new Exception(sb.ToString()); } Assembly assembly = result.CompiledAssembly; Type t = assembly.GetType(className); return t; } public static object invokeWebService(string url,string methodName, object[] args) { return invokeWebService(url,null,methodName,args); } public static object invokeWebService(string url, string className, string methodName, object[] args) { try { Type t = getTypeFromCash(url, className); if(t==null) { t = getTypeFromWebService(url,className); string key = getCachedKey(url,className); typeList.Add(key,t); }
object obj = Activator.CreateInstance(t); MethodInfo mi = t.GetMethod(methodName); return mi.Invoke(obj,args); } catch(Exception ex) { throw new Exception(ex.InnerException.Message,new Exception(ex.InnerException.StackTrace)); } } static string getWSClassName(string url) { string[] parts = url.Split(’/'); string[] pps = parts[parts.Length - 1].Split(’.'); return pps[0]; } static string getUrl(string url) { //url = url + “?WSDL”; int wsdlPosition = url.ToUpper().IndexOf(”?WSDL”); if ( wsdlPosition != -1) { return url.Substring(0,wsdlPosition); } return url; } }}You can import this class into your project and test it by following code:
string url = “http://www.webservicex.net/globalweather.asmx“;
string[] args = new string[2];
args[0]=”Chongqing”;
args[1]=”China”;
object result = WebServiceHelper. InvokeWebService(url, “GetWeather”,args);
Console.Writeline(”The result is %s”, result.toString());
Dynamic call webservice can be divided into following steps:
1. download WSDL from given URL.
2. create and formate WSDL by using ServiceDescription class.
3. create client proxy class by using ServiceDescriptionImporter class.
4. dynamic create program enviroment for client proxy class by using CodeDom class.
5. invoke web service by using class reflection.
The source can be illustrated as WebServiceHelper class:
using System;using System.Data;using System.Configuration;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.CodeDom.Compiler;using System.Net;using System.CodeDom;using System.IO;using System.Collections.Generic;using System.Reflection;using Microsoft.CSharp;using System.Web.Services;using System.Web.Services.Protocols;using System.Web.Services.Description;using System.Xml.Serialization;
namespace WebServiceTest{ public class WebServiceHelper { static SortedList typeList = new SortedList(); static string getCachedKey(string url, string className) { return url.ToLower()+className; } static Type getTypeFromCash(string url, string className) { string myKey = getCachedKey(url,className); foreach(KeyValuePair pair in typeList) { if (myKey == pair.Key) { return pair.Value; } } return null; } static Type getTypeFromWebService(string url, string className) { //string @namespace = “WebServiceTest”; url = getUrl(url); if ((className == null) (className == “”)) { className = getWSClassName(url); }
//1. using webclient to download wsdl WebClient webClient = new WebClient(); Stream stream = webClient.OpenRead(url + “?WSDL”);
//2. create and serialize wsdl document ServiceDescription description = ServiceDescription.Read(stream);
//3. create client proxy class ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
importer.ProtocolName = “SOAP”; //assign transport protocol importer.Style = ServiceDescriptionImportStyle.Client; //create client proxy importer.CodeGenerationOptions = CodeGenerationOptions.GenerateProperties CodeGenerationOptions.GenerateNewAsync; importer.AddServiceDescription(description, null, null); //add WSDL document
//4. using CodeDom compile proxy class CodeNamespace nmspace = new CodeNamespace(); //You can define namespace for the proxy. Defalt is global. CodeCompileUnit unit = new CodeCompileUnit(); unit.Namespaces.Add(nmspace);
ServiceDescriptionImportWarnings warning = importer.Import(nmspace, unit); CodeDomProvider provider = CodeDomProvider.CreateProvider(”CSharp”);
CompilerParameters parameters = new CompilerParameters(); parameters.GenerateExecutable = false; parameters.GenerateInMemory = true; parameters.ReferencedAssemblies.Add(”System.dll”); parameters.ReferencedAssemblies.Add(”System.XML.dll”); parameters.ReferencedAssemblies.Add(”System.Web.Services.dll”); parameters.ReferencedAssemblies.Add(”System.Data.dll”); CompilerResults result = provider.CompileAssemblyFromDom(parameters, unit); if(true == result.Errors.HasErrors) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach(CompilerError ce in result.Errors) { sb.Append(ce.ToString()); sb.Append(Environment.NewLine); } throw new Exception(sb.ToString()); } Assembly assembly = result.CompiledAssembly; Type t = assembly.GetType(className); return t; } public static object invokeWebService(string url,string methodName, object[] args) { return invokeWebService(url,null,methodName,args); } public static object invokeWebService(string url, string className, string methodName, object[] args) { try { Type t = getTypeFromCash(url, className); if(t==null) { t = getTypeFromWebService(url,className); string key = getCachedKey(url,className); typeList.Add(key,t); }
object obj = Activator.CreateInstance(t); MethodInfo mi = t.GetMethod(methodName); return mi.Invoke(obj,args); } catch(Exception ex) { throw new Exception(ex.InnerException.Message,new Exception(ex.InnerException.StackTrace)); } } static string getWSClassName(string url) { string[] parts = url.Split(’/'); string[] pps = parts[parts.Length - 1].Split(’.'); return pps[0]; } static string getUrl(string url) { //url = url + “?WSDL”; int wsdlPosition = url.ToUpper().IndexOf(”?WSDL”); if ( wsdlPosition != -1) { return url.Substring(0,wsdlPosition); } return url; } }}You can import this class into your project and test it by following code:
string url = “http://www.webservicex.net/globalweather.asmx“;
string[] args = new string[2];
args[0]=”Chongqing”;
args[1]=”China”;
object result = WebServiceHelper. InvokeWebService(url, “GetWeather”,args);
Console.Writeline(”The result is %s”, result.toString());
SOA Testing!
Hi welcome to see our blog. Our team is Guanqiu, Xin and Benben. We will talk about SOA test here. If you want to do same research, please join us.
Subscribe to:
Comments (Atom)