Workspace and project path from script

PBelandPBeland Posts: 14

I need to access files saved to my workspace from Groovy script. How can I get the path to my workspace and project?


  • OmarROmarR Posts: 231 admin

    Hey PBeland!

    I did a quick search online and found the following:

  • PBelandPBeland Posts: 14

    Yeah, I found it too. I'd like to get a path relative to my workspace in case our test structure change. Until then, I can get to there with something like that:

    def projectDir = context.getAbsolutePathFile(".\\..\\..\\..\\MyWorkspace");
    Application.showMessage("Workspace location is ${projectDir}");

    Better than nothing ;)


  • Ramiro MartinezRamiro Martinez Posts: 53 admin

    Hi PBeland,

    Here is an example script that utilizes the methods that are mentioned in the link that Omar posted:

    from soaptest.api import *
    from com.parasoft.api import *
    from import *
    def main(input, context):
        f = context.getAbsolutePathFile(".")
        #returns absolute path to project folder  
        s = f.getAbsolutePath() + File.separator + "some.xml" 

    These API calls will return the path to the Project folder that contains the extension tool.

Sign In or Register to comment.