Running tests without using IDEs like eclipse

1,150 views
Skip to first unread message

Sudeep

unread,
Sep 14, 2011, 1:58:19 AM9/14/11
to Selenium Users
Is it possible to run our tests from command prompt with testNG as the
reporting tool? I'm trying to integrate my test with Hudson for
scheduling. If it is possible, how to invoke the jar files, how to run
the test and where the result files will be created? Also is possible
to do the same thing using GRID?

Jayakumar C

unread,
Sep 14, 2011, 2:20:03 AM9/14/11
to seleniu...@googlegroups.com
You need a ant file which invokes your TestNG tests and for continuous integration you can let Hudson/Jenkins to execute that ant file .

http://wiki.openqa.org/display/SRC/Selenium-RC+and+Continuous+Integration
http://www.ibm.com/developerworks/java/library/j-cq04037/
http://testng.org/doc/ant.html

You can find few more useful links in googling.



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.




--
Jayakumar

santhosh soma

unread,
Sep 14, 2011, 2:37:51 AM9/14/11
to seleniu...@googlegroups.com
Hi Sandeep,

Hudson know only ant so that we need to define our script in terms of ANT.

Thanks
Santhosh.

Krishnan Mahadevan

unread,
Sep 14, 2011, 3:24:52 AM9/14/11
to seleniu...@googlegroups.com
Santhosh,
I am not sure if that is completely true.

We have our framework built on Maven and we have also setup integration jobs on Hudson.
Hudson can work with maven plug-in to drive your builds and also run your unit tests.

Sudeep,
Here are some steps that you can follow in order to kick off executions from the command line. (In my case I am using Maven)

Add up the selenium required maven dependencies [ http://seleniumhq.org/download/maven.html]
Add up testng as a dependency : http://testng.org/doc/maven.html

Once all of this is done, from the command prompt run "mvn test" and you should see your unit tests executed.

The same thing can be used on the hudson/jenkins as well, wherein you would be creating a job which essentially does the same.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

robbie....@nokia.com

unread,
Sep 14, 2011, 4:07:22 AM9/14/11
to seleniu...@googlegroups.com

Jenkins/Hudson definitely supports Maven and therefore you can use the surefire plugin to run your testng tests

Sudeep

unread,
Sep 14, 2011, 5:46:02 AM9/14/11
to Selenium Users
Thanks a lot everyone. I'll try with the Maven approach.

On Sep 14, 1:07 pm, <robbie.ware...@nokia.com> wrote:
> Jenkins/Hudson definitely supports Maven and therefore you can use the surefire plugin to run your testng tests
>
> From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of ext Krishnan Mahadevan
> Sent: 14 September 2011 08:25
> To: seleniu...@googlegroups.com
> Subject: Re: [selenium-users] Running tests without using IDEs like eclipse
>
> Santhosh,
> I am not sure if that is completely true.
>
> We have our framework built on Maven and we have also setup integration jobs on Hudson.
> Hudson can work with maven plug-in to drive your builds and also run your unit tests.
>
> Sudeep,
> Here are some steps that you can follow in order to kick off executions from the command line. (In my case I am using Maven)
>
> Create a maven project Read more @http://weblogs.java.net/blog/johnsmart/archive/2008/08/creating_maven...
> Add up the selenium required maven dependencies [http://seleniumhq.org/download/maven.html]
> Add up testng as a dependency :http://testng.org/doc/maven.html
> Adding surefire-plugin for your testshttp://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html
> Defining your unit tests [http://www.sonatype.com/books/mvnex-book/reference/customizing-sect-w...]
>
> Once all of this is done, from the command prompt run "mvn test" and you should see your unit tests executed.
>
> The same thing can be used on the hudson/jenkins as well, wherein you would be creating a job which essentially does the same.
>
> Thanks & Regards
> Krishnan Mahadevan
>
> "All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
>
> On Wed, Sep 14, 2011 at 12:07 PM, santhosh soma <santhoshvams...@gmail.com<mailto:santhoshvams...@gmail.com>> wrote:
> Hi Sandeep,
>
> Hudson know only ant so that we need to define our script in terms of ANT.
>
> Thanks
> Santhosh.
>
> On Wed, Sep 14, 2011 at 11:50 AM, Jayakumar C <jayakumaree...@gmail.com<mailto:jayakumaree...@gmail.com>> wrote:
> You need a ant file which invokes your TestNG tests and for continuous integration you can let Hudson/Jenkins to execute that ant file .
>
> http://wiki.openqa.org/display/SRC/Selenium-RC+and+Continuous+Integra...http://www.ibm.com/developerworks/java/library/j-cq04037/http://testng.org/doc/ant.html
>
> You can find few more useful links in googling.
>
> On 14 September 2011 11:28, Sudeep <sudeep.lik...@gmail.com<mailto:sudeep.lik...@gmail.com>> wrote:
> Is it possible to run our tests from command prompt with testNG as the
> reporting tool? I'm trying to integrate my test with Hudson for
> scheduling. If it is possible, how to invoke the jar files, how to run
> the test and where the result files will be created? Also is possible
> to do the same thing using GRID?
>
> --
> You received this message because you are subscribed to the Google Groups "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com<mailto:seleniu...@googlegroups.com>.
> To unsubscribe from this group, send email to selenium-user...@googlegroups.com<mailto:selenium-users%2Bunsubsc ri...@googlegroups.com>.
> For more options, visit this group athttp://groups.google.com/group/selenium-users?hl=en.
>
> --
> Jayakumar
>
> --
> You received this message because you are subscribed to the Google Groups "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com<mailto:seleniu...@googlegroups.com>.
> To unsubscribe from this group, send email to selenium-user...@googlegroups.com<mailto:selenium-users%2Bunsubsc ri...@googlegroups.com>.
> For more options, visit this group athttp://groups.google.com/group/selenium-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com<mailto:seleniu...@googlegroups.com>.
> To unsubscribe from this group, send email to selenium-user...@googlegroups.com<mailto:selenium-users%2Bunsubsc ri...@googlegroups.com>.
> For more options, visit this group athttp://groups.google.com/group/selenium-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com<mailto:seleniu...@googlegroups.com>.
> To unsubscribe from this group, send email to selenium-user...@googlegroups.com<mailto:selenium-users+unsubscri b...@googlegroups.com>.

Mike

unread,
Sep 14, 2011, 12:12:47 PM9/14/11
to Selenium Users
I found some sample code that let's me build the XML file up in my
code. I have the tests being kicked off by the Windows Task
Scheduler, although cron would work fine if I was in a *nix
environment.

Take a look at this web page section:
http://testng.org/doc/documentation-main.html#running-testng-programmatically

I also noticed that the IDE plugin to add WebDriverBackedSelenium
support for TestNG has a different way using some JUnit-style calls.
Here is something where I created a suite using the IDE to run two
tests:
import junit.framework.Test;
import junit.framework.TestSuite;

public class CurrentTestSuite_Edited
{
public static Test suite()
{
TestSuite suite = new TestSuite();
suite.addTestSuite(DOTN_CUR_VT_001_Edited.class);
suite.addTestSuite(DOTN_CUR_VT_002_Edited.class);
return suite;
}

public static void main(String[] args)
{
junit.textui.TestRunner.run(suite());
}
}

The nice thing for me is that I don't need to depend on ant or maven,
which to me just adds another layer of complexity that has to be
configured.

Mike
Reply all
Reply to author
Forward
0 new messages