[HtmlUnit] Different localhost aliases for running HtmlUnit unit tests

View: New views
7 Messages — Rating Filter:   Alert me  

[HtmlUnit] Different localhost aliases for running HtmlUnit unit tests

by Marc Guillemot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

in fact we need it since a long time, but issue 2891430 (HtmlUnit should
not violate the same-origin policy with FF3) highlight it: we need to be
able to load pages from different urls and therefore need aliases of
localhost to be able to run more unit tests through WebDriver.

This means that contributors wanting to run the tests will have to
configure their system configuration (/etc/hosts on *nix systems, I
don't remember where on Windows) and this means as well that it has to
be configured on the build server. For these reasons, we have to try not
to use too much hostnames and to choose them carefully to be sure that
it doesn't conflict with anything else.

What about introducing the "hut" (for HtmlUnit Tests) top level domain
which doesn't exist and therefore can't conflict with anything else:
- www.htmlunit.hut

I remember an other test (HTMLDocumentTest#domainLong) for which a
longer name is needed. Something like:
- d1.d2.www.htmlunit.hut
would do the job.

What do you think?

Cheers,
Marc.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop

Re: [HtmlUnit] Different localhost aliases for running HtmlUnit unit tests

by Ahmed Ashour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi Marc,
 
It is C:\WINDOWS\system32\drivers\etc\hosts in Windows.
Fine with me, we need to make sure tests pass (with warning) if configurations are not done locally.
 
I didn't test, but I hope that real browsers don't resolve alias and discover the IPs are identical, and we have a failed test (in other words, browsers should treat different hostnames differently, regardless of the actual IP).
 
Ahmed
----
Blog: http://asashour.blogspot.com

From: Marc Guillemot <mguillemot@...>
To: htmlunit-develop@...
Sent: Wed, November 4, 2009 10:53:31 AM
Subject: [HtmlUnit] Different localhost aliases for running HtmlUnit unit tests

Hi,

in fact we need it since a long time, but issue 2891430 (HtmlUnit should
not violate the same-origin policy with FF3) highlight it: we need to be
able to load pages from different urls and therefore need aliases of
localhost to be able to run more unit tests through WebDriver.

This means that contributors wanting to run the tests will have to
configure their system configuration (/etc/hosts on *nix systems, I
don't remember where on Windows) and this means as well that it has to
be configured on the build server. For these reasons, we have to try not
to use too much hostnames and to choose them carefully to be sure that
it doesn't conflict with anything else.

What about introducing the "hut" (for HtmlUnit Tests) top level domain
which doesn't exist and therefore can't conflict with anything else:
- www.htmlunit.hut

I remember an other test (HTMLDocumentTest#domainLong) for which a
longer name is needed. Something like:
- d1.d2.www.htmlunit.hut
would do the job.

What do you think?

Cheers,
Marc.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop

Re: [HtmlUnit] Different localhost aliases for running HtmlUnit unit tests

by Marc Guillemot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ahmed,

> It is C:\WINDOWS\system32\drivers\etc\hosts in Windows.
> Fine with me, we need to make sure tests pass (with warning)
> if configurations are not done locally.

why do you want the tests to pass in this case?

> I didn't test, but I hope that real browsers don't resolve alias and
> discover the IPs are identical, and we have a failed test (in other
> words, browsers should treat different hostnames differently, regardless
> of the actual IP).

I guess that this is the case (just think at all web sites hosted on the
same server by a provider). I can confirm that it works with FF3 and IE6.

Cheers,
Marc.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop

Re: [HtmlUnit] Different localhost aliases for running HtmlUnit unit tests

by Ahmed Ashour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi Marc,
 
>>we need to make sure tests pass (with warning)  if configurations are not done locally.
>why do you want the tests to pass in this case?
 
Well, some users don't have the admin privileges, and tests should 'be ignored/succeed' for them, just like what we do for real browsers, if WebDriver is not configured.
 
Ahmed


From: Marc Guillemot <mguillemot@...>
To: htmlunit-develop@...
Sent: Wed, November 4, 2009 6:16:47 PM
Subject: Re: [HtmlUnit] Different localhost aliases for running HtmlUnit unit tests

Hi Ahmed,


> I didn't test, but I hope that real browsers don't resolve alias and
> discover the IPs are identical, and we have a failed test (in other
> words, browsers should treat different hostnames differently, regardless
> of the actual IP).

I guess that this is the case (just think at all web sites hosted on the
same server by a provider). I can confirm that it works with FF3 and IE6.

Cheers,
Marc.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop

Re: [HtmlUnit] Different localhost aliases for running HtmlUnit unit tests

by Tim Moore-11 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov 3, 2009, at 11:53 PM, Marc Guillemot wrote:

> Hi,
>
> in fact we need it since a long time, but issue 2891430 (HtmlUnit  
> should
> not violate the same-origin policy with FF3) highlight it: we need  
> to be
> able to load pages from different urls and therefore need aliases of
> localhost to be able to run more unit tests through WebDriver.
>

You can get a lot of mileage out of using both "localhost" and  
"127.0.0.1", which can be used to test cross-domain issues without  
requiring additional configuration.

I haven't exhaustively tested all browsers, but I have never run into  
an instance where the browser checks the IP that the hostname resolves  
to and allows cross-domain XHR/cookies/etc if they resolve to the same  
address.

-- Tim


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop

Re: [HtmlUnit] Different localhost aliases for running HtmlUnit unit tests

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

+1 (if possible)

I'd love to avoid an external configuration requirement... thanks for the info, Tim!



On Wed, Nov 4, 2009 at 4:39 PM, Tim Moore <tmoore@...> wrote:
On Nov 3, 2009, at 11:53 PM, Marc Guillemot wrote:


You can get a lot of mileage out of using both "localhost" and
"127.0.0.1", which can be used to test cross-domain issues without
requiring additional configuration.



--
Daniel Gredler
http://daniel.gredler.net/

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop

Re: [HtmlUnit] Different localhost aliases for running HtmlUnit unit tests

by Marc Guillemot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

good idea. Thanks Tim!

Then my proposition is for the day where 127.0.0.1 and localhost are not
enough anymore (it's already not enough for a few tests, but there are
not so important that it is really interesting to run them in real
browsers through WebDriver too).

Cheers,
Marc.

I'll use 127.0.0.1
Daniel Gredler a écrit :

> +1 (if possible)
>
> I'd love to avoid an external configuration requirement... thanks for
> the info, Tim!
>
>
>
> On Wed, Nov 4, 2009 at 4:39 PM, Tim Moore <tmoore@...
> <mailto:tmoore@...>> wrote:
>
>     On Nov 3, 2009, at 11:53 PM, Marc Guillemot wrote:
>
>
>     You can get a lot of mileage out of using both "localhost" and
>     "127.0.0.1", which can be used to test cross-domain issues without
>     requiring additional configuration.
>
>
>
>
> --
> Daniel Gredler
> http://daniel.gredler.net/


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop