[ptt-users] Enable redirect in TestMaker functional tests

William Martinez Pomares wmartinez at AVANTICATEC.NET
Tue Mar 11 14:26:13 PST 2008


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


More information about the Users mailing list