Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

We have a large inventory system where we work and making changes has the possibility to break things in other areas. This happens a lot, and it is hard to manually test for everything every time because something even as simple as a Javascript action applied to a text field can stop working.

Most of the manual tests would consist of entering data in certain fields and submitting that and ensuring no errors are given. How would I use Selenium to automate this kind of regression testing?

We have used Unit testing programs such as PHPUnit for other applications which were more standard, however these kinds of tests need to test a whole system, not just isolated parts, so PHPUnit is not as ideal.

share|improve this question

closed as off-topic by Ixrec, Snowman, GlenH7, MichaelT, durron597 Apr 20 at 14:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Ixrec, Snowman, GlenH7, MichaelT, durron597
If this question can be reworded to fit the rules in the help center, please edit the question.

    
retitled and updated content. –  Michael Durrant Apr 20 at 17:07

1 Answer 1

up vote 2 down vote accepted

Yes selenium can be used to automate the manual interaction steps.

It's intended to be used against web browsers and it's widely used and implemented.

However this is only half of the puzzle. Selenium is the core technology in browser automation tools, APIs and frameworks. To actually USE selenium you are going to need to pick an actual implementation.

You can start of with the IDE plug-in for Firefox. This is nearly always referred to as a quick and dirty, temporary solution. It does not need to be. If you use it to record existing interactions and try and play them back, or do selections based on text, then yes, the test suites you create will be brittle. If you use good practices such as css ID's and HTML data-attributes you can create robust and complex automation this way.
It also has the benefit of actually letting you, or even your product team, see the automation for themselves. It has the downside of only running in the browser IDE that it is implemented which I believe is still just Firefox so starting it is still a manual step.

The other, more extensive and maintainable options is to use Selenium from within test framework such as Ruby On Rails with Rspec and Capybara which enable you to write scripts which can be run headless and against different browsers. This approach has the downside of not showing you the actual screens which might have visual layout issues.

Programming Languages & Frameworks

Languages are supported through drivers with commands from the Selenium API as methods/functions.

Testing frameworks that can be used with Selenium:

C# - Frameworks: NUnit Haskell
Java - Frameworks: JUnit, TestNG
JavaScript
Objective-C
Perl
PHP - Frameworks: Behat + Mink, Yii
Python - Frameworks: unittest, pyunit, py.test, robot framework
R
Ruby - Frameworks: RSpec, Test::Unit

See also:
How can you write tests for Selenium (or similar) which don't fail because of minor or cosmetic changes?

and

Selenium and non technical team members

and in convincing the business to support:

What problem does automated user interface testing solve?

share|improve this answer
    
Thanks for the helpful answer. We are using the Yii framework which does have functionality testing built in which helps with using Selenium. –  Fogest Apr 17 at 22:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.