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:
- Data appears on the screen as expected
- Field validations (for example: field is not a number) are working as expected
- Alignment of fields
And so on
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.
2