Forum Discussion

AAB's avatar
AAB
Regular Contributor
5 years ago
Solved

ReadyAPI: relative path isn't recognized

Hi all,   In my groovyscript I wanted to insert a relative path so that all users that wants to use my code and files, can do so by saving the code and files wherever they want. That's the purpos...
  • AAB's avatar
    5 years ago

    Oops, I found the solution... Stupid actually....

    The creation of the paths were correct, but when I wanted to use it in my code ,so actually call them, ReadyAPI threw me the error. Look at my first screenshot:

    1) ( '${#project#projectDir}' ): I wrote Project with a small p, should have been a capital

    2) File resultPrimary = new File ("path/Countries/ResultsSTAT.txt")  => the path declaration is wrong. Here, Groovy is a Java language, and Java doesn't concatenate paths!!!! therefore you need to 'use' the variable as a variable... :-) so like this:

     

    File resultPrimary = new File(path + "/Countries/ResultsSTAT.txt")

     

    And now it works!  :-) 

     

    richie Thanks for your time and explanation man! Appriciated it.  ;-)