Selenium Testing Processes......???
How do I:
- Schedule basic daily check scripts to run every morning and email any issues to relevant business stakeholders e.g. Check that searches work on ThisIsLondon.co.uk
- Integrate more detailed tests with our Maven build process so they are automatically run when code is checked in
- Formulate a strategy for data specific tests. At the moment, if we write a test that assumes a specific article is on a page, and somebody changes it, the test will fail. How can we best do this? It is possible for Selenium when running in server mode to use a temporary in-memory database. Or maybe we should have a dedicated static database that doesn't change?
Answers (4)
In general there sin't a simple answer on your questions.
I'll try to provide my thoughts about the way you can go to solve your tasks.
- to be able run tests at specific time and get automatically run when the code is checked in, you need to have build management and continuous integration system. Take a look at TeamCity management and continuous integration solution. It is for free for open source projects.
- a few words about the pages with dynamic content (which result a test failure). Here you need to aplly some kind of parametrization, it could be tool specific one (like Selenium RC) or you can use property files. Of course you have to avoid any static links, names e.t.c. in your code. Also you can try to investigate the page structure, i suppose it is the same all time, and there are several areas wich hold dynamic content. Might be you can solve the problem by implementing a wrapper for new articles.
Links:
I could tell you the solution I have used
- To schedule the simplest solution (the one I use) is to run your selenium script form a .bat and schedule the bat
The .bat should open your browser with the selenium URL, i.e.:
firefox.exe http://localhost/selenium?auto=true&test=../tests/TestSuite.html&close=true
To send a mail the option I have used is to build a servlet that receives the result that is send by selenium and send the mail. My servlet was published at http://localhost:8080/MySeleniumForwarder/receiver (obviously java, but any language or webapp should do it)
In order to force selenium to forward the result to that URL you should use the parameter resultsUrl
i.e. in the bat:
firefox.exe http://localhost/selenium?auto=true&test=../tests/TestSuite.html&close=true&resultsUrl="http://localhost:8080/MySeleniumForwarder/receiver"
All that works fine, and i have done that to test my webapps but now exists another way, that i have not used yet is the HTA mode, maybe you could start with that and tell me about :)
i.e.:
C:\selenium\core>TestRunner.hta "test=../tests/TestSuite.html&auto=true&close=true&resultsUrl=results.html&save=true"
- in the same way you could integrate it to a build project, the way you do it depends on the build process you use. If you are building .NET you could use to build MSbuils and integrating a .bat is easy, the same with JAVA and ANT
- The best practice for selenium test is the parameterization of all the static content you need. (i.e. the command store)
Links:
Hi,
Long time ago I wrote SeleniumRP, you can find it on: http://www.javascience.org/
In download section you will find ZIP archive with example ant script running tests included with Selenium Core.
It is an ANT task running tests and listening for results. It stores results in XML which in my project was displayed on Build Monitor.
It works till now - but I haven't tried it myself for a long long time.
Other thing which might be helpful is Selenium Remote Control.
Best regards
Konrad
Links:
Paul D
Lead Software Development Engineer at RealNetworks
Best Answers in: Blogging (1), Software Development (1), Web Development (1)
You are using Maven so, I'd recommend leveraging it.
Use Maven to drive your selenium tests.
Set up Continuum or Cruise Control to use Maven to run tests automatically when code is checked it. You can also set up your morning task in either.
For data specific tests, you can use Fitnesse with Selenium.
Here is the set-up I have on my current project.
Maven2 is used for the build system. There are separate modules for jWebUnit and Selenium tests. The tests are able to isolate the system and inject mock data for repeatability.
Continuous integration is handled by using Continuum to monitor the SCM and run the Maven tasks when changes are made.
Continuum also runs Maven tasks to generate reports to a site that is automatically published.
The jWebUnit test module is run at every build (it runs faster than Selenium). The Selenium tests are run twice daily.
Our Selenium tests use SeleniumRC so the tests can run on a varied collection of browser/OS combos.
let me know if you need help