This won't work because the "tellurium" object is protected and on a
different package. My "YourTestNGTestCase" will be on its own
package. Unless you're asking me to put my "YourTestNGTestCase" in
the same package as "BaseTelluriumJavaTestCase" which I'll need to
rebuild the tellurium source. The tests passed using JUnit w/o the
error. The tests also passed with the error using TestNG. The
problem is the error.
public class YourTestNGTestCase extends BaseTelluriumJavaTestCase {
@BeforeClass
public static void setUpForTest() {
tellurium = TelluriumSupport.addSupport();
tellurium.start(customConfig);
connector = (SeleniumConnector) tellurium.getConnector();
}
@AfterClass
public static void tearDownForTest() {
if(tellurium != null)
tellurium.stop();
}
}
won't work because
On Jun 10, 2:09 pm, Jian Fang <[email protected]> wrote:
> I mean you can extend your class in the follow way.
>
> public class YourTestNGTestCase extends BaseTelluriumJavaTestCase {
>
> @BeforeClass
> public static void setUpForTest() {
> tellurium = TelluriumSupport.addSupport();
> tellurium.start(customConfig);
> connector = (SeleniumConnector) tellurium.getConnector();
> }
>
> @AfterClass
> public static void tearDownForTest() {
> if(tellurium != null)
> tellurium.stop();
> }
>
> }
>
> Perhaps it took some time for the embedded selenium server to shutdown for
> the first test. But after some time, the embedded server
> started up successfully and the second test went through?
>
> BTW, are the tests failed or succeeded?
>
> Thanks,
>
> Jian
>
> On Thu, Jun 10, 2010 at 4:56 PM, super fan 911 <[email protected]>wrote:
>
> > If my test cases extends BaseTelluriumJavaTestCase, it will fail
> > because the selenium server hasn't been initialized and started. I
> > can add the @BeforeTest and @AfterTest methods,
> > but they won't be able to access the "tellurium" and "connector"
> > objects because they are protected.
>
> > I tried running multiple tests in Eclipse with the TestNG plug-in, i
> > get the same result.
>
> > If we look at the stack trace below, it looks like it's trying to
> > configure the embedded selenium server 2x before starting the
> > client...why? Is it trying to run the tests in parallel?
>
> > [testng] Parse configuration file: TelluriumConfig.groovy from
> > project root directory
> > [testng] Configure UI Object Builders using configuration
> > [testng] Configure widget modules using configuration
> > [testng] Configure event handler using configuration
> > [testng] Configure data accessor using configuration
> > [testng] Configure dispatcher using configuration
> > [testng] Configure Embedded Selenium Server using configuration
> > [testng] Warning: No user-extensions.js
> > [testng] Configure Selenium Client using configuration
> > [testng] Configure Embedded Selenium Server using configuration
> > [testng] Warning: No user-extensions.js
> > [testng] java.net.BindException: Selenium is already running on
> > port 4444. Or some other service is.
> > [testng] at
> > org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:
> > 378)
> > [testng] at
> > org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:
> > 224)
> > [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > [testng] at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 39)
> > [testng] at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > 25)
> > [testng] at java.lang.reflect.Method.invoke(Method.java:597)
> > [testng] at
> > org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite
> > $PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:
> > 229)
> > [testng] at
>
> > org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:
> > 52)
> > [testng] at
>
> > org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:
> > 121)
> > [testng] at
>
> > org.telluriumsource.server.SeleniumServerDaemon.run(SeleniumServerDaemon.groovy:
> > 142)
> > [testng] at org.telluriumsource.server.SeleniumServerDaemon
> > $run.call(Unknown Source)
> > [testng] at
>
> > org.telluriumsource.server.EmbeddedSeleniumServer.setUpSeleniumServer(EmbeddedSeleniumServer.groovy:
> > 63)
> > [testng] at org.telluriumsource.server.EmbeddedSeleniumServer
> > $setUpSeleniumServer.callCurrent(Unknown Source)
> > [testng] at
>
> > org.telluriumsource.server.EmbeddedSeleniumServer.runSeleniumServer(EmbeddedSeleniumServer.groovy:
> > 74)
> > [testng] at org.telluriumsource.server.EmbeddedSeleniumServer
> > $runSeleniumServer.call(Unknown Source)
> > [testng] at
>
> > org.telluriumsource.framework.TelluriumFramework.start(TelluriumFramework.groovy:
> > 145)
> > [testng] at org.telluriumsource.framework.TelluriumFramework
> > $start.callCurrent(Unknown Source)
> > [testng] at
>
> > org.telluriumsource.framework.TelluriumFramework.start(TelluriumFramework.groovy:
> > 154)
> > [testng] at
>
> > org.telluriumsource.test.java.TelluriumTestNGTestCase.setUpForTest(TelluriumTestNGTestCase.java:
> > 23)
> > [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > [testng] at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 39)
> > [testng] at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > 25)
> > [testng] at java.lang.reflect.Method.invoke(Method.java:597)
> > [testng] at
> > org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
> > [testng] at
> > org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:
> > 443)
> > [testng] at
> > org.testng.internal.Invoker.invokeConfigurations(Invoker.java:160)
> > [testng] at
> > org.testng.internal.Invoker.invokeConfigurations(Invoker.java:90)
> > [testng] at org.testng.TestRunner.beforeRun(TestRunner.java:
> > 522)
> > [testng] at org.testng.TestRunner.run(TestRunner.java:490)
> > [testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:
> > 329)
> > [testng] at
> > org.testng.SuiteRunner.runSequentially(SuiteRunner.java:324)
> > [testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:
> > 296)
> > [testng] at org.testng.SuiteRunner.run(SuiteRunner.java:201)
> > [testng] at
> > org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
> > [testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
> > [testng] at org.testng.TestNG.run(TestNG.java:787)
> > [testng] at org.testng.TestNG.privateMain(TestNG.java:952)
> > [testng] at org.testng.TestNG.main(TestNG.java:925)
> > [testng] Configure Selenium Client using configuration
> > [testng] hello world 2
> > [testng] test passed.
> > [testng]
> > [testng] hello world
> > [testng] test passed.
> > [testng] PASSED: testXYZ
> > [testng] PASSED: testXYZ
> > [testng]
> > [testng] ===============================================
> > [testng] Functional
> > [testng] Tests run: 2, Failures: 0, Skips: 0
> > [testng] ===============================================
>
> > On Jun 10, 1:15 pm, Jian Fang <[email protected]> wrote:
> > > FYI: comparison of JUnit and TestNG annotations.
>
> > >http://www.mkyong.com/unittest/junit-4-vs-testng-comparison/
>
> > > On Thu, Jun 10, 2010 at 4:06 PM, Jian Fang <[email protected]>
> > wrote:
> > > > Here is the code.
>
> > > > public abstract class TelluriumTestNGTestCase extends
> > > > BaseTelluriumJavaTestCase {
>
> > > > @BeforeTest(alwaysRun = true)
> > > > public static void setUpForTest() {
> > > > tellurium = TelluriumSupport.addSupport();
> > > > tellurium.start(customConfig);
> > > > connector = (SeleniumConnector) tellurium.getConnector();
> > > > }
>
> > > > @AfterTest(alwaysRun = true)
> > > > public static void tearDownForTest() {
> > > > if(tellurium != null)
> > > > tellurium.stop();
> > > > }
> > > > }
>
> > > > You can create a test case that extends BaseTelluriumJavaTestCase. Then
> > you
> > > > use @BeforeClass and @AfterClass
> > > > annotations to do setup and teardown in your test case. Let us know if
> > this
> > > > works.
>
> > > > BTW, Have you tried to run multiple Tellurium TestNG test cases in an
> > IDE?
> > > > Just wonder if this problem is only ant related.
>
> > > > Thanks,
>
> > > > Jian
>
> > > > On Thu, Jun 10, 2010 at 3:56 PM, Jian Fang <[email protected]
> > >wrote:
>
> > > >> I am not sure if this is related to our changes in 0.7.0. We have
> > changed
> > > >> the setup and teardown methods to use
> > > >> @BeforeTest and @AfterTest annotations for TelluriumTestNGTestCase so
> > that
> > > >> the embedded selenium server
> > > >> will only be started once for multiple tests. Maybe the TestNG ant
> > task
> > > >> does not handle that correctly?
>
> > > >> If you change your file to use TelluriumJUnitTestCase, do you have the
> > > >> same problem?
>
> > > >> The thread you mentioned was resolved because the ip in the
> > configuration
> > > >> file was not correct.
>
> > > >> Thanks,
>
> > > >> Jian
>
> > > >> On Thu, Jun 10, 2010 at 2:06 PM, super fan 911 <[email protected]
> > >wrote:
>
> > > >>> First, I am not an Ant expert. I am trying to create an ant task to
> > > >>> run my tests. Below is my ant task,
>
> > > >>> <target name="run-test-testng" depends="compile-test">
> > > >>> <echo message="Running testng test..." />
> > > >>> <testng classpathref="run.classpath" groups="${testng.groups}"
> > > >>> outputDir="${dir.build.report}" haltOnFailure="true" verbose="2"
> > > >>> suiteName="${testng.suite.name}" testName="${testng.test.name}">
> > > >>> <classfileset dir="${dir.build.test}" includes="**/
> > > >>> SampleTest.class" />
> > > >>> <classfileset dir="${dir.build.test}" includes="**/
> > > >>> Sample2Test.class" />
> > > >>> </testng>
> > > >>> </target>
>
> > > >>> Here are my sample tests,
>
> > > >>> public class SampleTest extends TelluriumTestNGTestCase {
>
> > > >>> �...@test(enabled=true, groups=["regression"])
> > > >>> public void testXYZ() {
> > > >>> openUrl("http://www.yahoo.com");
> > > >>> sleep 3000
> > > >>> System.out.println("hello world");
> > > >>> }
> > > >>> }
>
> > > >>> public class Sample2Test extends TelluriumTestNGTestCase {
>
> > > >>> �...@test(enabled=true, groups=["regression"])
> > > >>> public void testXYZ() {
> > > >>> openUrl("http://www.google.com");
> > > >>> sleep 3000
> > > >>> System.out.println("hello world 2");
> > > >>> }
> > > >>> }
>
> > > >>> I have set "runInternally = true" in Tellurium config file.
>
> > > >>> Here is my stack trace,
>
> > > >>> run-test-testng:
> > > >>> [echo] Running testng test...
> > > >>> [testng] [Parser] Running:
> > > >>> [testng] Regression Testing
>
> ...
>
> 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.