On Mon, Feb 04, 2008 at 03:58:54PM +0900, [EMAIL PROTECTED] wrote:
> Hi,
>
> I am currently doing some tests with my application and I am wondering if
> there is any efficient and effective way to know if pages which should be
> displayed correctly are actually being redirected to another page, such as
> "404 - Data Not Found", because of some logic or data mismatches ?
>
> One idea that came to my mind is by generating URLs and visiting generated
> URLs by our program, and check the used template file. For example, if we
> have 3 records, with '1','2','3' as their ids, we want to do a loop to visit
> each generated URL and look if they are displayed correctly by
> generating an output such as this:
>
> URL ID Used Template
> --- -- ------------
> localhost/key/1 1 index.tt2
> localhost/key/2 2. error.tt2
> localhost/key/3 3. index.tt2
>
> But I am not sure if that is even possible. Any ideas ?
Well, you could edit every template file and put:
<!-- Template used: [% c.stash.template %] -->
.. but that seems, erm, Not Good.
Have you considered checking the status code of the pages in your tests?
eg.
for (1..3) {
is( request("localhost/key/$_")->code, 200, 'Request succeeded' );
}
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/