What do you use to Unit-Test your Web UI? [closed]
Asked Answered
T

15

35

The company I'm currently working for is using Selenium for Uniting-Testing our User Interface. What do you use to Unit-Test your Web UI and how effective do you find it?

Tertia answered 11/8, 2008 at 0:5 Comment(1)
This is a great question. For a new developer wanting a pointer on web development google takes people to this entry on the first page.Harriet
M
10

We use Watin at my place of employment, we are a .net shop so this solution made a lot of sense. We actually started with Watir (the original ruby implementation) and switched after. It's been a pretty good solution for us so far

Miss answered 21/8, 2008 at 18:46 Comment(0)
T
17

I'm a huge fan of Selenium. Saying 'unit-testing your web ui' isn't exactly accurate as some of the comments have mentioned. However, I do find Selenium to be incredibly useful for performing those sort of acceptance and sanity tests on the UI.

A good way to get started is using Selenium IDE as part of your development. Ie, just have the IDE open as you're developing and write your test as you go to cut down on your dev time. (Instead of having to manually go through the UI to get to the point where you can test whatever you're working on, just hit a button and Selenium IDE will take care of that for you. It's a terrific time-saver!)

Most of my major use case scenarios have Selenium RC tests to back them up. You can't really think of them as unit-tests along the lines of an xUnit framework, but they are tests targetted to very specific functionality. They're quick to write (especially if you implement common methods for things like logging in or setting up your test cases), quick to run, and provide a very tight feedback loop. In those senses Selenium RC tests are very similar to unit-tests.

I think, like anything else, if you put the effort into properly learning a test tool (eg, Selenium), your effort will pay off in spades. You mention that your company already uses Selenium to do UI testing. This is great. Work with it. If you find Selenium hard to use, or confusing, stick with it. The learning curve really isn't all that steep once you learn the API a little bit.

If I'm working on a web app, its rare for me to write a significant amount of code without Selenium RC tests to back it up. That's how effective I find Selenium. :) (Hopefully that'll answer your question..)

Trophoblast answered 18/9, 2008 at 12:54 Comment(0)
M
10

We use Watin at my place of employment, we are a .net shop so this solution made a lot of sense. We actually started with Watir (the original ruby implementation) and switched after. It's been a pretty good solution for us so far

Miss answered 21/8, 2008 at 18:46 Comment(0)
P
6

Well, if you've designed your application properly, you won't have scads of logic inside the UI anyway. It makes much more sense to separate the actual work getting done into units separate from the UI, and then test those.

If you do that, then the only code in the UI will be code that invokes the backend, so simply testing the backend is sufficient.

I have used NUnit ASP in the past (at my job), and if you insist on unit testing your UI, I would strongly advise you to use ANYTHING but NUnit ASP. It's a pain to work with, and tests tend to be invalidated (needing to be revised) after even the most minor UI changes (even if the subjects of the tests don't actually change).

Polypropylene answered 11/8, 2008 at 2:52 Comment(1)
The problem one is trying to detect is an update to the css that moves or hides a UI element. Testing the business logic only doesn’t find those problems.Harriet
S
4

We are using QuickTestPro. So far it is effective, but the browser selection is limited. The nicest part is the ability to record your browser's activity, and convert it into a scriptable set of steps. There is also a nice .Net addin so if you have any validation code you need to do for the different stages of your test, you can write methods in an assembly and call them from your script.

Suffragette answered 11/8, 2008 at 1:12 Comment(0)
S
4

We have been using JSunit for a while to do unit tests... it may not be the same kinds of tests you are talking about, but it is great for ensuring your JavaScript works as you expect.

You run it in the browser, and it can be set in an Ant build to be automatically run against a bunch of browsers on a bunch of platforms remotely (so you can ensure your code is cross-browser as well as ensure the logic is correct).

I don't think it replaces Selenium, but it complements it well.

Schuler answered 11/8, 2008 at 3:43 Comment(0)
L
4

