51Testing软件测试论坛

标题: 使用LR8.1的Microsoft.net协议录制c/s结果的程序 [打印本页]

作者: lsl20032    时间: 2009-3-3 11:28
标题: 使用LR8.1的Microsoft.net协议录制c/s结果的程序
各位大侠,我在使用LR8.1中的Microsoft.net协议录制C/S结构的程序后,对登录用户名、登录用户对应的usernumber值分别进行参数化,当只参数化用户名时,lr的脚本能正常回放,但是一旦我参数化了usernumber时就出现报错:
Microsoft.net是v2.0的,请知道的多多指导,感激不尽!!!
Error: Failed to compile virtual user.
Notify: __________________________________________________
Notify: Project "E:\G\client\0303_1\Script.sln" (Build target(s)):
Notify:
Notify: __________________________________________________
Notify: Project "E:\G\client\0303_1\Script.sln" is building "E:\G\client\0303_1\Script.csproj" (default targets):
Notify:
Error: Action.cs(56,59): error CS1026: ) expected
Error: Action.cs(56,71): error CS1002: ; expected
Error: Action.cs(56,75): error CS1002: ; expected
Error: Action.cs(56,75): error CS1525: Invalid expression term ')'
Error: Action.cs(57,44): error CS1002: ; expected
Notify: Done building project "Script.csproj" -- FAILED.
Warning: Extension DotnetExtensionReplay.dll reports error -1 on call to function ExtPerProcessInitialize        [MsgId: MWAR-10485]
Error: Thread Context: Call to service of the driver failed, reason - thread context wasn't initialized on this thread.        [MsgId: MERR-10176 ]

作者: lsl20032    时间: 2009-3-3 11:36
标题: 使用LR8.1的Microsoft.net协议录制c/s结果的程序
我的代码如下:

namespace Script {
    using LoadRunner;
    using Mercury.LoadRunner.DotNetProtocol.Replay;
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Globalization;
    using YnTravelSky.RAMSystem.Entities.Order;
    using YnTravelSky.RAMSystem.Entities.Payment;
    using YnTravelSky.RAMSystem.Server.Booking;
    using YnTravelSky.RAMSystem.Server.EasyFare;
    using YnTravelSky.RAMSystem.Server.Framework;
    using YnTravelSky.RAMSystem.Server.Management;
   
   
    public partial class VuserClass {
        
        public virtual int Action() {

                        lr.log("Event 1: ((Crew)(Activator.GetObject(typeof(YnTravelSky.RAMSystem.Server.Manageme" +
                          "nt.Crew), \"tcp://192.17.25.2:8080/Crew\", null)));");
                        Crew_1 = ((Crew)(Activator.GetObject(typeof(YnTravelSky.RAMSystem.Server.Management.Crew), "tcp://192.17.25.2:8080/Crew", null)));

                        String url_1;
                        url_1 = "tcp://192.17.25.2:8080/PublicMethodForBasicData";
                        lr.log("Event 2: ((PublicMethodForBasicData)(Activator.GetObject(typeof(YnTravelSky.RAMSy" +
                          "stem.Server.Framework.PublicMethodForBasicData), url_1, null)));");
                        PublicMethodForBasicData_1 = ((PublicMethodForBasicData)(Activator.GetObject(typeof(YnTravelSky.RAMSystem.Server.Framework.PublicMethodForBasicData), url_1, null)));

                        lr.think_time(11);

                        lr.log("Event 3: Crew_1.StaffLogin(\" + lr.eval_string("{username}") + "\", \"123456\", \"HKG01\");");
                        StringArray_1 = Crew_1.StaffLogin("" + lr.eval_string("{username}") + " "", "123456", "HKG01");
                           红色部分是我的登录名=staff015

                        lr.log("Event 4: PublicMethodForBasicData_1.GetRouteRecnoByDefaultPort(\"HKG\");");
                        Int32RetVal = PublicMethodForBasicData_1.GetRouteRecnoByDefaultPort("HKG");

                        lr.log("Event 5: ((UserLogin)(Activator.GetObject(typeof(YnTravelSky.RAMSystem.Server.Fra" +
                          "mework.UserLogin), \"tcp://192.17.25.2:8080/UserLogin\", null)));");
                        UserLogin_1 = ((UserLogin)(Activator.GetObject(typeof(YnTravelSky.RAMSystem.Server.Framework.UserLogin), "tcp://192.17.25.2:8080/UserLogin", null)));

                        lr.log("Event 6: UserLogin_1.GetServiveDateTime();");
                        DateTimeRetVal = UserLogin_1.GetServiveDateTime();

                        lr.log("Event 7: UserLogin_1.GetControlRefundOrAmendForPrintTicket();");
                        BooleanRetVal = UserLogin_1.GetControlRefundOrAmendForPrintTicket();

                        lr.log("Event 8: UserLogin_1.GetUserPower(209);//这里的209就是staff015对应的usernumber
                        DataTable_1 = UserLogin_1.GetUserPower(209) ;//这里的209就是staff015对应的usernumber
                  ……
请大家不吝赐教,小女子感激不尽!!!!!

[ 本帖最后由 lsl20032 于 2009-3-3 12:47 编辑 ]
作者: lsl20032    时间: 2009-3-4 08:43
呵呵,问题已经解决了!
作者: happylynn    时间: 2010-4-22 08:47
怎么解决的?
作者: 云层    时间: 2010-4-22 08:51
直接参数化就行了吧,不用再去字符串
作者: 测试落樱    时间: 2010-5-14 09:37
标题: 回复 1# 的帖子
录制C/S架构的系统不是用window sockets协议吗?楼主是在什么情况下选择了Microsoft.net协议??




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2