• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    利用LR測試程序基類的性能

    發布: 2008-9-11 14:46 | 作者: allen | 來源: 51testing | 查看: 193次 | 進入軟件測試論壇討論

    領測軟件測試網

    在VUSERCLASS中寫方法,在METHOD中寫參數調用,等于參數化了。

    VuserClass代碼如下 :

    using System;
    using System.Collections;
    using System.Diagnostics;
    using System.EnterpriseServices;
    using System.Runtime.InteropServices;
    using System.Runtime.Remoting;
    using System.Runtime.Remoting.Channels;
    using System.Runtime.Remoting.Channels.Tcp;
    using System.Data;
    using System.Web;
    using System.Reflection;

    using Common;
    using Proxy;
    using DAT;
    using ShangXin;
    using ShangXin.Data;
    using ShangXinInterface;
    namespace LRQueryCustomer
    {
     ///


     /// Summary description for VuserClass.
     ///

     [ClassInterface(ClassInterfaceType.AutoDual)]
     public class VuserClass
     { 
      public static string ifCanCreatePuDongOrderWithBiz = "";
      Proxy.LoginProxy loginProxy;
      Method methodLR = new Method();
      LoadRunner.LrApi lr;

      public VuserClass()
      {
       // LoadRunner Standard API Interface ::             DO NOT REMOVE!!!
       lr = new LoadRunner.LrApi();
      }

      // ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      public int Initialize()
      {
      try
       {
       RemotingConfiguration.Configure(@"D:\Escalade liunx\CODE_20051020100023\Code\OAERP\ShangXin.OAERP.App\bin\Debug\App.exe.config");

       lr.start_transaction("init");
       lr.start_transaction("GetLoginByLoginNameAndPassword");
       loginProxy = new LoginProxy();
       LoginData loginData = loginProxy.GetLoginByLoginNameAndPassword("administrator","");
       lr.end_transaction("GetLoginByLoginNameAndPassword",lr.PASS);

       Proxy.EmployeeProxy employeeProxy = new EmployeeProxy();
       CertificationInfo CI = new CertificationInfo();
       Common.CertificationInfo ci= PersonalCertificationInfo.GetCertificationInfo();

       CI.LoginName = SXConvert.ToString(loginData.Rows[0][LoginData.LOGINNAME]);
       CI.Password = SXConvert.ToString(loginData.Rows[0][LoginData.PASSWORD]);
       CI.EmployeeId = SXConvert.ToInt32(loginData.Rows[0][LoginData.EMPLOYEEID]);
       CI.EmployeeName = employeeProxy.GetEmployeeDataByPKID(SXConvert.ToInt32(loginData.Rows[0][LoginData.EMPLOYEEID])).Rows[0][EmployeeData.NAME].ToString();
       CI.RecordCount = SXConvert.ToInt32(loginData.Rows[0][LoginData.RECORDCOUNT]);

       lr.start_transaction("GetAllAuthsByLoginId");
       int loginID = SXConvert.ToInt32(loginData.Rows[0][LoginData.PKID]);
       AuthData ad = loginProxy.GetAllAuthsByLoginId(loginID);
       methodLR.SetAuth(ad,CI);
       lr.end_transaction("GetAllAuthsByLoginId",lr.PASS);

       lr.start_transaction("GetGroupsByLoginID");
       GroupData groupData = loginProxy.GetGroupsByLoginID(loginID);
       methodLR.GetGroupAuth(groupData,CI);
       lr.end_transaction("GetGroupsByLoginID",lr.PASS);

       lr.start_transaction("AddToCurrentEmployee");
       if (AuthenticationManager.CheckAuthentication(CI,EnumAuthority.AuthLoginSystem))
       {
        methodLR.AddToCurrentEmployee(ci,CI);
        lr.end_transaction("AddToCurrentEmployee",lr.PASS);
        DataRow BizDR = new SystemParameterValueProxy().GetSystemParameterValueByParentCode(SystemParametersCode.CANCREATEPUDONGORDERWITHBIZ,Bools.TRUE).Rows[0];
        ifCanCreatePuDongOrderWithBiz = BizDR[SystemParameterValueData.OTHER1].ToString();
       }
       else
       {
        lr.end_transaction("AddToCurrentEmployee",lr.FAIL);
       }
      
       lr.end_transaction("init",lr.PASS);
      }
      catch(Exception ex)
      {
       string error = ex.Message;
      }
       return lr.PASS;

      }

      // ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      public int Actions()
      {
       
       #region 查詢客戶
       //條件為空查詢
       try
       {
        lr.start_transaction("GetCustomerCountByCondition");
        object[] param = {methodLR.GetQueryCustomerConditions()};

        Object obj = System.Activator.CreateInstance(typeof(Proxy.CustomerProxy));
        MethodInfo method = obj.GetType().GetMethod("GetCustomerCountByCondition");
        DataTable dt = (DataTable)method.Invoke(obj,param);
        int count = Convert.ToInt32(dt.Rows[0][0]);

        if(count>0)
         lr.end_transaction("GetCustomerCountByCondition",lr.PASS);
        else
         lr.end_transaction("GetCustomerCountByCondition",lr.FAIL);
       }
       catch(Exception ex)
       {
        string error = ex.Message;
       }

       //按客戶編號查詢
       try
       {
        lr.start_transaction("GetCustomerCountByCode");
        object[] param1 = {methodLR.GetQueryCustomerByCodeConditions()};

        Object obj1 = System.Activator.CreateInstance(typeof(Proxy.CustomerProxy));
        MethodInfo method1 = obj1.GetType().GetMethod("GetCustomerCountByCondition");
        DataTable dt1 = (DataTable)method1.Invoke(obj1,param1);
        int count1 = Convert.ToInt32(dt1.Rows[0][0]);

        if(count1>0)
         lr.end_transaction("GetCustomerCountByCode",lr.PASS);
        else
         lr.end_transaction("GetCustomerCountByCode",lr.FAIL);
       }
       catch(Exception ex)
       {
        string error = ex.Message;
       }

       //按客戶名稱查詢
       try
       {
        lr.start_transaction("GetCustomerCountByCustomerName");
        object[] param2 = {methodLR.GetQueryCustomerByCustomerName()};

        Object obj2 = System.Activator.CreateInstance(typeof(Proxy.CustomerProxy));
        MethodInfo method2 = obj2.GetType().GetMethod("GetCustomerCountByCondition");
        DataTable dt2 = (DataTable)method2.Invoke(obj2,param2);
        int count2 = Convert.ToInt32(dt2.Rows[0][0]);

        if(count2>0)
         lr.end_transaction("GetCustomerCountByCustomerName",lr.PASS);
        else
         lr.end_transaction("GetCustomerCountByCustomerName",lr.FAIL);
       }
       catch(Exception ex)
       {
        string error = ex.Message;
       }

      

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/

    TAG: 程序 基類 性能

    31/3123>

    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備2023014753號-2
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>