Unit Test MVVM

asked 2016-08-29 19:34:07 +0800

FlorianSchaetz gravatar image FlorianSchaetz flag of Germany
31 6


MVVM ViewModels are Pojos, so they are easy to test... At least, that's half the truth. In reality, ViewModels also contain a lot of annotations (@Command, @GlobalCommand, @NotifyChanges). Of course I can test the pojo, but much of the logic is in the annotations, so while 100% of the pojo may be executed, not nearly 100% of the ViewModel will be tested.

Obviously it would be great to test the ViewModel from the Outside, for example by allowing me to do this..

MyViewModel vm = new MyViewModel();
BindTestUtil.save(vm, "firstName", "Franklin");
BindTestUtil.verifyNotifyChanged(vm, "someProperty");

Is there any way to do this? Preferably without having to simulate ZK's code, since that will only lead to guessing what it might do. ZATS is also overkill for a test like this.... Better ideas, anyone?

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-09-01 03:01:07 +0800

q5618306 gravatar image q5618306
1 1

I just learned the ZK framework and new to the software industry for a month , feeling the ZK framework for beginners it is hard to understand , what is the good way to learn?

link publish delete flag offensive edit

answered 2016-09-01 07:22:31 +0800

Darksu gravatar image Darksu
1991 1 4

Hello q5618306,

First of all welcome to the group.

There are a lot of resources in order to learn zk including:

  • An extensive documentation

  • Demos of all the components


The zk sandbox where you can test your code:


  • The forums are a very useful resource where we can answer your questions, and help you out

Finally it is a good practice when you have a new question, to create a new forum post :)

Best Regards,


link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2016-08-29 19:34:07 +0800

Seen: 15 times

Last updated: Sep 01 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More