... David Saff ... [snip] ... Cedric, I've been telling you this for a year or so... Tests get instantiated at the start (one instance per test), they are run,...
... Correction: you don't have to maintain state across methods. Because each test is in its instance, there is no possibility of having the state modified. ...
hello group, When i was unit testing my SAX parser implementation to parse my xml file, i faced one problem. i want to test the startElement(...) method of the...
... I understand, although with proper naming conventions and "packaging", it's not that hard to keep track of who's who... I also like to mention all the...
... I imagine that there could be a language that replaced parameter passing by an alternative mechanism, without being unpleasant. Of course to someone used...
... It the code isn't tested through the public (or protected) then you aren't testing it in the context in which it will actually be used. Private methods are...
Elliotte Harold
elharo@...
Sep 1, 2005 10:32 am
14562
... It is certainly possible to test private methods, but I prefer not to do it. I prefer to make the method public, test it, then figure out why it was...
... JBR's postulate 1. For every testable design that requires exposing elements "just for testing", there exists an equivalent testable design that does not...
hi lets assume class is SimpleMathTest.class and resides at c:java\bin try at console following command c:\java\bin\java -cp c:java\bin; SimpleMathTest why is...
Hi. I have implemented an algorithm in Java which produces state cover, shortest paths to get another statefrom start state, from a finite state machine(FSM)....
... Nice. After thinking about it for awhile, here are some things I think could be done (in order) before making private methods public for testing when you...
Actually, if you were really following TDD then you wouldn't have the private method unless it was already covered by tests. At least that's the methodology I...
The formula works like this (it doesn't really matter what your code actually does). Your library/algorithm takes some input and produces some output. Your...
... I don't see this as a solution. If the method wasn't public before, it shouldn't be public now just because it moved to a different class. If the only...
Elliotte Harold
elharo@...
Sep 1, 2005 5:24 pm
14571
... If using TDD you are slowly emerging the design. Why would Extract Class not be a valid refactoring? At some point a private method on a class wants to be...
... I believe Elliote wants to minimize the public API to make it easier to use. Martin Fowler has a nice article on using interfaces to achieve the same...
... David, This is the way I practice TDD as well -- test first. I've been learning that not everyone is as disciplined as we are. Code coverage tools /can/ be...
... Elliotte, I agree that privates should be kept private, encapsulation should not be broken for the purpose of testing, and that the number of messages in...
... If extracting a class causes a method to become public that otherwise wouldn't be public, then it's a problem. Public APIs are rigid and inflexible. Public...
Elliotte Harold
elharo@...
Sep 1, 2005 6:50 pm
14576
... That's basically correct in general. The problem is that Java doesn't have a real distinction between public and published. If it's public, then it's...
Elliotte Harold
elharo@...
Sep 1, 2005 6:54 pm
14577
Certainly. My point (which came out wrong) was that if the class was written test-first then I wouldn't feel like I needed to use a coverage tool to be sure...
Hi. David. Yeah, Could you give me some more details where I can get the examples and how to test them? Or any web materials. Thanks a lot. Regards,...
Hi Jin, I am not David, but I want to make a comment. David provided a general recipe for testing algorithms. Since you are designer of the algorithm, at the...
... Sure, but you're still simulating passing parameters to methods by passing them to your constructors. Not the most intuitive way. Out of curiousity: any...
Apologies if this is OT, but IMHO coverage measurement (for guiding one's test writing) and IDEs (for writing and running one's tests) are both at least...
http://junit.sourceforge.net/doc/testinfected/testing.htm <http://junit.sourceforge.net/doc/testinfected/testing.htm> is the traditional page for getting...
... Global data makes testing more difficult, so I'd avoid it if possible. Do you have control over instantiating your SAX event handler? (It's been over 5...