Forum Discussion

Adina11's avatar
Adina11
New Contributor
14 years ago

Can I take ServerSocket value from a property?

Hi,
I have next def in Groovy: def server = new ServerSocket(8400)

And a property defined at Test Suite level named, web_services_url , that store 8400 value

My question is if I can define my server to take the SeverSocket value from web_services_url propery

I tried with def server = new ServerSocket('${#TestSuite#web_services_url}') – but is not working

Thanks,

1 Reply

  • Adina11's avatar
    Adina11
    New Contributor
    I found the solution:

    the property web_services_url value is 'localhost:8400', so to define the server I need only the port value 8400

    ----
    def web_services_url = context.expand( '${#TestSuite#web_services_url}' )

    web_server =web_services_url-'localhost:' //this give me only 8400

    def bf = web_server.toInteger() /// convert the char value in Integer

    def server = new ServerSocket(+bf) //define the server