Hello Jian,
As you had suggested me yesterday i used the InputBox, UrlLink and the
SubmitButton for the same JSF Grid component i had mentioned
yesterday.
This time,
I am able to complete the test cases meaning i dont get any error
message the log stack mention below.
===================================== LOG STACK - START
==========================================
Test set: test.GoogleSearchJUnitTestCase
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 15.532
sec
===================================== LOG STACK - END
==========================================
But there are no events happening on the UI meaning, when we run
Tellurinum Test Cases it inserts the values in InputBoxs, Clicks on
Links and Submit Buttons.
Please take a look at my .groovy file code snippet below
===================================== .GROOVY CODE SNIPPET - START
==========================================
public class MyGoogleSearchModule extends DslContext {
public void defineUi() {
ui.StandardTable(uid: "HelloFormoutGrid", clocator: [tag:
"table",
direct: "true", id: "helloForm:outGrid"]){
InputBox(uid: "{row: all, column: 1}", clocator: [:])
UrlLink(uid: "{row: all, column: 3}", clocator: [:])
SubmitButton(uid: "{row: all, column: 4}", clocator:
[tag: "input",
type: "submit", value: "Button-1"])
}
}
public void testLink(){
pause 3000
println "====For Button Column ==="
println getUiElement("HelloFormoutGrid[1][4]")
println getText("HelloFormoutGrid[1][4]")
click "HelloFormoutGrid[1][4]"
pause 3000
println "====For Link Column ==="
println getUiElement("HelloFormoutGrid[1][3]")
println getText("HelloFormoutGrid[1][3]")
pause 3000
click "HelloFormoutGrid[1][3]"
pause 3000
waitForPageToLoad 60000
}
}
===================================== .GROOVY CODE SNIPPET - END
==========================================
Taking the above .groovy file code snippet's testLink() method
Tellurium should click the Links and the Submit Buttons which are
included in the grid and redirect the page to the next page (CODE FOR
REDIRECTING IS IN PLACE AND WORKS WELL IN NORMAL APPLICATION).
I tried with input box too and the story is same the test case passes
but nothing happens on UI.
Again the code of my grid component is passed below.
<h:form id="helloForm">
<h:panelGrid columns="4" border="10"
id="outGrid">
<f:facet name="header">
<h:outputText value="Input Box
Column"/>
</f:facet>
<h:inputText id="textCol1"/>
<h:outputText value="TextCol-1"/
>
<h:commandLink
action="greeting" value="Go for another page."/>
<h:commandButton
id="buttonCol1" value="Button-1"
action="greeting"/>
<f:facet name="header">
<h:outputText value="Output Box
Column"/>
</f:facet>
<h:inputText id="textCol2"/>
<h:outputText value="TextCol-2"/
>
<h:commandLink
action="greeting" value="Go for another page."/>
<h:commandButton
id="buttonCol2" value="Button-2"
action="greeting"/>
<f:facet name="header">
<h:outputText value="Link
Column"/>
</f:facet>
<h:inputText id="textCol3"/>
<h:outputText value="TextCol-3"/
>
<h:commandLink
action="greeting" value="Go for another page."/>
<h:commandButton
id="buttonCol3" value="Button-3"
action="greeting"/>
<f:facet name="header">
<h:outputText value="Button
Column"/>
</f:facet>
<h:inputText id="textCol4"/>
<h:outputText value="TextCol-4"/
>
<h:commandLink
action="greeting" value="Go for another page."/>
<h:commandButton
id="buttonCol4" value="Button-4"
action="greeting"/>
</h:panelGrid>
</h:form
>
Again, whats going wrong from my side? Am i doing some thing wrong?
I just need to test a simple grid in JSF which is having 4 columns
with InputBoxs in 1st Column, OutputBoxs in 2nd, UrlLinks in 3rd and
SubmitButtons in 4th.
Can you kindly provide me with a small code snippet or a small example
for such a Grid Component if you have?
Thanks
-Eric.
Jian Ans :
=========
Hi Eric,
Are you using Tellurium new Engine or Selenium Core. Selenium Core is
used in 0.7.0 by
default. Did you see the commands passed to Selenium server? For
instance, you can run
a standalone Selenium server and the log messages will be on the
console. Please post them.
I suspect if the UI module could be located or not. If you try to call
diagnose("HelloFormoutGrid[1][4]")
what happens?
In your code, did the command getText("HelloFormoutGrid[1][4]")
getback any value. Seems for InputBox, you should use getValue().
You can try
type "HelloFormoutGrid[1][4]", "test"
def x = getValue("HelloFormoutGrid[1][4]")
assertEquals("test", x)
to see if the InputBox is updated after the type command. You could
debug your
code in an IDE.
Tellurium reference project ui-examples includes examples for
different UI types,
you may like to take a look.
I am not familiar with JSF, does it always require namespace in the UI
definition?
I am not sure if you need to add namespace as well.
Thanks,
Jian
On Aug 18, 6:18 pm, Jian Fang <[email protected]> wrote:
> You are right, assertEquals does not exist in UI module class since it does
> not inherit JUnit test case directly.
> But you could try static import for the assertions, for example
>
> import static org.junit.Assert.assertEquals;
>
> Thanks,
>
> Jian
>
> On Wed, Aug 18, 2010 at 2:28 AM, Eric Gokavi <[email protected]> wrote:
> > Hello Jian,
>
> > There is one more thing i would like to share with you here.
> > The Links and the Buttons in the below mentioned Grid are pointing
> > (redirecting) to a intenal web site page of the application, but when i run
> > the Tellurium tests these links do not redirect to respective pages, but the
> > tests passes without error.
>
> > Also when i added assertEquals x, "test",
> > line in the below mention testLink method i get the exception stating,
>
> > groovy.lang.MissingMethodException: No signature of method:
> > module.MyGoogleSearchModule.assertEquals() is applicable for argument types:
> > (java.lang.String, java.lang.String) values: [test, test]
> > at
> > org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:54)
> > at
> > org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78)
> > at
> > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
> > at
> > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
> > at
> > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:155)
> > at module.MyGoogleSearchModule.testLink(MyGoogleSearchModule.groovy:60)
> > at
> > test.GoogleSearchJUnitTestCase.testTable(GoogleSearchJUnitTestCase.java:58)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > at java.lang.reflect.Method.invoke(Method.java:597)
> > at
> > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> > at
> > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> > at
> > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> > at
> > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> > at
> > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> > at
> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> > at
> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> > at
> > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> > at
> > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> > at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> > at
> > org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> > at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> > at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
> > at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > at java.lang.reflect.Method.invoke(Method.java:597)
> > at
> > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
> > at
> > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
>
> > Kindly help.
>
> > -Eric.
>
> > On Wed, Aug 18, 2010 at 11:03 AM, Eric Gokavi <[email protected]>wrote:
>
> >> Hello Jian,
>
> >> I am using Selenium Core - 0.7.0.
> >> These are my logs for the testLink method
>
> >> public void testLink(){
> >> pause 3000
> >> println "Getting UI Element for Button Column :
> >> "+getUiElement("HelloFormoutGrid[1][4]")
> >> println "Getting Text for Button Column :
> >> "+getText("HelloFormoutGrid[1][4]")
> >> println "Clicking the Button on Column "
>
> >> click "HelloFormoutGrid[1][4]"
> >> pause 3000
> >> println "Getting UI Element for Link Column :
> >> "+getUiElement("HelloFormoutGrid[1][3]")
> >> println "Getting Text for Link Column :
> >> "+getText("HelloFormoutGrid[1][3]")
> >> pause 3000
> >> println "Clicking the Link on Column "
>
> >> click "HelloFormoutGrid[1][3]"
> >> pause 3000
> >> println " Setting Value in Inbox Column : "
> >> type "HelloFormoutGrid[1][1]", "test"
> >> def x = getValue("HelloFormoutGrid[1][1]")
> >> println " Getting Value from Inbox :: - "+x
> >> //println "==== diagnose in ==="
> >> //diagnose("HelloFormoutGrid[1][4]")
> >> //println "==== diagnose out ==="
> >> //waitForPageToLoad 60000
> >> }
>
> >> ======================== LOGS START ===============================
> >> Inside intiUI :
> >> Opening JSFKickstart :::::
> >> Inside testTable method :::::
> >> Getting UI Element for Button Column :
> >> org.telluriumsource.ui.object.submitbut...@117c0eb
> >> TE: Name: isElementPresent, start: 1282109521182, duration: 438ms
> >> TE: Name: isElementPresent, start: 1282109521182, duration: 438ms
> >> TE: Found exact match for UI Module 'HelloFormoutGrid':
> >> {"id":"HelloFormoutGrid","relaxDetails":[],"matches":1,"relaxed":false,"score":100.0,"found":true}
> >> TE: Found exact match for UI Module 'HelloFormoutGrid':
> >> {"id":"HelloFormoutGrid","relaxDetails":[],"matches":1,"relaxed":false,"score":100.0,"found":true}
> >> TE: Name: isElementPresent, start: 1282109521651, duration: 16ms
> >> TE: Name: isElementPresent, start: 1282109521651, duration: 16ms
> >> TE: Name: getText, start: 1282109522167, duration: 15ms
> >> TE: Name: getText, start: 1282109522167, duration: 15ms
> >> Getting Text for Button Column :
> >> Clicking the Button on Column
> >> TE: Name: getBundleResponse, start: 1282109522213, duration: 16ms
> >> TE: Name: getBundleResponse, start: 1282109522213, duration: 16ms
> >> Getting UI Element for Link Column :
> >> org.telluriumsource.ui.object.urll...@229ed4
> >> TE: Name: isElementPresent, start: 1282109525229, duration: 16ms
> >> TE: Name: isElementPresent, start: 1282109525229, duration: 16ms
> >> TE: Name: isElementPresent, start: 1282109525245, duration: 15ms
> >> TE: Name: isElementPresent, start: 1282109525245, duration: 15ms
> >> TE: Name: getText, start: 1282109525760, duration: 0ms
> >> TE: Name: getText, start: 1282109525760, duration: 0ms
> >> Getting Text for Link Column : Go for another page.
> >> Clicking the Link on Column
> >> TE: Name: getBundleResponse, start: 1282109528776, duration: 16ms
> >> TE: Name: getBundleResponse, start: 1282109528776, duration: 16ms
> >> Setting Value in Inbox Column :
> >> TE: Name: getBundleResponse, start: 1282109531807, duration: 31ms
> >> TE: Name: getBundleResponse, start: 1282109531807, duration: 31ms
> >> TE: Name: isElementPresent, start: 1282109531838, duration: 16ms
> >> TE: Name: isElementPresent, start: 1282109531838, duration: 16ms
> >> TE: Name: isElementPresent, start: 1282109531854, duration: 16ms
> >> TE: Name: isElementPresent, start: 1282109531854, duration: 16ms
> >> TE: Name: getValue, start: 1282109532370, duration: 31ms
> >> TE: Name: getValue, start: 1282109532370, duration: 31ms
> >> Getting Value from Inbox :: - test
> >> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 24.171 sec
>
> >> Results :
>
> >> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
>
> >> [INFO]
> >> ------------------------------------------------------------------------
> >> [INFO] BUILD SUCCESSFUL
> >> [INFO]
> >> ------------------------------------------------------------------------
> >> [INFO] Total time: 29 seconds
> >> [INFO] Finished at: Wed Aug 18 11:02:13 GMT+05:30 2010
> >> [INFO] Final Memory: 24M/58M
> >> [INFO]
> >> ------------------------------------------------------------------------
>
> >> ======================== LOGS END ===============================
>
> >> I guess everything is going fine the only thing is i am not able to see it
> >> in the new browser window which is open by Tellurium.
>
> >> Is the the expected behavior?
> >> Please answer me when ever possible.
>
> >> Regards,
> >> -Eric.
>
> >> On Tue, Aug 17, 2010 at 6:55 PM, Jian Fang <[email protected]>wrote:
>
> >>> Hi Eric,
>
> >>> Are you using Tellurium new Engine or Selenium Core. Selenium Core is
> >>> used in 0.7.0 by
> >>> default. Did you see the commands passed to Selenium server? For
> >>> instance, you can run
> >>> a standalone Selenium server and the log messages will be on the console.
> >>> Please post them.
>
> >>> I suspect if the UI module could be located or not. If you try to call
>
> >>> diagnose("HelloFormoutGrid[1][4]")
>
> >>> what happens?
>
> >>> In your code, did the command getText("HelloFormoutGrid[1][4]") getback
> >>> any value. Seems for InputBox, you should use getValue().
>
> >>> You can try
>
> >>> type "HelloFormoutGrid[1][4]", "test"
> >>> def x = getValue("HelloFormoutGrid[1][4]")
> >>> assertEquals("test", x)
>
> >>> to see if the InputBox is updated after the type command. You could debug
> >>> your
> >>> code in an IDE.
>
> >>> Tellurium reference project ui-examples includes examples for different
> >>> UI types,
> >>> you may like to take a look.
>
> >>> I am not familiar with JSF, does it always require namespace in the UI
> >>> definition?
> >>> I am not sure if you need to add namespace as well.
>
> >>> Thanks,
>
> >>> Jian
>
> >>> On Tue,
>
> ...
>
> read more »
--
You received this message because you are subscribed to the Google Groups
"tellurium-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tellurium-users?hl=en.