p0wl
p0wl

Reputation: 481

How to create functional / UI-Tests for an existing web application

I've got the interesting task to build complex workflow tests for an existing web application which has never had unit or integration tests (all testing by developers / users without structure or guidelines).

Setup

The target is an ASP.NET (no MVC) web application, that has been build over several years. There is no clean MVC or any other pattern, so the HTML output is very bad (generated IDs, not much css classes, in line css styles --> hard to test). The application is data-centric, so there is a lot to test and the status of the database is very important for the tests.

I'm thinking of the following workflow: 1. Reset Database to test start data 2. Run Tests which create and test data by simulation user interactions

Tools

I was playing around with Selenium IDE, but it does not feel structured enough. I'm dreaming of a toolset, where I can write tests in (literate) coffeescript / javascript, that can be executed in the browser (no need for headless testing), but all tools I can find aim to test javascript functions and not user interactions.

My test steps need to be:

  1. page loads
  2. test if page has loaded correctly by searching for text A or counting elements in ul B
  3. click on button C, wait for popup D, type text in field E
  4. click save button and check if text from field E is shown in element F

Is jasmine able to test these kind of user interactions? I can only find jasmine tests for javascript functions or the existance of HTML elements, but not for complex workflows with test steps that rely on each other.

Thanks in advance!

Upvotes: 3

Views: 390

Answers (3)

TN.
TN.

Reputation: 611

You may want to look at RIATest for cross-platform cross-browser testing of web applications. It uses ECMAScript based script language which is very similar to JavaScript.

It works on Windows and Mac, supported browsers are Firefox, IE and Chrome. Automated testing scripts written on one platform/browser can be run against all other supported platforms/browsers.

It is certainly possible to automate the steps that you described. Dynamically generated IDs are not good but you should be able to use other properties (such as text, element type, etc.) to identify the HTML objects that you want to automate and test for.

(Disclaimer: I am a RIATest team member).

Upvotes: 0

Alessandro Da Rugna
Alessandro Da Rugna

Reputation: 4695

I suggest IBM Rational Functional Tester. It's java based, making it very extensible. It's not Javascript, so be warned that test are written in java code. For most of it there's a recorder: you simply click around and it records your actions.

Regarding automated tests with it, here's my opinions .

It is a commercial product. I'm not affiliated with IBM but I work with RFT a lot.

Upvotes: 0

Arran
Arran

Reputation: 25056

Selenium IDE is not the way to go for this.

Selenium is built on the WebDriver JSON Wire Protocol. Having this 'base' means it has been very easily plugged into many many different languages, all using the same kind of API.

One of them being JavaScript:

https://code.google.com/p/selenium/wiki/WebDriverJs

Disclaimer: the JS Bindings are very new!

I'm not sure I understand why you must do it in JavaScript, especially as I can see this severely limits your options.

Upvotes: 3

Related Questions