Run Selenium Test Automatically Every 5 minutes - selenium

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.

Related

Can I create a test server for testing team with Selenium?

I made a Selenium code by Java to test a certain web-application that our company developed.
Now, developers fix the application quite often and every time they update or fix, testers should test this new version of webapp to assert all functions working fine before application release.
Let's suppose that there are 100 testers who do not know how to run Selenium code or install Java.
I decide to create a testing server so that testers can access this server and run test. They also can see all test histories and details so far as well.
Is it possible and realistic to develop a system that runs like server and client? If yes, Can Jenkins do that? Other solutions are welcome!
Thank you in advance and happy new year!
Jenkins is one of the tools, you able to use for this, since it provides a simple way to delegate some tasks to already configured envs, nodes share them for multiple users and hide technical complexity. Also this would be aligned to your CI process, e.g. first - deploy the new code to test env, next - run test automation.
But the same also might be said for some other CI tools, so I suggest to pick some CI tool which your development already uses.
The architecture could be:
1 CI task for run tests -->
2 CI Node or docker image with java, selenium,
maven(gradle), it may be some headless Linux -->
3 Selenium cluster which able to launch multiple
selenium sessions (to cover your testers needs). It could
be some selenium cloud service, or configured
onpremise env. -->
4 Selenium grid hub (may be headless)-->
5 Selenium grid nodes... The final nodes env
should match your test requirements. It could
be Docker with linux (headless or not) or
Windows/MacOs.
Pick some tools and look for quick start guides/tutorials.
Start from simple implementation and improve it continuously.
I may say that for many cases Docker + Ubuntu + Headless Chrome is fine, lightweight and rapid.
Some references (examples the tools I've used):
Jenkins + Selenium + Maven https://www.lambdatest.com/blog/selenium-maven-jenkins-integration/
Selenoid (selenium grid implementation based on docker containers) https://github.com/aerokube/selenoid
Report Portal (just reporting tool) - something more than the default testng report provides. https://reportportal.io/
This is very shortly. The same might be done with a lot of other tools.

Scheduling through Selenium IDE

I am using Selenium IDE 3.17.0 in chrome for recording scripts.
Is there any way to schedule the scripts through Selenium IDE like run the scripts/tests every 1 hr.
i can obviously export the scripts/tests to some programming languages and run a scheduler quartz to schedule it but was looking if there is anything native built in Selenium IDE.
Best Regards,
Saurav
Unfortunately, scheduling is no longer supported in the latest version. If you do want though, you can install an older version and enable scheduling. For that, you would need to download a legacy version, see here.
Here is another good walkthrough
Steps:
Selenium IDE > Options > Schedule tests to run periodically
My suggestion would be to not run it using IDE.
I'd suggest doing this:
Create a WebDriver (or RC if you wish) test using your preferred language.
If using linux, just use crontab to set up a 15 minute cronjob. If using windows, use task scheduler to run your test.

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

schedule execution by testNG in Eclipse

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.

how to use Selenium to create an automatic tool to check mail status?

how to use Selenium to create an automatic tool to check mail status? I mean this toolkit could period duly open browser and check in my online mailbox to check if there are unread mails, if there has then change the status as "read" would be okay.
I currently was searching the selenium framework and could use it achieve some basic function, but have no idea of how to make it auto run and by fixed time interval. Can someone please guide me? any suggestion would be appreciated!
thanks!
The selenium standalone jar is executable so you could write a script to run selenium tests that you've created inside the Selenium IDE. It'd be something like this:
java -jar selenium-server-standalone-2.8.0.jar -htmlSuite "<path to your .html test suite>"
Then, you could schedule this as a cron job to run periodically.
Here are two related questions that might help:
Run Selenium Test Automatically Every 5 minutes
How can I run a selenium test every 5 minutes?