0

I am trying to record a .net thick client application (4.5.2) in Load Runner 12.01 but i am getting the following errors. can someone please help

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

Here are the missing libraries that Load runner is complaining during compilation. *

*

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

*

*

I have added the dlls to csproj file and I got approx 1000 errors. Please let me know if you would like me to send few of the errors. How do I check whether I am using the right .net framework?

How can i resolve these errors?

Thanks Sri

Sri
  • 342
  • 4
  • 17

1 Answers1

0

You're using the .NET recorder! Good luck!

When you add a reference to a C# project there are two things to check:

  1. The project references the dll.
  2. The code references the namespace.

The XmlTextWriter and XmlTextReader objects are both part of the .NET framework and both live in the System.Xml namespace.

Check that your project has a reference to the System.Xml.dll file.

Add that namespace with a using statement:

using System.Xml;

The AssemplyWithVersionDS class looks to be third party. Its namespace is OM.EXIGO.SGUI.WscServiceAPI which you already have covered in a using statement. Check the namespace and class is there in the dll you referenced in your project. You can do this with a decompiler or the Visual Studio object explorer.


Unsolicited advice

The effort to understand the .NET recorder and its filter settings is probably equal, if not more, than the effort to understand your client application API with its server.

Learn that API and how the client uses it. Read the application source code. Ask developers to explain the source code.

Code the project yourself referencing that same API. You will be able to do it in much fewer lines of code than the recorder. It will be easier to understand and maintain.

John O.
  • 708
  • 5
  • 9