Luiz Siqueira Neto wrote:

> That is a simple and good test, but some times the "state machine"
> work with containers, in this cases I need know if all entities and
> properties is properly represented. The "state machine" uses the
> "Entity Introspector" as reference to know what to do. This
> introspector is the real focus in this case;
> Right now I'm trying check all "info entities" and "info properties"
> supposed to be generated for a "entity introspector". A "info
> property" and a "info entity" is "meta-data" generated by the "Entity
> Introspector". For to do that I need create and populate all entities
> inside of some container and check the respective existence of some
> "info property" and "info entity" one-by-one; this is very tedious.
> For make this more affordable I'm thinking in use generics in test cases.

Two things:

1. If you a really testing the entity introspector, then I believe you should try to test it directly, instead of testing it with the state machine. What would that test look like?

2. Very often I try to generalize quickly, because I believe I understand a design concept. When I try to write the general case, I find it difficult, so I start by writing 3 specific cases, then observe the patterns, then extract the general case from them. I believe it takes less time for me to do that, compared to trying the general case and failing to do it correctly.

[Comments:这个哥们儿讲得实在是太好了!特别是第二点:经常我发现自己试图很快的作generalization,因为我认为我已经理解了这个概念。当我试图写出这个general的case的时候,我发现很难。于是我开始写三个specific的case,然后观察这些模式,抽取出general的case。]

Take care.

--

J. B. (Joe) Rainsberger :: ​http://www.jbrains.ca">​​http://www.jbrains.ca​​​

Your guide to software craftsmanship

JUnit Recipes: Practical Methods for Programmer Testing

2005 Gordon Pask Award for contribution Agile Software Practice