Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

How to import my tests in another tests

Options
Amulya
Amulya Posts: 3

I am trying to create a common function library, created a test .tst file added an extension tool and written some methods in it. How can use this methods in other test .tst - extension tool.
Is there a way to do this. Appreciate your help.

Tagged:

Comments

  • jakubiak
    jakubiak Posts: 798 admin
    Options

    What language are you using to write your common functions? If you are using groovy or jython, I would recommend you write the common functions in a separate file, and then in each .tst file where you need to use one of the common functions, you create an Extension Tool that points at the common file and then configure the tool to call the function you need.

  • Amulya
    Amulya Posts: 3
    Options

    I am using Jython. I am new to soatest, please can you elaborate it. when you say write the common function in a seperate file , how can i do this ?

  • jakubiak
    jakubiak Posts: 798 admin
    Options

    You simply create a .py file and write your code in that file. Then you reference it in an Extension Tool as described in the docs: https://docs.parasoft.com/display/SOA9108/Extension+Tool+for+Custom+Scripting

  • Amulya
    Amulya Posts: 3
    Options

    @jakubiak : Thanks for your response. could you please clarify how can i reference the file to the extension tool. I see extension tool has file option under the language and once i select the filepath I cannot click ok or do anything and should i switch back to text to see the calling method code ?? How does this work.

  • jakubiak
    jakubiak Posts: 798 admin
    Options

    The file option is the correct field to use. Once you do that, the method combo box should populate. If it does not, your jython code in the file is probably not parsing correctly. You can check this by clicking the Evaluate button which should report any parsing errors with the script. You should not switch back to text, because doing that will not use the file.