Forum Discussion

fardude's avatar
fardude
Occasional Contributor
4 years ago
Solved

Service name property from project property

Hi I'm trying to set the service name from the project properties but ${#Project#ENV} doesn't seem to be substituting. 

In the project custom properties I have ENV with value.

 

Is such a thing possible?

Thanks.

  • fardude 

     

    I don't think that this is possible by property expansion, if you want to do this than you can do this with groovy script as below

     

    interface1 =  testRunner.testCase.testSuite.project.getInterfaceAt(0)
    interface1.setName("New__Name")

     

    You can apply logic on interface if there are multiple interface in your Project.

    Hope this will help you 🙂

11 Replies

  • richie's avatar
    richie
    Community Hero
    Hey fardude,

    If i understand correctly then its completely possible.

    Can i ask that you describe in a bit more detail exactly how youve got your custom project properties setup and how youre sourcing them?
    Youre using ${#Project#ENV}, so im guessing you have a custom project property entitled 'ENV', but theres obviously a problem if this property isnt being expanded when youre using it, so the more info people have the better.

    Oh one thing. Where youre using '${#Project#ENV}', can you confirm you are using the word 'Project' rather than the project's name? If you were to use the project name youd need to remove the first # character so instead of '${#Project#ENV}' it would be '${Projectname#ENV}'.

    Cheers,

    Rich
    • fardude's avatar
      fardude
      Occasional Contributor

      Thanks richie , I tried all of them and it's still not expanding.

       

      I'm trying to get the service name to show as the property value of ENV in the custom project properties.

      I have tried ${#Project#ENV} and ${ProjectName#ENV}

       

      The expansion works fine when I used it for endpoints.

      • HimanshuTayal's avatar
        HimanshuTayal
        Community Hero

        fardude :

         

        Could you please provide any screenshot, where you want to fetch the properties value.

         

  • fardude :

     

    Didn't get you properly could you please elaborate more what you are trying to do and where exactly you are getting stuck also if possible please attach any screenshot for more clearity.