News for hackers. Stuff that matters.
Re:Clojure at a Real Estate Portal by jonpither on Monday December 14, 2015 @07:49AM (#10730693)
That last part is complete rubbish.
Re:Clojure at a Real Estate Portal by hellofunk on Monday December 14, 2015 @07:58AM (#10730724)
Can you elaborate? Most of Clojure libraries I use have extensive, sometimes seemingly too many, tests that accompany them, as if they are covering literally every possible scenario the user could find themselves in.
Re:Clojure at a Real Estate Portal by Kiro on Monday December 14, 2015 @09:37AM (#10731183)
Did you respond to the wrong comment? He says it's rubbish that the Clojure community is NOT into testing.
Re:Clojure at a Real Estate Portal by hellofunk on Monday December 14, 2015 @01:28PM (#10732782)
I misunderstood sorry!
Re:Clojure at a Real Estate Portal by mateuszf on Monday December 14, 2015 @07:51AM (#10730698)
That's just what I've heard - sorry if it's incorrect.
Re:Clojure at a Real Estate Portal by calibraxis on Monday December 14, 2015 @08:10AM (#10730787)
Sadly, one must investigate original sources, otherwise we get soundbite-knowledge. Here's a blogpost written by a core Clojure contributor that starts: "Occasionally I hear someone say that the Clojure community is against testing." (http://tech.puredanger.com/2013/08/31/clojure-and-testing/)

Or take this discussion on testing: "Finally, testing is greatly facilitated by design. Ideal testing takes some design constraints, some specification and turns it into tests as opposed to sort of embodying design inside tests. That's inside out. But again, that's something we have to work more at. Stems like Quick Check are interesting because you're basically starting with propositions about your system, which reflect the design and saying you write the tests, computer." (https://github.com/matthiasn/talk-transcripts/blob/master/Hi...)

Re:Clojure at a Real Estate Portal by dkersten on Monday December 14, 2015 @08:51AM (#10730932)
The Clojure community is very big on testing, but not all of it is automated (eg testing on the REPL). Automated testing is popular too though, to the point where Clojure has a number of testing libraries (clojure.test, test.check, test.generative, expectations, speclj, midje).
Re:Clojure at a Real Estate Portal by GFK_of_xmaspast on Monday December 14, 2015 @09:09AM (#10731011)
If the testing isn't automated, I'm not sure it should really count.
Re:Clojure at a Real Estate Portal by dkersten on Monday December 14, 2015 @02:47PM (#10733286)
Sure it does. It depends on the purpose of your tests and the cost/benefit.

Do you really think that just because you have automated tests, that your software is defect free? Tests (outside of generative/property-based testing, which is still under-utilised) aren't very good at finding bugs outside of regressions. Having said that, most Clojure code worth talking about does have automated tests.

In my ideal world, I would use expected-case Unit Tests to test the contract/requirements/interface. Regression tests to prevent fixed bugs from reappearing and generative tests to try and find bugs. I would write the expected-case tests before the code, use REPL testing while developing and finally write property tests after (once my code has evolved so that I understand the properties) and regression tests only as I fix bugs after the fact.