<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>t+1 - Latest Comments in I need to write faster tests</title><link>http://tplus1.disqus.com/</link><description></description><atom:link href="https://tplus1.disqus.com/i_need_to_write_faster_tests_89/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 18 Jul 2008 20:27:28 -0000</lastBuildDate><item><title>Re: I need to write faster tests</title><link>http://blog.tplus1.com/blog/2008/07/18/i-need-to-write-faster-tests/#comment-938256</link><description>&lt;p&gt;The other thing that unit tests won't catch is when one unit alters its interface but the second unit doesn't find out about it.&lt;/p&gt;&lt;p&gt;Incidentally, I don't agree with the idea that interfaces shouldn't change.  If I come up with a better way of doing something, I'm going to do it.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Fri, 18 Jul 2008 20:27:28 -0000</pubDate></item><item><title>Re: I need to write faster tests</title><link>http://blog.tplus1.com/blog/2008/07/18/i-need-to-write-faster-tests/#comment-938248</link><description>&lt;p&gt;Yeah, I think maybe there's nothing wrong with these narrative-based tests, but I would like to separate them from my other split-second tests.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Fri, 18 Jul 2008 20:25:22 -0000</pubDate></item><item><title>Re: I need to write faster tests</title><link>http://blog.tplus1.com/blog/2008/07/18/i-need-to-write-faster-tests/#comment-936076</link><description>&lt;p&gt;I like to think of tests in terms of cost/benefit.&lt;/p&gt;&lt;p&gt;Longer (integration) tests cost more because they eat time, but in theory have greater benefit, because they reflect actual use more closely. ( &lt;a href="http://googletesting.blogspot.com/2008/03/cost-benefit-analysis-of-test.html)" rel="nofollow noopener" target="_blank" title="http://googletesting.blogspot.com/2008/03/cost-benefit-analysis-of-test.html)"&gt;http://googletesting.blogsp...&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Teeny unit tests are cheap, but don't verify as much as the longer integration tests.&lt;/p&gt;&lt;p&gt;So running cheap tests all the time is ok, just like paying for electricity in your house all the time is ok. It doesn't cost much.&lt;/p&gt;&lt;p&gt;Expensive tests can run less often but give better payoff, just like only buying a car every couple of years.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Aaron Oliver</dc:creator><pubDate>Fri, 18 Jul 2008 15:51:55 -0000</pubDate></item><item><title>Re: I need to write faster tests</title><link>http://blog.tplus1.com/blog/2008/07/18/i-need-to-write-faster-tests/#comment-935687</link><description>&lt;p&gt;+1 to separating unit and integration tests.&lt;/p&gt;&lt;p&gt;Integration tests *should* use a real database (etc) - but will take long er and longer as your tests cover more things (although there are obviously techniques you can use to minimize this).&lt;/p&gt;&lt;p&gt;Unit tests should mock out every they can in terms of contact with the 'outside world' - as a result they can run much faster.&lt;/p&gt;&lt;p&gt;You can run your functional tests in a loop on your integration machine (using a fresh checkout each time and emailing you failures - use something like CC.NET or just knock up an integration script tied to a post commit hook yourself).&lt;/p&gt;&lt;p&gt;You can run your unit tests whenever you make a change (preferably before to see the test fail and then afterwards to see it pass of course).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Michael Foord</dc:creator><pubDate>Fri, 18 Jul 2008 15:11:21 -0000</pubDate></item><item><title>Re: I need to write faster tests</title><link>http://blog.tplus1.com/blog/2008/07/18/i-need-to-write-faster-tests/#comment-935622</link><description>&lt;p&gt;In the main application that I work on, we have both unit (py.test) and functional (Selenium) tests.&lt;/p&gt;&lt;p&gt;The unit tests are quite fast and do all of the low-level library testing and stuff.  I run them often.&lt;/p&gt;&lt;p&gt;The Selenium tests take longer, but they really work the system over.&lt;/p&gt;&lt;p&gt;I think that is something that you can't avoid, really.  If you want to test your application like users are going to use it, it is bound to be slower, even with a computer at the wheel.  &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Christian Wyglendowski</dc:creator><pubDate>Fri, 18 Jul 2008 15:06:16 -0000</pubDate></item><item><title>Re: I need to write faster tests</title><link>http://blog.tplus1.com/blog/2008/07/18/i-need-to-write-faster-tests/#comment-935094</link><description>&lt;p&gt;Hi Kumar, thanks for the comment! I saw your fixture project earlier today on planetpython. Right now, my setup code doesn't go through the app to setup. It makes a database connection directly and monkeys around.&lt;/p&gt;&lt;p&gt;All my tests use the same setup and teardown, so each test starts at the same state. That still might not let me run tests in parallel, however, since they're all working on the same user objects. If I could run all these in parallel, that would likely cut time way down. Maybe I could change my setup code so that each test gets objects created with names just for them.&lt;/p&gt;&lt;p&gt;I'll be the first one to admit that I have a lot more to learn in terms of testing. Right now, I feel a lot of frustration waiting for these things to finish execution.&lt;/p&gt;&lt;p&gt;I'll check out fixture over the weekend. Thanks for the tips. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Fri, 18 Jul 2008 14:26:13 -0000</pubDate></item><item><title>Re: I need to write faster tests</title><link>http://blog.tplus1.com/blog/2008/07/18/i-need-to-write-faster-tests/#comment-935091</link><description>&lt;p&gt;...&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Fri, 18 Jul 2008 14:25:47 -0000</pubDate></item><item><title>Re: I need to write faster tests</title><link>http://blog.tplus1.com/blog/2008/07/18/i-need-to-write-faster-tests/#comment-934933</link><description>&lt;p&gt;I've found that two things you mentioned here tend to be problematic for functional testing.&lt;/p&gt;&lt;p&gt;First is using an actual interface to setup the data you need to test with.  Although this hides the implementation of how your data gets stored, which is nice, it is often slower than necessary.  You just need data in the db, right?  I actually created a module called fixture to load up just the data for such a test: &lt;a href="http://farmdev.com/projects/fixture/" rel="nofollow noopener" target="_blank" title="http://farmdev.com/projects/fixture/"&gt;http://farmdev.com/projects...&lt;/a&gt; :)&lt;/p&gt;&lt;p&gt;Second, it's not a good idea to insert data in one test that a later test depends on.  This is because your tests are no longer modular so you couldn't, for example, re-run only one test that is failing or use a grid solution (like &lt;a href="http://selenium-grid.openqa.org/" rel="nofollow noopener" target="_blank" title="http://selenium-grid.openqa.org/"&gt;http://selenium-grid.openqa...&lt;/a&gt; or like &lt;a href="http://code.google.com/p/python-nose/source/browse/branches/ticket-93/nose/plugins/multiprocess.py" rel="nofollow noopener" target="_blank" title="http://code.google.com/p/python-nose/source/browse/branches/ticket-93/nose/plugins/multiprocess.py"&gt;http://code.google.com/p/py...&lt;/a&gt; -- running tests in parallel with nose).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kumar McM illan</dc:creator><pubDate>Fri, 18 Jul 2008 14:12:42 -0000</pubDate></item></channel></rss>