[ptt-users] Enable redirect in TestMaker functional tests

William Martinez Pomares wmartinez at AVANTICATEC.NET
Wed Mar 12 06:01:02 PST 2008


Hi Dimitar.
No, that is not what the message from HTMLUnit says. 
The guy from HTMLUnit uses HTTPUnit to perform the HTTP work. But for
some reason, he disables HTTPUnit redirection and handles redirection
manually in HTMLUnit, one layer above. The problem he faces is that
HTTPUnit throws that warning and he does not know how to avoid it. The
redirection is done in HTMLUnit, but HTTPUnit throws the warning since
it does not know about it. So, there is no problem with redirecting,
just an annoying message from an underlying module.

Thus, your don't need to change Java Code. Actually, you can run the
TG4W script using langtype ="tg4w" without needing to geenrate java nor
jython code.

Hope this clarifies.

Regards, 

William Martinez

-----Original Message-----
From: users-bounces at lists.pushtotest.com
[mailto:users-bounces at lists.pushtotest.com]On Behalf Of
DGeorgie at wiley.com
Sent: Tuesday, March 11, 2008 8:17 PM
To: TestMaker users list
Subject: RE: [ptt-users] Enable redirect in TestMaker functional tests


Hi William,

If I understood correctly I will need to modify the generated Java code
to 
enable the HTTP redirect and then create another test scenario with 
TestMaker to run the Java code. How do I enable the HTTP redirect in the

Java code? I am still researching the documentation and  not sure how to

enable it.

Too bad HTMLUnit is not supporting redirects. It makes simple tests 
difficult,

Thanks,

Dimitar Georgievski




William Martinez Pomares <wmartinez at AVANTICATEC.NET> 
Sent by: users-bounces at lists.pushtotest.com
03/11/2008 06:26 PM
Please respond to
TestMaker users list <users at lists.pushtotest.com>


To
"TestMaker users list" <users at lists.pushtotest.com>
cc

Subject
RE: [ptt-users] Enable redirect in TestMaker functional  tests






Hi Dimitar.
This is interesting.
TG4W is a tool to record the steps of your interactions. When replayed
in the browser, the tool is using the actual browser actions to repeat
the steps.
When used outside the browsers, TG4W uses the HTMLUnit product to replay
the steps. HTMLUnit is a testing product that executes all the common
browser actions without a IU. Internally, it uses another tool called
httpclient from apache commons.

So, when used in TM, it actually calls the HTMLUnit to perform all the
recorded steps smulating a browser. Using a Jython or Java generated
from the TG4W script will allow you to see all the steps and customize
the calls to HTMLUnit. 

That error you see there, it seems, is a message in the HTMLUnit module
but not an error. See what it is said about that in the HTMLUnit site:

" I get error messages about redirection being disabled but I've turned
it on.

    26.02.2003 16:07:05 org.apache.commons.httpclient.HttpMethodBase
processRedirectResponse
    INFO: Redirect requested but followRedirects is disabled
 

    It's an annoyance that I haven't figured out how to fix yet.

    For a variety of reasons, I handle the redirection logic inside
HtmlUnit rather than letting commons-httpclient handle it for me. It's
commons-httpclient that is displaying that message because I have
explicitly disabled its redirection support.

    I'd like to filter out that warning message but haven't figured out
a clean way of doing it. A number of people have pointed out that it's
easy to disable a message if you know which logger is being used. The
problem is that there isn't a way to disable the messages without
knowing the logger in use. "
http://htmlunit.sourceforge.net/faq.html#RedirectionDiagnosticMessages

So, it seems that message is not an error, but a unhandled warning from
HTMLUnit guys.

Furthermore. If TG4W fails, it will show the error and the trace. 

So, it seems there is yet no way to eliminate the message, but it also
seems the steps are being correctly executed.

Now, about the generation error: Could you please tell me what was the
error when generating?
Was it generating or running the generated asset?
If you generated Jython, it will automatically work without any other
setup (Jython is interpreted).
If you generated Java, you will need to compile the java and pack it
into a jar. In the TestScenario you will need to use the <jar > tag to
indicate where the java jar is to be found. You can follow the
"counterDPLExample".
                 <resources>
                                 <jar
path="./example_agents/counterDPLExample/print.jar"/>
                 </resources>

                 <run name="CVS" testclass="com.examples.print" 
method="print"
langtype="java"> 

If you need more help please let me know.

William Martinez

-----Original Message-----
From: users-bounces at lists.pushtotest.com
[mailto:users-bounces at lists.pushtotest.com]On Behalf Of
DGeorgie at wiley.com
Sent: Tuesday, March 11, 2008 1:00 PM
To: users at lists.pushtotest.com
Subject: [ptt-users] Enable redirect in TestMaker functional tests


I have problem with a functional test. When the script runs it generates

these errors in the TestNode output.

Executing time 0
TestRunListeners
TestIndex
Test #1/1 : ./localhost/ProfLogin_loop2.tg4w
- Redirect requested but followRedirects is disabled
- Redirect requested but followRedirects is disabled
- Redirect requested but followRedirects is disabled


The functional test was created based on a script generated by
TestGen4Web 
0.50.2. I am using TestMaker 5.1 on Fedora 8 and Java 6 build 3. 
The TestGen4Web script executes correctly in FireFox browser.

I have found in TG4W  forums other people with the same problem but no 
solution for the problem. I couldn't find any TestMaker setting that
could 
affect the Redirect behavior which is really strange because I am sure 
most of modern Web applications are using redirects extensively. Without
a 
support for it any testing tool would be useless.

I also converted the TG4W script to a Java program hoping I would be
able 
to tweak the Java code and enable the HTTP redirects. BTW the Jython 
translation didn't work.

The generated code has a class which executes the test.
InterpreterContext context = new InterpreterContext(this.config);

I am still trying to find a documentation for this class. I need help
with 
two things here:
1) how to correctly set -up the classpath to compile and execute the
Java 
program
2) how to enable the HTTP redirects in the Java program.

Thanks in advance!

Dimitar 
_______________________________________________
Users mailing list
Users at lists.pushtotest.com
http://lists.pushtotest.com/mailman/listinfo/users
_______________________________________________
Users mailing list
Users at lists.pushtotest.com
http://lists.pushtotest.com/mailman/listinfo/users


_______________________________________________
Users mailing list
Users at lists.pushtotest.com
http://lists.pushtotest.com/mailman/listinfo/users


More information about the Users mailing list