Houshang.Karami
Houshang.Karami

Reputation: 179

What we need to test in Observer design pattern unit testing?

I am new to software testing. I wonder what is the right way to make a unit testing for observer pattern? e.g. if we have the following 4 classes implemented:

How to write test tracks for each of these classes? Is there any good example to take a reference?

Upvotes: 3

Views: 2315

Answers (1)

Bob Horn
Bob Horn

Reputation: 34297

This is a tough question to answer because it's pretty abstract. Typically you don't write tests for certain patterns, you write unit tests for methods. Or you write tests based on use cases. The bottom line is that when you provide input, what is the expected output? It doesn't matter what pattern is used; input goes in, result comes out. Was the result valid? That's your test.

Upvotes: 3

Related Questions