Testing the Impossible: Asserting Several Values At Once
23. March, 2009 at 16:58 | In Software | 2 CommentsTags: TDD, Testing
So you want to check several values at once, maybe because that helps you to locate the error more easily. Simple:
int v1 = list1.size();
int v2 = list2.size();
int v3 = list3.size();
assertEquals (
"list1=5\n"
+ "list2=2\n"
+ "list3=0\n"
, "list1="+v1+"\n"
+ "list2="+v2+"\n"
+ "list3="+v3+"\n"
2 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.

[...] In the asserts, just collect all the results into a big String and compare them all at once. [...]
Pingback by Testing The Impossible: Inserting Into Database « Dark Views — 5. June, 2009 #
[...] Testing the Impossible: Shifting IDs 7. October, 2009 at 09:38 | In Software | Leave a Comment Tags: Database, Hibernate, ID, Java, Spring, Testing So you couldn’t resist and wrote tests against the database. With Hibernate, no less. And maybe some Spring. And to make things more simple, toString() contains the IDs of the objects in the database. Now, you want to check the results of queries and other operations using my advice how to verify several values at once. [...]
Pingback by Testing the Impossible: Shifting IDs « Dark Views — 7. October, 2009 #