GUI Testing with JUnit

Well, we all know that development is based on tests. I need to write a graphics library, but to be honest, I always neglected testing. Was there JUnit for the university, etc., but we never got deeper than the usual "Implement the list and test it."

So, since I don’t want to write thousands of applications for these functions, I would like to know what is a “professional” approach to testing a library based on a graphical interface using Scala and JUnit?

Thank you for listening.

+4
source share
2 answers

Separate your Presentation layer from everything else.

Keep the Presentation layer as thin as possible so that theoretical testing can take place within the average person of a given template; MVC, MVVM, etc.

The moment you start associating the Presentation layer with the underlying logic, your testing will be a nightmare to maintain as well as fulfill.

At the end of thorough testing of your models / ViewModels / Controllers, etc. testing presentation levels can often be of the utmost importance. Is it still valuable? Yes ... but the return has decreased significantly.

These concepts apply to many structures / languages. Once you understand this understanding, the technological advantages of this framework / language will look natural. Do not rely on the framework / language to answer this. The framework / language can definitely provide a separation of problems in a much more friendly manner, however separation of problems has always been at the forefront of any type of testing; A graphical interface is included.

+6
source

Read the Test Driven Practical TDD and TDD Acceptance Book for java developers.

It talks about how to test Swing Applications, as well as some TDD methods.

I have not finished the book, so I do not know if it covers Scala, but I highly recommend this book (already)!

Some personal note: if you want the action to skip chapter 1, but bring it back. It covers "How to Start Using TDD in General"

link to the test version

+2
source

All Articles