Click here to Skip to main content
15,899,634 members
Home / Discussions / C#
   

C#

 
AnswerRe: Calling a function without an object Pin
Tamimi - Code8-Apr-07 23:04
Tamimi - Code8-Apr-07 23:04 
GeneralRe: Calling a function without an object Pin
nasambur8-Apr-07 23:18
nasambur8-Apr-07 23:18 
GeneralRe: Calling a function without an object Pin
Tamimi - Code8-Apr-07 23:34
Tamimi - Code8-Apr-07 23:34 
GeneralRe: Calling a function without an object Pin
nasambur8-Apr-07 23:38
nasambur8-Apr-07 23:38 
GeneralRe: Calling a function without an object Pin
Tamimi - Code8-Apr-07 23:48
Tamimi - Code8-Apr-07 23:48 
GeneralRe: Calling a function without an object Pin
nasambur8-Apr-07 23:53
nasambur8-Apr-07 23:53 
GeneralRe: Calling a function without an object Pin
Tamimi - Code9-Apr-07 0:51
Tamimi - Code9-Apr-07 0:51 
GeneralRe: Calling a function without an object Pin
nasambur9-Apr-07 1:07
nasambur9-Apr-07 1:07 
Actually, we are developing an application to test the User Load for any Website..

below is the script of our tool that loads virtual user and tests the site..

using System;
using RTGWebLoad;

namespace Coolgoose   
{
  public class Transaction
  {
    private string username;
    private string password;
        
    public void TransactionMain(RTGHttpBrowser wlHttp, string ThreadNum, long RoundNum, long MaxRounds)
    {
      wlHttp.BeginTransaction("Coolgoose_SendingMail");
      CallCoolGooseSendMail(wlHttp, ThreadNum, RoundNum, MaxRounds);
      wlHttp.EndTransaction("Coolgoose_SendingMail");
    }
    
    public void CallCoolGooseSendMail(RTGHttpBrowser wlHttp, string ThreadNum, long RoundNum, long MaxRounds)
    {
      if (RoundNum == 1)
        CGLogin(wlHttp);

      CGSM(wlHttp);

      //if (RoundNum % MaxRounds == 0)
      //  CGLogout(wlHttp);      
    }

    public void CGLogin(RTGHttpBrowser wlHttp)
    {      
      string[] loginData = wlHttp.GetData("http://10.80.4.43/?get=userpass", ',');
      username = loginData[0];
      password = loginData[1];
      
      //username = "rtguser";
      //password = "rtguser";
     
      wlHttp.Get("http://www.cooltoad.com");
      //wlHttp.CheckString("RTGian");
      
      wlHttp.InfoMessage("Page1: " + wlHttp.wlSource);
            
      wlHttp.Get("http://www.cooltoad.com/go/email");
      wlHttp.Get("http://www.cooltoad.com/account/login.php?mail=1");

      wlHttp.ContentType = "application/x-www-form-urlencoded";

      wlHttp.FormData("ACCOUNT", username);
      wlHttp.FormData("PASSWORD", password);      
      
      wlHttp.Post("http://www.cooltoad.com/account/login.php?mail=1");

      //bool bFlag = wlHttp.CheckString("This site uses frames");    // check string
      //wlHttp.InfoMessage(bFlag.ToString());      

      wlHttp.Get("http://www.cooltoad.com/common/header_email.php");
      wlHttp.Get("http://as03.cooltoad.com/go/desktop?p=folders");
      wlHttp.Get("http://as03.cooltoad.com/go/desktop?o=folder:inbox");
      wlHttp.InfoMessage("------" + username + " logged IN ------");
      //wlHttp.ErrorMessage("Error in Agenda");
    }

