How to import my tests in another tests

AmulyaAmulya 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

  • jakubiakjakubiak Posts: 619 admin

    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.

  • AmulyaAmulya Posts: 3

    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 ?

  • jakubiakjakubiak Posts: 619 admin

    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

  • AmulyaAmulya Posts: 3

    @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.

  • jakubiakjakubiak Posts: 619 admin

    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.

Sign In or Register to comment.