We use Visual Studio 2008 Tester Edition.

Pros: Very good at capturing user interaction

Captures Ajax calls

It is very easy to map user input to a database, XML or CSV file

The captured test can be converted to C# for more control

The same tests can be used for load testing and code coverage

Cons:

VS2008 Tester Edition is a seperate SKU from the normal Developer Edition, which means extra cost

You may be alergic to Microsoft ;-)

We have used it very effectively on projects, however there a lot of effort involved in keeping tests up to date, every time you change a screen the test may need to be re-recorded

We tend to keep the tests short and sharp, do one thing and get out instead of recording 10 minutes worth of clicking around in a single test.

We have a few standard UI test types:

Menu Test: Log in as a specific user (or user type/role) and make sure all the required menu items are available

Validation Test: Open a page and click save without entering any data, ensure that all the validation warnings appear. Complete required fields one at a time and check that the warning messages disappear when they are supposed to.

Search Test: Search using data from your database or a data file and ensure the correct data is returned by the search

Data Entry Test: Create new recrords from a data file, cleanup the database to allow tests to run multiple times

UI Testing is quite time consuming but the comfort feeling you get when a few hundred tests pass before you release a new version is priceless.

Lorielorien answered 19/9, 2008 at 12:15 Comment(0)
U
3

We use Selenium Core, but are switching gradually to Selenium RC which is much nicer and easier to manage. We have written lots of custom code to make the tests run on our Continuous Integration servers, some of them in parallel suites to run faster.

One thing you'll find is that Selenium seems to restart the browser for each test (you can set it not to do this, but we got memory problems when we did that). This can be slow in Firefox, but is not too bad in IE (one time I'm thankful for Bill Gates's OS integraion).

Upchurch answered 11/8, 2008 at 1:11 Comment(0)
V
3

I've used WATIR, which is pretty good. I liked it because it's Ruby and allows for testing interactivity, available elements and source code parsing. I haven't used it for a while but I assume it's gotten better.

It's supposedly being ported to Firefox and Safari, but that's been happening for a while now.

Vanover answered 23/8, 2008 at 19:55 Comment(0)
M
3

Check out Canoo Web Test. It is open source and built on the ANT framework.

I spent some time working with it for a graduate course on Software QA and it seems to be a pretty powerful testing tool.

Motherhood answered 29/8, 2008 at 21:54 Comment(0)
B
3

Selenium Grid can run your web tests across multiple machines in parallel, which can speed up the web testing process

Brosine answered 6/9, 2008 at 12:48 Comment(0)
S
3

I mostly use CubicTest, which is an eclipse plugin that lets you define tests graphically. It can export/run tests through several libraries, including watir and selenium. Most people just use the Selenium runner though.

Full disclosure: I'm one of the developers, so I'm kind of biased :)

Take a closer look here: cubictest.openqa.org

-Erlend

Springing answered 6/9, 2008 at 13:2 Comment(0)
U
3

Selenium is for Integration testing, not Unit testing. It's a subtle, but important difference. The usage I usually see is for sanity checking a build. i.e., have a test that logs in, a test that (for example) submits a story, makes a comment, etc.

The idea is that you're testing to see if the whole system is working together before deployment, rather than have a user discover that your site is broken.

Ultimatum answered 16/9, 2008 at 14:10 Comment(0)
A
1

We currently use Silk4J - a Java centric approach to testing Web UI. It can test Flash, Flex, AIR, Silver Light, Win32, HTML, and a few other applications.

Since Silk4J can control Win32 apps it can control browser dialogs directly, which is a step above what Selenium can control and is especially useful for download prompts.

Americana answered 30/5, 2012 at 4:32 Comment(0)
S
0

We use WatiN for system testing, and QUnit for JavaScript unit testing.

Sunup answered 11/1, 2009 at 23:28 Comment(0)
T
0

Molybdenum is built over Selenium and has some additional features.

Thornie answered 21/7, 2010 at 4:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.