Ask a Question

this.item - javascript location

SOLVED
Lee_M
Community Leader

this.item - javascript location

I have a Keyword test the performs a simple log message.

The script takes in a parameter.

 

 

This script executes as expected

 

"the input value is = " + KeywordTests.p1.Parameters.tp1

Lee_M_0-1614087261371.png

 

I have to write KeywordTests.p1.Parameters. to get to a local parameter, is there a better way to do this

 

I am looking for either of these options

  • this.test.Parameters.tp1
  • Parameters.tp1

 

The idea is that I can write this test and then copy it to anywhere else and it will still run and reference the NEW parameter

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Marsha_R
Community Hero

Re: this.item - javascript location

You can use aqTestCase to get the name of the current test case 

 

https://support.smartbear.com/testcomplete/docs/reference/program-objects/testcase/name.html

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

View solution in original post

Marsha_R
Community Hero

Re: this.item - javascript location

All you need to use to get your vaiue is

 

aqTestCase.CurrentTestCase.Name

 

The other things on that page are examples of how it could be used.

 

 

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

View solution in original post

3 REPLIES 3
Marsha_R
Community Hero

Re: this.item - javascript location

You can use aqTestCase to get the name of the current test case 

 

https://support.smartbear.com/testcomplete/docs/reference/program-objects/testcase/name.html

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

View solution in original post

Lee_M
Community Leader

Re: this.item - javascript location

Thanks,

 

This method is a little longer than I would like but will work.

 

I was hoping  for a shorter method

Marsha_R
Community Hero

Re: this.item - javascript location

All you need to use to get your vaiue is

 

aqTestCase.CurrentTestCase.Name

 

The other things on that page are examples of how it could be used.

 

 

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: