schedule execution by testNG in Eclipse - selenium

I want my selenium(java) test scripts to be scheduled for execution every night 11.00PM.
How can I do this in Eclipse .I am using TestNG to run my scripts.

I suggest you use a simple tool called jenkins to achieve what you are trying to do. It is an excellent solution to running scheduled tasks such as running selenium test scripts.

Related

To schedule for automation which is best Maven or Jenkins?

I have list of Selenium Webdriver testcase written in Junit Test cases which runs, on demand. currently i am running that and manually sending the report for Pass/Fail count on weekend.
I need that it should run on each weekend and send out the report to me for pass/fail count. There are two tools i come across. Jenkins and maven. I am new to both.. which is best for requirement?
Thanks,
Chandra
Jenkins is the correct option here
Maven is a build tool, where we know the build procedure and its dependencies
It can be used in your project to create the class file or jar files required
Jenkins is a Continuous Integration tool, which can be used to schedule and run tasks where you can execute your test cases , report the test result via email.. you can view it as server which executes your tests and provide you the results

how to use selenium grid with Specflow and Nunit and Webdriver (in DotNet version)

Presently we built a Automation framework which uses Selenium Webdriver+ specflow + Nunit, and we suing bamboo as our CI to run our Job against our every build.
we written a build.xml to handle our targets (like clean, init, install latest build, run Selenium scripts, uninstall build. etc)
ant command will read the tag name from the build.xml and runs the respective feature/scenarios based on Tags (like #smoke, #Regression)with Nunit in CI machine.
Now our requirement is to use Selenium Grid to divide scripts into different machine and execute with above set-up. Grid has to divide the scripts based on feature file or based on Tags.How to achieve this.
Is there any thing need to done under [BeforeFeature] and [BeforeScenario] ?
If you provide in details steps or any link which explains detail steps that would be a great help.
Please any one can help in this regards.
Thanks,
Ashok
You have misunderstood the role Grid plays in distributed parallel testing. It does not "divide the scripts", but simply provides a single hub resource through which multiple tests can open concurrent sessions.
It is the role of the test runner (in your case Specflow) to divide tests and start multiple threads.
I believe that you require SpecFlow+ (http://www.specflow.org/plus/), but this does have a license cost.
It should be possible to create your own multithread test runner for Specflow but will require programming and technical knowledge.
If you want a free open source approach to parallel test execution in DotNet, then there is MbUnit (http://code.google.com/p/mb-unit) but this would require you to rewrite your tests

how to integrate hudson and selenium-rc

I am using Selenium RC(Java) with TestNg. I run the script using TestNG. Now i want to integrate selenium with Hudson. So that whenever Hudson deploy the build into test server Dev team wants to perform Regression Testing using Hudson.
Simplest way is to use ant task to start/stop selenium before/after executing your test. Another way is starting server from code if required. You can use ISFW where server started by framework if required.

Bamboo recognising JBehave tests

I have setup Bamboo to run JBehave tests on a remote agent (with JBehave-web plugin launching test using webdriver), and everything runs fine. Only problem is after the execution is finished Bamboo shows no test executed. I can see the option in Bamboo to select the output of the test results, but it has to be a JUnit xml, and Jbehave reports are only generated in plain text or html.
Any idea how to solve this?
Thanks
I ran in the same situation about a year ago. JBehave "doesn't" integrate with Bamboo out of the box. Although, they have a plugin for Hudson CI.
In my case, such as yours, I resorted in running the tests through the Surefire plugin; the outputs are considered as JUnit tests results and Bamboo can recognize them.
Hope it helps.
There is a really simple way to do this. And I'm currently doing this for our build system.
Write a simple parse script that transforms your plain of html report into JUnit compatible results. And add that script as a task in your Bamboo task, then use Junit parser to parse the results. Boo! You're done! Plus, you've got the capability to quarantine!
This is way much faster than writing a plugin for Bamboo, which involves considerable more time to learn/write.
Setup JBehave with Maven.In Bamboo build plan use Maven task to run it. For getting results in Bamboo use JBehave Task for Bamboo. It will convert JBehave scenarios in tests in Bamboo. If scenario names contains JIRA issue ids, it will link them to JIRA issues.
https://marketplace.atlassian.com/plugins/com.mdb.plugins.jebehaveforbamboo/server/overview
Sample JBehave as Maven Project
https://bitbucket.org/vikasborse/jbehavesampleproject/overview
Download or clone this repository on your local machine.
To run navigate to this project in command line and use command:
"mvn integration-test"

Run Selenium Test Automatically Every 5 minutes

Is there a way to automate a selenium test to run every five minutes?
If you've got your tests packed as an executable the easiest way may be to run a CRON job or a Windows scheduled task.
That said, Hudson (or another continuous integration system) are almost certainly better long term strategies.
+1 to Hudson, but you might also want to check out my startup, BrowserMob. We provided free and commercial services that let you run Selenium scripts from multiple locations around the world and be alerted if there are problems.
You could do that with Hudson CI (see this article), or do the same manually (in a cron or Windows scheduler), by using the Selenium RC from command-line:
java -jar /usr/local/bin/selenium-server.jar -htmlSuite "*firefox" http://example.com/ my_test_suite.html build/logs/seleniumhq.html
+1 Hudson, it has a very good support for Selenium Tests, there are some commercial tools as well like Cruise Control, Anthill Pro.
Otherwise you can use the Cron jobs or windows schedular.
If you are using RC, write an Ant script and then schedule it as mentioned in the other posts.