Forum Discussion

tuyentran's avatar
tuyentran
Occasional Contributor
15 years ago

Create a function to call any process

Hi all,

I'm a novice user with TestComplete. I am using TestComplete 7. I have a question as below:

 I am going to write a generic function to call any process. User only enter the process name. When call this function, the application will be launched

 The prototype for this function as below

 Sub LaunchApp(app_name)

     Get the process name

     Execute process   

 

 End Sub



Can anyone help me?



Thank you

24 Replies

  • ZooZoo's avatar
    ZooZoo
    Occasional Contributor

    Hi Jarad,



    Still am facing the issue. If possible please look in to this once again. Thanks in advance.



    var tcount=0, pcount=0, fcount=0;


    fso  = new ActiveXObject( "Scripting.FileSystemObject" );


    fin  = fso.OpenTextFile( src, forReading );


     


    while( !fin.AtEndOfStream )


    {


      var line = fin.ReadLine();


      if( line == "" )


                       continue;


          


      data = line.split( "\t" );


      ++tcount;


     


      var st1 = data[1];


     


      Log["Message"](st1);


     


     if(st1==”Pass”)


           ++pcount;


      else


           ++fcount;     



     


    Log["Message"]( pcount);


    Log["Message"]( fcount);


     


    Here the variable data[1] is bringing the right value from the note pad. Using the statement “Log["Message"](st1);” I can able to c the result in the log report. While doing string comparison it is not going inside to the if loop.  


     


    Log["Message"](st1); - Displaying the report in test log as


    Pass


    Pass


    Fail


    0


    0


     


    Always the pcount and fcount both are showing as Zero.


     


     It should be


    2


    1


     


    To open the file am using ActiveXObject. I couldn’t catch the problem. Please help me.

  • Hi,



    Have you tried debugging your code? Walk through it step by step and check values which are read from your file and values used in comparison. The problem seems to be in the condition you use or in the way you split lines read from your file.
  • ZooZoo's avatar
    ZooZoo
    Occasional Contributor

    Yes Jared, already I have debugging my code.


     


    I am facing the problem in comparison part. Am getting the correct value from note pad. Before comparing am displaying the value wt am getting from notepad.


    It is displaying like


    Pass


    Pass


    Fail


     


    For reading the file am using ActiveXObject. My doubt is whether the format is getting changed or not?


    var st1 = data[1];


     


      Log["Message"](st1);


     


     if(st1==”Pass”)


           ++pcount;


      else


           ++fcount;     


     


    St1 is displaying as “Pass” am comparing the value st1==”Pass” it is getting failed.


     


    Please let me know whether the comparison syntax needs to be changed or before comparing the value needs to change in some other format.


     


    Thanks,


    Lakshmi Priya

  • ZooZoo's avatar
    ZooZoo
    Occasional Contributor
    Thanks for your post.



    I just using "var st1 = aqConvert["VarToStr"](data[1]);".



    Now it is working fine.