Java – How to make automatic tests for GUI

guijavatestingui

How can I check automatically what is seen and what not? Or at least, how can I organize some partly automatic tests?

IDE: Eclipse (could use also IntelliJ Idea if necessary)

Testing tool: Junit (again, could use something else if advised, but better if it is free)

Application OS: Android

Developer's OS: Linux (could change for MAC or Windows(reluctantly))

Language: Java

All the work goes in the external device. No emulator.

The application is a user wrapper for the firmware TV player, called as external activity. So, 70% of the code is for GUI. (The other 30% speak to servers and provides info to the GUI)

Before I programmed the testing function myself, not using any tools. Now I have a tool at hand. But I can't imagine how could I test the UI, with the tool or without it. (Strictly said, with the Internet connections I have problems too, but I'll leave them probably for the other question.) The answer needn't be too platform-dependent, the principles and ideas will help, too.

Of course, it is good to check, is some element in another and checked or not. Some regression checks would be nice for that. But I should also be sure that the element mentioned is not cut by some other elements and winks as I ordered by animation.

The advices here:
https://softwareengineering.stackexchange.com/questions/63245/is-there-a-tool-to-test-java-ui
won't help – there are only tools, not principles, and none of the tools could help in my situation.

Best Answer

Most often the best advice for automatic GUI testing is to develop your application in a Model-View-Presenter style and write your tests against the Presenter. The topic is discussed here:

http://danbunea.blogspot.com/2005/11/model-view-presenter-is-testing_27.html

(there are further links at the end of that article).

Of course, that might not help you to "check automatically what is seen and what not", but it may help you to test the most of the UI logic.

Related Topic