I would like to learn more about how to use Selenium IDE and RC for creating good automation tests. Is there anybody who is interested in sharing info. or discussing this? Especially for things like:
1) What's a good way to organize the UI tests? Right now I am executing these tests thru NUnit and that executes the tests in the order of their alphabetical names. Is there a better way. (I am writing the selenium scripts in C# and not java)
2) How are the results logged?
3) Modularizing the Selenium RC tests? I am having a problem here. Since I am executing my tests thru NUnit, the only way I could figure was to give IDs to the tests so that they get run in the right order. Also I am having to write all my tests one after the other in the textfixture class. Again is there a better way? I tried creating additional files but when I create tests there and select them to run in NUnit, it looks like the selenium server doesn't even get started.
4) What are the best practices for automation testing? Any pointers to any sites/books/ etc.?
These might seem very simple things but I've spent weeks trying to come up with better ways, so if somebody is willing to offer suggestions or input I'll really appreciate it!
Thanks!
In order to use Selenium WebDriver with C#, you need to install Visual Studio. NUnit is the Unit Testing framework supported by Visual Studio and Selenium webdriver. We need to install NUnit Framework and NUnit Test Adapter onto Visual Studio inorder to use it.
NUnit was Initially ported from JUnit. Tests can be run from a console runner, within Visual Studio through a Test Adapter or through 3rd party runners. Tests can be run in parallel and has Strong support for data driven tests. Unit supports multiple platforms including .
The [TestFixture] attribute denotes a class that contains unit tests. The [Test] attribute indicates a method is a test method. Save this file and execute the dotnet test command to build the tests and the class library and run the tests. The NUnit test runner contains the program entry point to run your tests.
NUnit is a unit-test framework designed for all the . NET languages. It is written in C# and built to use many of the . NET language features.
I have answered each of the questions for you below.
Tests shouldn't matter about the order that they run in. If you start worrying about that you are going to start introducing flakiness of tests. If you have to login with each test do so, if you need to register a number of users during your tests do so. Tests should always be able to run on their own.
Nunit logs its results in a XML file. This will have a list of the passes and fails and is normally rendered in a pretty fashion by nearly all Continuous
See my answer for Best Practices for modularizing Selenium RC test scripts
If your desires is to use Selenium then I can suggest instead use the TestPlan front-end instead of another language. In additional to a domain specific language it offers nice test case management. You can organize your tests into a nice hierarchy and it will execute all of them and report the results.
It takes care of a lot of details of launching Selenium and smooths over many difficulties in the RC API.
I've just went through this. In terms of modularizing and useful tools. I think it's really important to think more about building an agile, well maintained automated ui testing framework than simply modularizing selenium RC scripts. Selenium 2: Testing Tools Begginner's Guide was a great start for idea how to start building a good testing framework. I had MUCH success with the (Page Object pattern)[https://code.google.com/p/selenium/wiki/PageObjects] after failing 2-3 times getting an automated testing framework going. In terms of proccess, I found it best to start by writing code (you are writing tests, so it should be pretty easy to test), but aggressively refactoring using good OOP as patterns and structures begin to build up. I'd also reccommend How Google Tests Software for motivation of Software QA in general, good testing practices on an organizational level, and when and when not to use automation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With