    public void CGSM(RTGHttpBrowser wlHttp)
    {      
      wlHttp.Get("http://as03.cooltoad.com/go/desktop?c=new");

      string sCompose = wlHttp.FindString(wlHttp.wlSource, "COMPOSE\" VALUE=\"", "\">");            
      
      wlHttp.ContentType = "multipart/form-data";
      wlHttp.FormData("TO", "xyz@gmail.com");
      wlHttp.FormData("CC", "");
      wlHttp.FormData("SUBJECT", "Testing LTT -- Naveed");
      wlHttp.FormData("ATTACHMENT_DATA.wlFile-Name", "");
      wlHttp.FormData("ATTACHMENT_DATA.wlContent-Type", "application/octet-stream");      
      wlHttp.FormData("MESSAGE", "Testing LoadTestingTool");
      wlHttp.FormData("TZO", "-330");
      wlHttp.FormData("C:SEND:::NEW.x", "12");
      wlHttp.FormData("C:SEND:::NEW.y", "9");
      wlHttp.FormData("COMPOSE", sCompose);     // parameterization
      wlHttp.Post("http://as03.cooltoad.com/go/desktop");
      //wlHttp.CheckString("Need more space");    // check string
      wlHttp.InfoMessage("Compose: " + sCompose + " --- " + username);
    }

    public void CGLogout(RTGHttpBrowser wlHttp)
    {
      wlHttp.Get("http://as03.cooltoad.com/go/desktop?c=logout");
      wlHttp.ClearCookies();
      wlHttp.InfoMessage("------" + username + " logged OUT ------");
    }
  }
}


after writing this script we wil pass this to our Testing tool, which compiles this C# script and starts the run.
we want to tune our code, so that we can write this script in more better way..


currently the InfoMessage() functions are in the same package RTGWebLoad..
we want to move it to another package and can be called without an object or class name..

one of my mate suggest me to include the package's code as we do in C (using #include).


regards,
nas
GeneralRe: Calling a function without an object Pin
Colin Angus Mackay9-Apr-07 1:14
Colin Angus Mackay9-Apr-07 1:14 
GeneralRe: Calling a function without an object Pin
Colin Angus Mackay9-Apr-07 1:04
Colin Angus Mackay9-Apr-07 1:04 
GeneralRe: Calling a function without an object Pin
nasambur9-Apr-07 1:13
nasambur9-Apr-07 1:13 
GeneralRe: Calling a function without an object Pin
Colin Angus Mackay9-Apr-07 1:01
Colin Angus Mackay9-Apr-07 1:01 
GeneralRe: Calling a function without an object Pin
Colin Angus Mackay9-Apr-07 0:57
Colin Angus Mackay9-Apr-07 0:57 
Questiongraph control Pin
Enter the Dragon8-Apr-07 19:48
Enter the Dragon8-Apr-07 19:48 
AnswerRe: graph control Pin
Robert Rohde8-Apr-07 20:50
Robert Rohde8-Apr-07 20:50 
QuestionDateTime format Pin
rachitdamani8-Apr-07 19:35
rachitdamani8-Apr-07 19:35 
AnswerRe: DateTime format Pin
phantanagu8-Apr-07 20:54
phantanagu8-Apr-07 20:54 
GeneralRe: DateTime format Pin
rachitdamani8-Apr-07 21:05
rachitdamani8-Apr-07 21:05 
Questionscreen capturing software Pin
khema8-Apr-07 19:25
khema8-Apr-07 19:25 
QuestionNESTED DATAGRID IN WINDOWS FORM Pin
Faisal Khatri8-Apr-07 19:09
Faisal Khatri8-Apr-07 19:09 
AnswerRe: NESTED DATAGRID IN WINDOWS FORM Pin
phantanagu8-Apr-07 20:48
phantanagu8-Apr-07 20:48 
GeneralRe: NESTED DATAGRID IN WINDOWS FORM Pin
Faisal Khatri8-Apr-07 21:55
Faisal Khatri8-Apr-07 21:55 
AnswerRe: NESTED DATAGRID IN WINDOWS FORM Pin
Vinay Dornala8-Apr-07 23:16
Vinay Dornala8-Apr-07 23:16 
GeneralRe: NESTED DATAGRID IN WINDOWS FORM Pin
Faisal Khatri9-Apr-07 19:57
Faisal Khatri9-Apr-07 19:57 
QuestionBainding only images to combobox Pin
Sivaprasad C8-Apr-07 18:33
Sivaprasad C8-Apr-07 18:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.