Load Runner .Net - 找到类型未定义的对象

Load Runner .Net - Found an undefined object of type

我正在尝试在 Load Runner 12.01 中记录 .net 胖客户端应用程序 (4.5.2),但出现以下错误。有人可以帮忙吗

namespace Script {
    using LoadRunner;
    using Mercury.LoadRunner.DotNetProtocol.Replay;
    using OM.EXIGO.SGUI;
    using OM.EXIGO.SGUI.WscServicesAPI;
    using OM.EXIGO.SGUI.WsCUsersAndRolesAPI;
    using Script.Accessors;
    using System;
    using System.Data;
    using System.Net;


    public partial class VuserClass {

        public virtual int Action() {
            lr.think_time(11);
            lr.log("Event 1: new NetworkCredential();");
            NetworkCredential_1 = new NetworkCredential();
            lr.log("Event 2: NetworkCredential_1.UserName = \"NEWUSERT1\";");
            NetworkCredential_1.UserName = "CITI20T1";
            lr.log("Event 3: NetworkCredential_1.Password = \"passowrd1234\";");
            NetworkCredential_1.Password = "passowrd1234";
            lr.log("Event 4: new AssemblyWithVersionDS();");
            AssemblyWithVersionDS_1 = new AssemblyWithVersionDS();
            lr.log("Event 5: AssemblyWithVersionDS_1.AssemblyWithVersionDT;");
            AssemblyWithVersionDTDataTable_1 = AssemblyWithVersionDS_1.AssemblyWithVersionDT;
            // Table AssemblyWithVersionDTDataTable_1 is empty
            lr.log("Event 6: AssemblyWithVersionDTDataTable_1.AddAssemblyWithVersionDTRow(\"OM.EXIGO.d"
+
              "ll\", \"2.7.1.1498\");");
            AssemblyWithVersionDTRow_1 = AssemblyWithVersionDTDataTable_1.AddAssemblyWithVersionDTRow("OM.EXIGO.dll", "2.7.1.1498");
            lr.log("Event 7: NetworkCredential_1.UserName;");
            StringRetVal = NetworkCredential_1.UserName;
            #warning:  Code Generation Error
            // Found an undefined object of type System.Xml.XmlTextWriter. Assigning it the name writer_1.
            // Suggested solution: adding both this type, in assembly System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, to the filter
            // and/or any other types that return instances of this one.
            // Note:  This script will not compile as is.
            lr.log("Event 8: new DataSet_Accessor(AssemblyWithVersionDS_1).WriteXml(writer_1);");
            new DataSet_Accessor(AssemblyWithVersionDS_1).WriteXml(writer_1);
            #warning:  Code Generation Warning
            // Note:  writer_1 is not included in the recording filter.
            // Its state may have changed since it was last detected.
            #warning:  Code Generation Error
            // Found an undefined object of type OM.EXIGO.SGUI.WscServicesAPI.AssemblyWithVersionDS. Assigning it the name AssemblyWithVersionDS_2.
            // Suggested solution: adding both this type, in assembly SGUIWebReferences, Version=2.7.1.0, Culture=neutral, PublicKeyToken=8941f02d31442b70, to the filter
            // and/or any other types that return instances of this one.
            // Note:  This script will not compile as is.
            lr.log("Event 9: new DataSet_Accessor(AssemblyWithVersionDS_2).WriteXml(writer_1);");
            new DataSet_Accessor(AssemblyWithVersionDS_2).WriteXml(writer_1);
            lr.log("Event 10: NetworkCredential_1.GetCredential(new Uri(\"https://testdomain.com/HEXAPIRelease5/SGServiceA/CServicesAPI.asmx\"), \"digest\");");
            NetworkCredential_1 = NetworkCredential_1.GetCredential(new Uri("https://testdomain.com/HEXAPIRelease5/SGServiceA/CServicesAPI.asmx"), "digest");
            lr.log("Event 11: NetworkCredential_1.GetCredential(new Uri(\"https://testdomain.com/HEXAPIRelease5/SGServiceA/CServicesAPI.asmx\"), \"basic\");");
            NetworkCredential_1 = NetworkCredential_1.GetCredential(new Uri("https://testdomain.com/HEXAPIRelease5/SGServiceA/CServicesAPI.asmx"), "basic");
            lr.log("Event 12: new AssemblyWithVersionDS();");
            AssemblyWithVersionDS_3 = new AssemblyWithVersionDS();
            #warning:  Code Generation Error
            // Found an undefined object of type System.Xml.XmlTextReader. Assigning it the name reader_1.
            // Suggested solution: adding both this type, in assembly System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, to the filter
            // and/or any other types that return instances of this one.
            // Note:  This script will not compile as is.
            lr.log("Event 13: new DataSet_Accessor(AssemblyWithVersionDS_3).ReadXml(reader_1);");
            new DataSet_Accessor(AssemblyWithVersionDS_3).ReadXml(reader_1);

以下是 Load runner 在编译期间抱怨缺少的库。 *

*

// Found an undefined object of type System.Xml.XmlTextWriter. Assigning it the name writer_1.
// Found an undefined object of type OM.EXIGO.SGUI.WscServicesAPI.AssemblyWithVersionDS. Assigning it the name AssemblyWithVersionDS_2.
// Found an undefined object of type System.Xml.XmlTextReader. Assigning it the name reader_1.

*

*

我已将 dll 添加到 csproj 文件,但出现了大约 1000 个错误。如果您希望我发送一些错误,请告诉我。如何检查我是否使用了正确的 .net 框架?

我该如何解决这些错误?

谢谢 斯里

您正在使用 .NET 记录器!祝你好运!

添加对 C# 项目的引用时,需要检查两件事:

  1. 项目引用了 dll。
  2. 代码引用了命名空间。

XmlTextWriterXmlTextReader 对象都是 .NET 框架的一部分,并且都位于 System.Xml 命名空间中。

检查您的项目是否引用了 System.Xml.dll 文件。

使用 using 语句添加该命名空间:

using System.Xml;

AssemplyWithVersionDS class 看起来是第三方。它的名称空间是 OM.EXIGO.SGUI.WscServiceAPI,您已经在 using 语句中涵盖了它。检查命名空间,class 是否存在于您在项目中引用的 dll 中。您可以使用反编译器或 Visual Studio 对象资源管理器来完成此操作。


不请自来的建议

了解 .NET 记录器及其过滤器设置所付出的努力可能与理解您的客户端应用程序 API 及其服务器所付出的努力相同,甚至更多。

了解 API 以及客户如何使用它。阅读应用程序源代码。请开发人员解释源代码。

自己对项目进行编码,参考相同的 API。您将能够用比记录器少得多的代码行来完成它。会更容易理解和维护。