dev@javaserverfaces.java.net

Re: High level plans/ideas for _05

From: Adam Winer <adam.winer_at_oracle.com>
Date: Fri, 02 Mar 2007 13:23:46 -0800

Ryan Lubke wrote:
> Adam Winer wrote:
>> Ryan Lubke said the following on 3/2/07 10:19 AM PT:
>>> Jesse Alexander (KSFD 121) wrote:
>>>>> Are you using goldenfiles? :)
>>>>>
>>>> what's that?
>>>>
>>> It's testing tecnique where a response is compare
>>> byte-for-byte against a control file. So even if
>>> the change in the response is only whitespace,
>>> the test would fail.
>>
>> ... which makes golden files generally a nightmare.
>> Tests also fail if you change, for instance, your
>> auto-ID generation code. Or if you change the
>> order in which attributes are written. Etc.
> Yep - unfortunately the RI have a few too many
> of these kinds of tests.
>>
>> FYI, I wrote a ResponseWriter for Trinidad that
>> solves many of these problems:
>>
>> https://svn.apache.org/repos/asf/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/TestResponseWriter.java
>>
>>
>> ... especially in conjunction with a special
>> ExternalContext implementation that I swap in.
> What does the ExternalContext implementation provide?

It's inside here:

https://svn.apache.org/repos/asf/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MFacesContext.java

Mostly it provides non-no-op operations for calls to
encodeResourceURL() and encodeActionURL(), so that the golden
files test that you haven't dropped or added calls to these
APIs. Also, this specific tests is running outside of
a servlet container, so it provides default implementations
of getRequestContextPath(), etc.

-- Adam


For this specific test environment,