Hi All,

Thank you for the response, i am writing integration tests for BPS, I can
acquire the backend URL, i need to get the hostname and port for a rest
service innvocation. I will try the automation xml method.

Thank you.

Regards,
Shiva Balachandran

On Mon, Feb 16, 2015 at 4:10 PM, Irham Iqbal <[email protected]> wrote:

> Hi Siva,
>
> In which product you are writing your test cases. Most of the products
> base test case has initialized  AutomationContext. If not you can initialize
> the  AutomationContext as Malintha mentioned to you. Then use the
> following codes to get port and host
>
> String httpsPort = automationContext.getInstance().getPorts().get("https")
>
> String defaultHost =  automationContext
> .getInstance().getHosts().get("default")
>
> Thanks,
> Iqbal
>
> On Mon, Feb 16, 2015 at 3:59 PM, Malintha Adikari <[email protected]>
> wrote:
>
>> Hi,
>>
>> Test Automation Framework  (from 4.3.0 version) provides single location
>> to store all test related configuration details (Host name ,port address,
>> tenant/user info...etc). If you are writing your test case inside existing
>> test module you can find that file (automation.xml [1]) in
>> *{your_module}/src/test/resources* location. You have to store your
>> server related configurations under *<platform>* section of that file.
>>
>> ex:
>>
>> <productGroup name="ESB" clusteringEnabled="false" default="true">
>>      <instance name="lbw001" type="lb_worker_manager"
>> nonBlockingTransportEnabled="true">      <hosts>         <host type="
>> worker">esb.wso2con.com</host>         <host type="manager">
>> mgt.esb.wso2con.com</host>  </hosts>  <ports>        <port type="nhttps"
>> >8243</port>        <port type="nhttp">8280</port>  </ports>  <properties
>> >
>>   </properties>  </instance>
>>
>> ......................
>>
>>
>> Then you can retrieve those info inside your test case by creating
>> AutomationContext object.
>>
>> ex:
>>
>> automationContext = new AutomationContext("ESB",
>> TestUserMode.SUPER_TENANT_ADMIN);
>>
>> Through this approach Framework facilitate you to prepare your test
>> environment. Please refer Automation Framework docs for information on how
>> to use/create this AutomationContext object[2], and blogs [3]
>>
>>
>> [1] https://docs.wso2.com/display/TA430/Automation.xml+File
>> [2]
>> http://wso2.com/library/articles/2014/06/how-to-write-connector-integration-tests-using-wso2-test-automation-framework/
>> [3]
>> http://malinthas.blogspot.com/2014/02/how-to-write-test-case-using-wso2-test.html
>>
>> Regards,
>> Malintha
>>
>> On Mon, Feb 16, 2015 at 10:14 AM, Malintha Adikari <[email protected]>
>> wrote:
>>
>>> Hi Shiva,
>>>
>>> What is the Automation Test Framework version you are going to use?
>>>
>>> Regards,
>>> Malintha
>>>
>>> On Mon, Feb 16, 2015 at 10:07 AM, Shiva Balachandran <[email protected]>
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> I am writing some testcases and it is necessary for me to acquire the
>>>> hostname(eg:-localhost) and the port (eg - 9443) of the current server,
>>>> separately. Is there a method to get these data?
>>>>
>>>> Thank you.
>>>>
>>>> Regards
>>>> --
>>>> Shiva Balachandran
>>>> Software Engineer
>>>> WSO2 Inc.
>>>>
>>>> Mobile - +94 774445788
>>>> Blog - https://shivabalachandran.wordpress.com/
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [email protected]
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> *Malintha Adikari*
>>>  Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> Mobile: +94 71 2312958
>>> Blog:    http://malinthas.blogspot.com
>>> Page:   http://about.me/malintha
>>>
>>
>>
>>
>> --
>> *Malintha Adikari*
>>  Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> Mobile: +94 71 2312958
>> Blog:    http://malinthas.blogspot.com
>> Page:   http://about.me/malintha
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Irham Iqbal
> Software Engineer - Test Automation
>  WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
> phone: +94 777888452
>



-- 
Shiva Balachandran
Software Engineer
WSO2 Inc.

Mobile - +94 774445788
Blog - https://shivabalachandran.wordpress.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to