Ticket #198 (closed enhancement: fixed)

Opened 10 months ago

Last modified 6 months ago

TestGent4Web ScriptRunner support for DPLs

Reported by: fcohen Owned by:
Priority: blocker Milestone: passed
Version: 5.2 Keywords:
Cc:

Description (last modified by fcohen) (diff)

TestMaker needs to be able to pass-in DPL generated arguments to the TestGen4Web test script runner. TM 5.1 uses the TG4W htmlunit-interpreter to run TestGen4Web tests. The interpreter has the capability to take-in parameter data. I did not have enough time in TM 5.1 to hook this up in the TM ScriptRunner class, and I found the ScriptRunner class to be pretty unwieldy.

See the following for an example of this enhancement: example_agents/TG4W_dpl_example/TG4W_DPL_test.xml

-Frank

Change History

Changed 8 months ago by fcohen

Sachin wrote:

I have a CSV file and a TestGen4Web Script which is the Test Script I wanna run. What I wanna do is read the CSV file and load the data in TestGen4Web Script(Test1) which will be then run by LoadTest? XML file as follows :

A) TestGen4Web Script(Test1) :

<action type="fill" window="." step="2">

<xpath><![CDATA[*/FORM[@NAME="login"]/*/INPUT[@ID="username"]]]></xpath> <value><![CDATA[maestrotest]]></value>

</action> <action type="fill" window="." step="3">

<xpath><![CDATA[*/FORM[@NAME="login"]/*/INPUT[@ID="password"]]]></xpath> <value><![CDATA[password]]></value>

</action> <action type="click" refresh=".,." window="." step="4">

<xpath><![CDATA[*/FORM[@NAME="login"]/*/INPUT[@TYPE="button" and @VALUE="Login"]]]></xpath> <value><![CDATA[null]]></value>

</action>

B) LoadTest? XML file <resources>

<testgen4web path="./scripts/Test1"/>

</resources>

<test>

<!-- Add your <run> methods here --> <run name="MyTest?" testclass="Test1"

method="testGen4Web" langtype="testgen4web"/>

</test>

C) CSV file : Username,Password richie7,x12345 joecampbell,x12345 dlm1007,x12345

Currently all the DPL examples directly call the CSV file from Jython Script or Load XML file and do not use the TestGen4Web XML file. Hence I cannot load the values from CSV file dynamically and call them in TestGen4Web XML file. Can you show me an example of how to do this?I simply need to avoid manually typing the data in TestGen4Web XML file. IM looking for a regular expression or anything to do that?

Changed 8 months ago by fcohen

  • summary changed from DPL support for TestGen4Web tests to TestGent4Web ScriptRunner support for DPLs

Updated summary for this ticket to separate it from http://bugs.pushtotest.com/ticket/206. -Frank

Changed 8 months ago by fcohen

  • priority changed from major to blocker

Changed 7 months ago by fcohen

  • milestone set to verify

Changed 7 months ago by fcohen

I did a checkout of the tm5 code and ran the new example at example_agents/TG4W_dpl_example/TG4W_DPL_test.xml

I am seeing these errors:

element not found */FORM[1]/*/INPUT[@TYPE="text" and @NAME="account"]

I also see the following:

com.spike.tg4w.htmlunit.InterpreterException?: element not found */FORM[1]/*/INPUT[@TYPE="text" and @NAME="lastname"] at com.spike.tg4w.htmlunit.HtmlUnitInterpreter?.handleAction_fill(HtmlUnitInterpreter?.java:450) at com.spike.tg4w.htmlunit.HtmlUnitInterpreter?.runTest(HtmlUnitInterpreter?.java:219) at com.spike.tg4w.htmlunit.HtmlUnitInterpreter?.runAll(HtmlUnitInterpreter?.java:99) at com.pushtotest.testmaker.XSTest.client.TestGenForWeb?.runTestGen4WebInterpreter(TestGenForWeb?.java:124) at com.pushtotest.testmaker.XSTest.client.TestGenForWeb?.runActionsHTML(TestGenForWeb?.java:161) at sun.reflect.GeneratedMethodAccessor?14.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl?.invoke(DelegatingMethodAccessorImpl?.java:25) at java.lang.reflect.Method.invoke(Method.java:589) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.execute(ScriptRunner.java:1368) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.test(ScriptRunner.java:1141) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.warmup(ScriptRunner.java:950) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.run(ScriptRunner.java:846)com.spike.tg4w.htmlunit.InterpreterException: element not found */TABLE[1]/TBODY[1]/TR[1]/TD[2]/A[@CDATA="file3.html"] at com.spike.tg4w.htmlunit.HtmlUnitInterpreter?.handleAction_click(HtmlUnitInterpreter?.java:403) at com.spike.tg4w.htmlunit.HtmlUnitInterpreter?.runTest(HtmlUnitInterpreter?.java:211) at com.spike.tg4w.htmlunit.HtmlUnitInterpreter?.runAll(HtmlUnitInterpreter?.java:99) at com.pushtotest.testmaker.XSTest.client.TestGenForWeb?.runTestGen4WebInterpreter(TestGenForWeb?.java:124) at com.pushtotest.testmaker.XSTest.client.TestGenForWeb?.runActionsHTML(TestGenForWeb?.java:161) at sun.reflect.GeneratedMethodAccessor?14.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl?.invoke(DelegatingMethodAccessorImpl?.java:25) at java.lang.reflect.Method.invoke(Method.java:589) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.execute(ScriptRunner.java:1368) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.test(ScriptRunner.java:1141) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.warmup(ScriptRunner.java:950) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.run(ScriptRunner.java:846)com.spike.tg4w.htmlunit.InterpreterException: element not found */FORM[1]/*/INPUT[@NAME="Transfer" and @VALUE="Transfer Funds"] at com.spike.tg4w.htmlunit.HtmlUnitInterpreter?.handleAction_click(HtmlUnitInterpreter?.java:403) at com.spike.tg4w.htmlunit.HtmlUnitInterpreter?.runTest(HtmlUnitInterpreter?.java:211) at com.spike.tg4w.htmlunit.HtmlUnitInterpreter?.runAll(HtmlUnitInterpreter?.java:99) at com.pushtotest.testmaker.XSTest.client.TestGenForWeb?.runTestGen4WebInterpreter(TestGenForWeb?.java:124) at com.pushtotest.testmaker.XSTest.client.TestGenForWeb?.runActionsHTML(TestGenForWeb?.java:161) at sun.reflect.GeneratedMethodAccessor?14.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl?.invoke(DelegatingMethodAccessorImpl?.java:25) at java.lang.reflect.Method.invoke(Method.java:589) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.execute(ScriptRunner.java:1368) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.test(ScriptRunner.java:1141) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.warmup(ScriptRunner.java:950) at com.pushtotest.testmaker.XSTest.xml.TestScenario.ScriptRunner.run(ScriptRunner.java:846)

Changed 7 months ago by fcohen

  • milestone changed from verify to smoketest-failed

Changed 6 months ago by fcohen

  • status changed from new to closed
  • resolution set to fixed
  • description modified (diff)
  • milestone changed from smoketest-failed to passed

New code solves the exception. Confirmed new features are working. Closing this ticket. Well done! -Frank

Note: See TracTickets for help on using tickets.