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, no registration required.

I was wondering whether the community utilizes automation tests to the extent of UI? Is there some common best practices for testing UI? Also - the product I'm working on is flex-based. I would love to get ideas how to test it. Mainly I want to test:

  1. Data appears on the screen as expected
  2. Field validations (for example: field is not a number) are working as expected
  3. Alignment of fields

And so on

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted
+50

I've seen a number of things tried for UI testing. Flex specifically has (had?) an automation framework which you can use. I believe that programs like FlexMonkey utilize this.

There's also the old stand-by of screen scraping. Tools like Skuli will let you do that.

But in general, the best practice that I've seen repeated over and over through the industry is this: GUI testing is hard, so don't focus on it. Create hooks (APIs, if you will) to get at the data underneath the GUI, and automate that testing. Then let the GUI be a very thin layer with minimal logic (view-logic only, if you must) which can be fairly easily tested manually.

In his book The Clean Coder, Bob Martin suggests that GUI testing should be manual and only account for ~10% of the system.

In my work experience, my department spent a long time trying to do automated GUI testing and never really got anywhere with it. It takes a ton of effort and seems to yield minimal results. Eventually we just gave up on it. Therefore, I cannot recommend it.

Most of the things you want to be able to test can be testable by exposing a good API.

share|improve this answer
1  
"Then let the GUI be a very thin layer with minimal logic (view-logic only, if you must) which can be fairly easily tested manually." I come from a UI background and believe all code should be written like this. Never do anything that could have been done before it got to the place where you're at. That's where all the branching and confusion happens that makes people want to spend all this time putting tests in front of everything in the first place. –  Erik Reppen Jun 14 '13 at 23:05
    
@ErikReppen You come from a good background, then! :) –  Allan Jun 20 '13 at 18:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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