Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: Eclipse question Date: Fri, 27 Oct 2017 15:10:34 -0400 Organization: A noiseless patient Spider Lines: 32 Message-ID: References: <051ea305-3fc8-4087-bd2a-bd4c7bd131c5@googlegroups.com> <14pdv8gcyixc2$.nrjypzl7wkp7.dlg@40tude.net> <2120adec-27d9-4a73-ba65-501806e891f5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 27 Oct 2017 19:10:37 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="83e859bff07c617f7789e089bbafd170"; logging-data="26763"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++OgSqZAoboO19EW86D0Li" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 In-Reply-To: <2120adec-27d9-4a73-ba65-501806e891f5@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:zQxhzypZsTXak7H8Jc1/kIgD5zg= Xref: csiph.com comp.lang.java.programmer:37596 On 10/27/2017 2:23 PM, Eric Douglas wrote: > On Friday, October 27, 2017 at 2:08:26 PM UTC-4, Arne Vajhøj wrote: >> It is a huge task to write really complete tests. >> >> But my take on that is that non-complete tests are better than no >> tests. >> > > Input-output is easy enough when my input is 2 and 6, my method is mutiply() and my result is 12. > How do you write a complete test when my input is end user, my method is "drag mouse from GUI control A to control B", and my result is "does the end model show what the user expects". "I don't know." Others have mentioned testing frameworks for GUI's, but I'm unfamiliar with them and can't help you. However, you can at least write unit tests for the model: It doesn't (or shouldn't) matter whether theModel.setWobbleRate(3.2) is called from an ActionListener or from somewhere else -- like a unit test, for example. The unit test can then turn around and check that the result of theModel.getWiggleSpan() is consistent with the new wobble rate, or can check that the bad wobble rate provokes an exception, or can check that changing the wobble rate sends suitable events to the listeners the test itself registers. One benefit of separating the view and the model is that most of the "business logic" resides in the latter, where it's easier to test. If the GUI consists mostly of sending data to the model and getting notifications back from it, the GUI can be simpler and (perhaps) less in need of this sort of testing. -- esosman@comcast-dot-net.invalid Eleven hundred eighty-one days to go.