DTM automation using DSSO and XML-RPC.NET
Trying to automate WHQL testing using the ONE AND ONLY document available on the subject: http://www.microsoft.com/whdc/devtools/wdk/dtm/dtm_dsso.mspx
I've played with the example code and am able to connect, list devices, etc. From there I've created a new project, a .NET 2.0 C# class:
using System;
using System.Reflection;
using System.IO;
using CookComputing.XmlRpc;
using Microsoft.DistributedAutomation.DeviceSelection;
using log4net;
class WhqlXmlRpcService : XmlRpcService
{
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static DeviceScript deviceScript;
[XmlRpcMethod("connect")]
public Boolean Connect(String dtm)
{
Boolean retVal = false;
deviceScript = new DeviceScript();
try
{
deviceScript.ConnectToNamedDataStore(dtm);
retVal = true;
}
catch (Exception e)
{
Log.Debug("Error: " + e.Message);
}
return retVal;
}
}
I'm using XML-RPC.NET to create a server that is hosted by IIS (using ASP.NET 2.0). The DTM Studio is installed in C:\Inetpub\wwwroot\xmlrpc\bin, the same place where the target of my class goes, to assure there are no resolution issues with the dozen or so .dll's I reference (as instructed by the DSSO doc). I tried adding the necessary DSSO libraries to the GAC to avoid this, but not all of them have strong names. So, despite being able to see all the libraries it needs to link against (and the Studio app functions just fine installed in a non-standard location), attempting .ConnectToNamedDatastore("nameofDTM") still results in the following:
xmlrpclib.Fault: <Fault 0: 'Could not connect to the controller to retrieve information. Several issues can cause this error including missing or corrupt files from the installation, running the studio application from a folder other than the install folder, and running an application that accesses the scripting APIs from a folder other than the installation folder.'>
I'm accessing the scripting APIs from the installation folder, as开发者_Go百科 it's the same dir as my web service .dll, and the files aren't corrupt, because if I stick an .exe with the DSSO sample code in that same directory I can see it connect just fine in the debugger.
I'm at the end of my rope with this, and have been unable to find a helpful source for DTM/DSSO info anywhere.
Anyone done anything similar in the past, or had any success automating their WHQL testing?
I was unable to get this to work using an ASP.NET web service .dll, however, I was able to access the DSSO API by making my XML RPC server available using the HttpListener class in .NET. If you deploy the target application into the same directory as DTM Studio, all works as expected.
For an example of how to use XML-RPC.NET with HttpListener, see: http://www.cookcomputing.com/blog/archives/000572.html
Note: "ListenerService" has been incorporated into the latest versions of XML-RPC.NET since the time of the linked post above. It can be found under CookComputing.XmlRpc.XmlRpcListenerService
精彩评论