cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to return the name of the current sub routine or function that is being run.

Highlighted
Contributor

Is there a way to return the name of the current sub routine or function that is being run.

Hi All,

 

Is there a way to return the name of the current sub routine or function that is being run.

 

this will increase my traceability in logs and debugging .

 

Currently am coding in Jscript

 

Please help me with your suggestions.

 

Thanks,

sindhu

6 REPLIES 6
Highlighted
Contributor

Is there a way to return the name of the current sub routine or function that is being run .

Hi All,



Is there a way to return the name of the current sub routine or function that is being run. It would be nice to enter into the log.



I am currently coding in JScript.



I assume there is no way to do it using Jscript but is there a TestComplete inbuilt function?

 

Thanks,

sindhu

Highlighted
Valued Contributor

Re: Is there a way to return the name of the current sub routine or function that is being run.

Hi You can use test indicator

push text method here is example and more

(you to detect in run time..)

 

if you need any message in Log you may use 

Log.message("what ever you like")

What exactly are you trying to achieve? there could be better solution if you describe your situation  

Highlighted
Contributor

Re: Is there a way to return the name of the current sub routine or function that is being run.

@NisHera

 

Thanks for the comments.

 

Trying to achieve :

Example :

Function Test()

{

Test1();

Test2();

}

I just want the logs in the form of folders like Test->Test1->Results

Test2->Results

this will help me in debugging which folder and which step goes wrong.

 

Please suggest.

 

Thanks,

sindhu

Highlighted
Community Hero

Re: Is there a way to return the name of the current sub routine or function that is being run.

For that you have use Log.AppendFolder and Log.PopLogFolder option.

 

Sample code would be like below,

 

function testmycode(){
      Log.AppendFolder("testmycode");
      Test1();
      Test2();
      Log.PopLogFolder();
}
function Test1(){
      Log.AppendFolder("Test1");
      Log.Message("This is just a test");
      Log.Message("This is just a test1");
      Log.Message("This is just a test2");
      Log.PopLogFolder()
}

function Test2(){
      Log.AppendFolder("Test1");
      Log.Message("This is just a test");
      Log.Message("This is just a test1");
      Log.Message("This is just a test2");
      Log.PopLogFolder()
}

Output:

testlog.PNG

 


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”


Extension Available

Highlighted
Contributor

Re: Is there a way to return the name of the current sub routine or function that is being run.

Hi Shankar,

 

Thanks a lot.

 

It is working fine for me as expected.

 

Thanks,

sindhu

Highlighted
Community Hero
Moved:

Re: Is there a way to return the name of the current sub routine or function that is being run.

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!
Top Kudoed Authors