开发者

Testing GUI with JUnit

Well, we all know test-driven development. I'd need to write a GUI-based library, but to be honest, I always neglected the testing. Did JUnit for university and such, but we never got any deeper than the usual "Implement a list and test it."

So, since I don't want to write a thousand applications for the features, I'd like to know, what's the "professional" approach to GUI-based library testing with Scala and JUn开发者_运维知识库it?

Thanks for listening.


Separate your Presentation layer from everything else.

Keep the Presentation layer as thin as possible so that testing can in theory take place within a middle-man of a given pattern; MVC, MVVM, etc...

The moment you begin to couple the Presentation layer with underlying logic your testing will become a nightmare to maintain as well as execute.

At the end of thoroughly testing your Models/ViewModels/Controllers, etc...testing the Presentation layer can often times lose its highly regarded value. Is it still valuable? Yes...but the return has diminished considerably.

These concepts apply to many frameworks/languages. Once you grasp this understanding the technological benefits of a given framework/language will surface naturally. Do not rely on the framework/language to answer this though. A framework/language can definitely lend itself to provide separation of concerns in a much more friendly manner however the separation of concerns is and has always been at the forefront of any type of testing; GUI included.


Read the book Test Driven a practical TDD and acceptance TDD for java developpers.

It covers the basics on how to unit-test Swing Applications and also some TDD techniques.

I haven't finished the book so i don't know if it covers Scala but i highly recommend this book (already)!

Some personal note : if you want action skip chapter one but return back to it. It covers the "How to start using TDD in general"

Test Driven book link

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