使用DSSO和XML-RPC.NET的DTM自动化

时间:2010-10-26 18:52:36

标签: c# xml-rpc

尝试使用主题上提供的ONE AND ONLY文档自动化WHQL测试:http://www.microsoft.com/whdc/devtools/wdk/dtm/dtm_dsso.mspx

我玩过示例代码,能够连接,列出设备等。从那里我创建了一个新项目,一个.NET 2.0 C#类:

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;
    }
}

我正在使用XML-RPC.NET来创建由IIS托管的服务器(使用ASP.NET 2.0)。 DTM Studio安装在C:\ Inetpub \ wwwroot \ xmlrpc \ bin中,这是我班级目​​标所在的地方,以确保没有解决问题的十几个.dll我的参考(根据DSSO的指示) DOC)。我尝试将必要的DSSO库添加到GAC以避免这种情况,但并非所有这些库都具有强名称。因此,尽管能够看到它需要链接的所有库(并且Studio应用程序功能很好地安装在非标准位置),但尝试.ConnectToNamedDatastore(“nameofDTM”)仍然会产生以下结果:

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.'>

我正在从安装文件夹访问脚本API,因为它与我的Web服务.dll是相同的目录,并且文件没有损坏,因为如果我将.exe与DSSO示例代码粘在同一个目录我可以看到它在调试器中连接得很好。

我已经走到了尽头,无法在任何地方找到有用的DTM / DSSO信息来源。

过去做过类似事情的人,或者自动进行WHQL测试有没有成功?

1 个答案:

答案 0 :(得分:0)

我无法使用ASP.NET Web服务.dll工作,但是,我能够通过使用.NET中的HttpListener类使我的XML RPC服务器可用来访问DSSO API。如果将目标应用程序部署到与DTM Studio相同的目录中,则所有目录都按预期工作。

有关如何将XML-RPC.NET与HttpListener一起使用的示例,请参阅: http://www.cookcomputing.com/blog/archives/000572.html

注意:自上面链接帖子发布以来,“ListenerService”已合并到最新版本的XML-RPC.NET中。它可以在CookComputing.XmlRpc.XmlRpcListenerService

下找到