Thanks John . I did the following :
Created a working version of TestNGTestCase and then did some
modifications to make it .groovy . Following were the modifications
@Test(groups=["hadmin"])
instead
@Test(groups={"hadmin"})
and I had to change the build order in the build.xml to run the <javac> task
first and then run <groovyc>
This makes sure that I can run the code without the static block
Regards
Hari
On Tue, Mar 10, 2009 at 9:20 AM, John <[email protected]> wrote:
>
> Hi,
>
> I just added a Groovy class TelluriumGroovyTestNGTestCase and you
> can extend this class to write your TestNG test cases in Groovy. For
> example,
> see the GoogleStartPageGroovyTestNGTestCase as follows,
>
> public class GoogleStartPageGroovyTestNGTestCase extends
> TelluriumGroovyTestNGTestCase{
> NewGoogleStartPage ngsp
>
> public void initUi() {
> //initialize UI modules here
> ngsp = new NewGoogleStartPage()
> ngsp.defineUi()
>
> }
>
> @Test
> void testTypeGoogle(){
> //test google start page using composite locators
> connectUrl("http://www.google.com")
> ngsp.doGoogleSearch("tellurium selenium automated testing")
> connectUrl("http://www.google.com")
> ngsp.doImFeelingLucky("tellurium selenium groovy dsl")
> }
>
> //test the dynamically added event "click"
> @Test
> void testClick(){
> //test google start page using composite locators
> connectUrl("http://www.google.com")
> ngsp.testClick()
> }
>
> static {
> def testng = new TestNG()
> testng.setTestClasses
> (example.test.groovy.GoogleStartPageGroovyTestNGTestCase)
> testng.addListener(new TestListenerAdapter())
> }
>
> }
>
> The ugly piece is the static block, but you have to live with it.
>
> Please check Trunk/Core code for more details. I will upload a new
> tellurium-0.6.0.jar soon.
>
> Thanks,
>
> Jian
>
>
> On Mar 9, 10:39 pm, John <[email protected]> wrote:
> > Here is some guide
> >
> > http://groovy.codehaus.org/Using+TestNG+with+Groovy
> >
> > On Mar 9, 7:44 pm, Harihara Vinayakaram <[email protected]> wrote:
> >
> > > Hi
> > > I have been trying to get a working TestNG test case in Groovy. I
> seem to
> > > be missing something very basic. Can someone provide a basic example of
> a
> > > TestNG test case in groovy. I tried the following :
> > > (a) Get a working TestNG test case in java and then rename that to
> > > groovy --- Did not work
> > > (b) Try extending BaseGroovyTestCase -- Did not work since that
> is
> > > extending junit
> >
> > > Appreciate any pointers
> >
> > > Regards
> > > Hari
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---