Re: [Dev] get Hostname and Port of the current server
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 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 > 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 ** section of that file. >> >> ex: >> >> >> > nonBlockingTransportEnabled="true"> esb.wso2con.com >> mgt.esb.wso2con.com> >82438280> > >> >> >> .. >> >> >> 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 >> 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 >>> 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 Dev@wso2.org 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 >> Dev@wso2.org >> 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 Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] get Hostname and Port of the current server
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 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 ** section of that file. > > ex: > > > nonBlockingTransportEnabled="true"> esb.wso2con.com > mgt.esb.wso2con.com >82438280 > > > .. > > > 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 > 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 >> 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 >>> Dev@wso2.org >>> 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 > Dev@wso2.org > 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 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] get Hostname and Port of the current server
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 ** section of that file. ex: esb.wso2con.com mgt.esb.wso2con.com82438280 .. 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 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 > 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 >> Dev@wso2.org >> 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 Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] get Hostname and Port of the current server
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 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 > Dev@wso2.org > 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 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] get Hostname and Port of the current server
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 Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev