Forum Discussion

ashly's avatar
ashly
Champion Level 1
6 months ago

Reusing a keyword test (selecting different files)

Hi, I have reused a keyword test that is used in one project suite with another project suite. In one project suite I have created a keyword test to open a file like shown below.

In a different project suite when I call this keyword test, the same test case comes and works properly. Is there any way to open a different file in the new project suite (within this called keyword test) without changing the file in the parent project suite.

  • You can make the keyword test work with a variable instead of the hard coded file name. That way you can set the variable in each test as needed.

    Instead of using the path name of the actual file, you will use a variable that you create and then put the path name in the variable. 

    https://support.smartbear.com/testcomplete/docs/keyword-testing/variables.html

  • You can make the keyword test work with a variable instead of the hard coded file name. That way you can set the variable in each test as needed.

    Instead of using the path name of the actual file, you will use a variable that you create and then put the path name in the variable. 

    https://support.smartbear.com/testcomplete/docs/keyword-testing/variables.html

  • ashly's avatar
    ashly
    Champion Level 1

    thankyou, but could you please explain it a bit more. How can a recorded step to select a file name be replaced with another one

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Have you read the documentation on variables, that Marsha_R had provided?

    If you are new to TC, I suggest you create a new project, and try the example given in the documentation. Once you have an understanding of variables, you can then apply this to your actual project.

    The concept looks like this in JavaScript code,

    var message = "SmartBear"
    Log.Message(message)

     

    • ashly's avatar
      ashly
      Champion Level 1

      yes referred the document and has got it