<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Testing on Caktus Group</title><link>https://www.caktusgroup.com/tags/testing/</link><description>Recent content in Testing on Caktus Group</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 05 Apr 2021 12:54:21 +0000</lastBuildDate><atom:link href="https://www.caktusgroup.com/tags/testing/index.xml" rel="self" type="application/rss+xml"/><item><title>How Mock Can Improve Your Unit Tests: Part 2</title><link>https://www.caktusgroup.com/blog/2021/04/05/mock-improve-unit-tests/</link><pubDate>Mon, 05 Apr 2021 12:54:21 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2021/04/05/mock-improve-unit-tests/</guid><description>&lt;p>In &lt;a href="https://www.caktusgroup.com/blog/2021/03/29/mock-unit-tests-part-1/">Part
1&lt;/a>
of this blog series, we started looking at how we can use mocking to
improve our unit tests. We'll expand on that in this post.&lt;/p></description></item><item><title>How Mock Can Improve Your Unit Tests: Part 1</title><link>https://www.caktusgroup.com/blog/2021/03/29/mock-unit-tests-part-1/</link><pubDate>Mon, 29 Mar 2021 12:54:20 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2021/03/29/mock-unit-tests-part-1/</guid><description>&lt;p>We've written in the past about the importance of unit tests and how to
write better ones: &lt;a href="https://www.caktusgroup.com/blog/2018/01/08/culture-unit-testing/">Culture of Unit
Testing&lt;/a>,
&lt;a href="https://www.caktusgroup.com/blog/2017/05/29/subtests-are-best/">Subtests are the
Best&lt;/a>.&lt;/p></description></item><item><title>Accessibility Testing Tips for Beginners</title><link>https://www.caktusgroup.com/blog/2020/07/23/accessibility-testing-tips/</link><pubDate>Thu, 23 Jul 2020 14:37:24 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2020/07/23/accessibility-testing-tips/</guid><description>&lt;p>&lt;em>Above: Caktus uses several mobile devices for accessibility testing. For a more realistic experience, it&amp;rsquo;s important to test on devices, and not just with simulators.&lt;/em>&lt;/p></description></item><item><title>Suggestions For Picking Up Old Projects</title><link>https://www.caktusgroup.com/blog/2019/02/15/old-projects/</link><pubDate>Fri, 15 Feb 2019 18:36:49 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2019/02/15/old-projects/</guid><description>&lt;p>At Caktus, we work on many projects, some of which are built by us from
start to finish, while others are inherited from other sources.
Oftentimes, we pick up a project that we either have not worked on in a
long time, or haven&amp;rsquo;t worked on at all, so we have to get familiar with
the code and figure out the design decisions that were made by those who
developed it (including when the developers are younger versions of
ourselves). Moreover, it is a good idea to improve the setup process in
each project, so others can have an easier time getting set up in the
future. In our efforts to work on such projects, a few things have been
helpful both for becoming familiar with the projects more quickly, and
for making the same projects easier to pick up in the future.&lt;/p></description></item><item><title>7 Conferences We’re Looking Forward To</title><link>https://www.caktusgroup.com/blog/2019/01/26/7-conferences/</link><pubDate>Sat, 26 Jan 2019 18:01:22 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2019/01/26/7-conferences/</guid><description>&lt;p>&lt;em>Above: The Internet Summit in Raleigh is one of the local conferences we recommend attending. (Photo by Ian Huckabee.)&lt;/em>&lt;/p>
&lt;p>At Caktus, we strongly believe in professional development and continued learning. We encourage our talented team to stay up to date with industry trends and technologies. During 2018, Cakti attended a number of conferences around the country. Below is a list (in alphabetical order) of the ones we found the most helpful, practical, and interesting. We look forward to attending these conferences again, and if you get the chance, we highly recommend that you check them out as well.&lt;/p></description></item><item><title>My New Year’s Resolution: Work Less to Code Better</title><link>https://www.caktusgroup.com/blog/2018/12/27/new-years-resolution-work-less-code-better/</link><pubDate>Thu, 27 Dec 2018 12:00:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2018/12/27/new-years-resolution-work-less-code-better/</guid><description>&lt;p>You may look at my job title (or picture) and think, “Oh, this is easy, he’s going to resolve to stand up at his desk more.” Well, you’re not wrong, that is one of my resolutions, but I have an even more important
one. I, Jeremy Gibson, resolve to do less work in 2019. You’re probably thinking that it’s bold to admit this on my employer’s blog. Again, you’re not wrong, but I think I can convince them that the less work I
do, the more clear and functional my code will become. My resolution has three components.&lt;/p></description></item><item><title>3 Common Form Testing Issues (Plus 1 Helpful Tool)</title><link>https://www.caktusgroup.com/blog/2018/05/28/3-common-form-testing-issues-plus-1-helpful-tool/</link><pubDate>Mon, 28 May 2018 13:30:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2018/05/28/3-common-form-testing-issues-plus-1-helpful-tool/</guid><description>&lt;p>Forms are something that I find myself testing frequently, whether it&amp;rsquo;s an e-commerce checkout page or a new &lt;a href="https://docs.djangoproject.com/en/2.0/topics/db/models/" target="_blank" rel="noopener noreferrer">model&lt;/a> in the Django admin. The challenge of forms is that users will often enter things that may not have been accounted for when the form was created.&lt;/p></description></item><item><title>Culture of Unit Testing</title><link>https://www.caktusgroup.com/blog/2018/01/08/culture-unit-testing/</link><pubDate>Mon, 08 Jan 2018 14:30:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2018/01/08/culture-unit-testing/</guid><description>&lt;p>Unit testing is something that deeply divides programmer communities. Nearly everyone agrees that it’s good to have unit tests in place, but some developers question whether the time invested in writing unit tests would be better spent writing “real” code, doing manual QA, or debugging.&lt;/p></description></item><item><title>Subtests are the Best</title><link>https://www.caktusgroup.com/blog/2017/05/29/subtests-are-best/</link><pubDate>Mon, 29 May 2017 13:30:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2017/05/29/subtests-are-best/</guid><description>&lt;h2 id="subtests-are-the-best">Subtests are the best&lt;/h2>
&lt;p>Testing our code is important. Because developers write bugs, it&amp;rsquo;s
valuable to catch and correct them before the code gets to production so
our apps work as they should. Specifically, we want tests that are DRY
(Don&amp;rsquo;t Repeat Yourself), thorough, and readable. Though there are many
ways to try to accomplish these goals, subtests make each of them
easier. If you&amp;rsquo;re not using subtests in your test classes, you probably
should be.&lt;/p></description></item><item><title>Plan for mistakes as a developer</title><link>https://www.caktusgroup.com/blog/2017/01/30/plan-for-mistakes-as-a-developer/</link><pubDate>Mon, 30 Jan 2017 18:44:30 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2017/01/30/plan-for-mistakes-as-a-developer/</guid><description>&lt;p>&lt;em>I Am Not Perfect.&lt;/em>&lt;/p>
&lt;p>I've been programming professionally for 25 years, and the most
important thing I have learned is this:&lt;/p></description></item><item><title>Ship It Day Q1 2017</title><link>https://www.caktusgroup.com/blog/2017/01/18/ship-it-day-q1-2017/</link><pubDate>Wed, 18 Jan 2017 16:39:28 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2017/01/18/ship-it-day-q1-2017/</guid><description>&lt;p>Last Friday, Caktus set aside client projects for our regular quarterly
ShipIt Day. From gerrymandered districts to RPython and meetup planning,
the team started off 2017 with another great ShipIt.&lt;/p></description></item><item><title>Better Testing With Less Code (PyCon 2016 Must-See Talk: 2/6)</title><link>https://www.caktusgroup.com/blog/2016/07/13/better-testing-less-code-pycon-2016-must-see-talk-26/</link><pubDate>Wed, 13 Jul 2016 13:37:37 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2016/07/13/better-testing-less-code-pycon-2016-must-see-talk-26/</guid><description>&lt;p>&lt;em>Part two of six in our annual &lt;a href="https://www.caktusgroup.com/blog/tags/PyCon%20Must%20See%20Series/">PyCon Must-See Series&lt;/a>, a weekly highlight of talks our staff especially loved at PyCon. With so many fantastic talks, it’s hard to know where to start, so here’s our short list.&lt;/em>&lt;/p></description></item><item><title>Writing Unit Tests for Django Migrations</title><link>https://www.caktusgroup.com/blog/2016/02/02/writing-unit-tests-django-migrations/</link><pubDate>Tue, 02 Feb 2016 13:00:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2016/02/02/writing-unit-tests-django-migrations/</guid><description>&lt;p>&lt;em>Editor's note: This post was originally published in February 2016 and
was updated in August 2017 to incorporate improvements suggested by our
readers. It has also been tested for compatibility as of the Django 1.11
release.&lt;/em>&lt;/p></description></item><item><title>Testing Client-Side Applications with Django Post Mortem</title><link>https://www.caktusgroup.com/blog/2015/06/08/testing-client-side-applications-django-post-mortem/</link><pubDate>Mon, 08 Jun 2015 12:22:35 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2015/06/08/testing-client-side-applications-django-post-mortem/</guid><description>&lt;p>I had the opportunity to give a &lt;a href="http://www.oreilly.com/pub/e/3302" target="_blank" rel="noopener noreferrer">webcast for O’Reilly Media&lt;/a> during which I encountered a presenter’s nightmare: a broken demo. Worse than that it was a test failure in a presentation about testing. Is there any way to salvage such an epic failure?&lt;/p></description></item><item><title>Webinar: Testing Client-Side Applications with Django</title><link>https://www.caktusgroup.com/blog/2015/01/20/webinar-testing-client-side-applications-django/</link><pubDate>Tue, 20 Jan 2015 16:40:09 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2015/01/20/webinar-testing-client-side-applications-django/</guid><description>&lt;p>Technical Director &lt;a href="http://www.caktusgroup.com/about/mark-lavin/" target="_blank" rel="noopener noreferrer">Mark Lavin&lt;/a> will be hosting a free &lt;a href="http://www.oreilly.com/pub/e/3302" target="_blank" rel="noopener noreferrer">O’Reilly webinar&lt;/a> today at 4PM EST or 1PM PT on Testing Client-Side Applications with Django. Mark says testing is one of the most popular question topics he receives. It’s also a topic near and dear to Caktus’ quality-loving heart. Mark’s last webinar garnered more than 500 viewers, so sign up quick!&lt;/p></description></item><item><title>Tips for Upgrading Django</title><link>https://www.caktusgroup.com/blog/2014/07/07/tips-upgrading-django/</link><pubDate>Mon, 07 Jul 2014 10:00:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2014/07/07/tips-upgrading-django/</guid><description>&lt;p>From time to time we inherit code bases running outdated versions of
Django and part of our work is to get them running a stable and secure
version. In the past year we've done upgrades from versions as old as
1.0 and we've learned a few lessons along the way.&lt;/p></description></item><item><title>Caktus Completes RapidSMS Community Coordinator Development for UNICEF</title><link>https://www.caktusgroup.com/blog/2014/02/05/caktus-completes-rapidsms-community-coordinator-development-unicef/</link><pubDate>Wed, 05 Feb 2014 14:12:35 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2014/02/05/caktus-completes-rapidsms-community-coordinator-development-unicef/</guid><description>&lt;p>Colin Copeland, Managing Member at Caktus, has wrapped up work,
supported by UNICEF, as the Community Coordinator for the open source
&lt;a href="http://rapidsms.org" target="_blank" rel="noopener noreferrer">RapidSMS&lt;/a> project. RapidSMS is a text messaging
application development library built on top of the Django web
framework. It creates a SMS provider agnostic way of sending and
receiving text messages. RapidSMS has been used widely in the mobile
health field, in particular in areas where internet access cannot be
taken for granted and cell phones are the best communication tool
available. This has included projects initiated by UNICEF country
offices in Ethiopia, Madagascar, Malawi, Rwanda, Uganda, Zambia, and
Zimbabwe.&lt;/p></description></item><item><title>Skipping Test DB Creation</title><link>https://www.caktusgroup.com/blog/2013/10/02/skipping-test-db-creation/</link><pubDate>Wed, 02 Oct 2013 12:48:59 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2013/10/02/skipping-test-db-creation/</guid><description>&lt;p>We are always looking for ways to make our tests run faster. That means
writing tests which don't preform I/O (DB reads/writes, disk
reads/writes) when possible. Django has a &lt;a href="https://docs.djangoproject.com/en/stable/topics/testing/overview/#provided-test-case-classes" target="_blank" rel="noopener noreferrer">collection of TestCase
subclasses&lt;/a>
for different use cases. The common &lt;code>TestCase&lt;/code> handles the fixture
loading and the creation the of &lt;code>TestClient&lt;/code>. It uses the database
transactions to ensure that the database state is reset for every test.
That is it wraps each test in a transaction and rolls it back once the
test is over. Any transaction management inside the test becomes a
no-op. Since [TestCase]{.title-ref}[ overrides the transaction
facilities, if you need to test the transactional behavior of a piece of
code you can instead use
]{.title-ref}[TransactionTestCase]{.title-ref}[.
]{.title-ref}[TransactionTestCase]{.title-ref}` resets the database
after the test runs by truncating all tables which is much slower than
rolling back the transaction particularly if you have a large number of
tables.&lt;/p></description></item><item><title>Factory Boy as an Alternative to Django Testing Fixtures</title><link>https://www.caktusgroup.com/blog/2013/07/17/factory-boy-alternative-django-testing-fixtures/</link><pubDate>Wed, 17 Jul 2013 14:30:00 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2013/07/17/factory-boy-alternative-django-testing-fixtures/</guid><description>&lt;p>When testing a Django application you often need to populate the test
database with some sample data. The standard Django &lt;code>TestCase&lt;/code> has
support for fixture loading but there are a number of problems with
using fixtures:&lt;/p></description></item><item><title>MEDIA_ROOT and Django Tests</title><link>https://www.caktusgroup.com/blog/2013/06/26/media-root-and-django-tests/</link><pubDate>Wed, 26 Jun 2013 14:54:30 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2013/06/26/media-root-and-django-tests/</guid><description>&lt;p>If you&amp;rsquo;ve ever written a test for a view or model with associated
uploaded files you might have noticed a small problem with those files
hanging around after the tests are complete. Since version 1.3, Django
won&amp;rsquo;t delete the files associated with your model instances when they
are deleted. &lt;a href="http://stackoverflow.com/questions/5372934/how-do-i-get-django-admin-to-delete-files-when-i-remove-an-object-from-the-datab" target="_blank" rel="noopener noreferrer">Some work-arounds for this
issue&lt;/a>
involve writing a custom delete for your model or using a post_delete
signal handler. But even with those in place the files would not be
deleted during tests because the model instances are not explicitly
deleted at the end of the test case. Instead, Django simply rolls back
the transaction and the delete method is never called nor are the
signals fired. This can be quite an annoyance when running the tests
repeatedly and watching your &lt;code>MEDIA_ROOT&lt;/code> (or worse your S3 bucket) fill
up with garbage data. More than annoyance, this introduces something you
always want to avoid in unittests: global state.&lt;/p></description></item><item><title>Simplifying the Testing of Unmanaged Database Models in Django (Updated for Django 4.2 in 2024)</title><link>https://www.caktusgroup.com/blog/2010/09/24/simplifying-the-testing-of-unmanaged-database-models-in-django/</link><pubDate>Fri, 24 Sep 2010 15:01:09 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2010/09/24/simplifying-the-testing-of-unmanaged-database-models-in-django/</guid><description>&lt;p>&lt;em>Editor's note: This post was originally published in September, 2010
and was updated in December, 2024 to incorporate changes in Django and
improvements suggested by our readers. It has also been tested for
compatibility as of the Django 4.2 release.&lt;/em>&lt;/p></description></item><item><title>Continuous Integration with Django and Hudson CI (Day 1)</title><link>https://www.caktusgroup.com/blog/2010/03/08/django-and-hudson-ci-day-1/</link><pubDate>Mon, 08 Mar 2010 15:58:48 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2010/03/08/django-and-hudson-ci-day-1/</guid><description>&lt;p>We're always looking for new tools to make our development environment
more robust here at Caktus. We write a lot of
&lt;a href="https://www.caktusgroup.com/blog/2009/05/26/testing-django-views-for-concurrency-issues/">tests&lt;/a>
to ensure proper functionality as new features land and bug fixes are
added to our projects. The next step is to integrate with a &lt;a href="http://en.wikipedia.org/wiki/Continuous_integration" target="_blank" rel="noopener noreferrer">continuous
integration&lt;/a> system
to automate the process and regularly check that status of the build.&lt;/p></description></item><item><title>Testing Django Views for Concurrency Issues (Updated for Django 4.2 in 2024)</title><link>https://www.caktusgroup.com/blog/2009/05/26/testing-django-views-for-concurrency-issues/</link><pubDate>Tue, 26 May 2009 19:59:25 +0000</pubDate><guid>https://www.caktusgroup.com/blog/2009/05/26/testing-django-views-for-concurrency-issues/</guid><description>&lt;p>&lt;em>Editor's note: This post was originally published in May, 2009 and was
updated in December, 2024 to incorporate changes in Django and
improvements suggested by our readers. It has also been tested for
compatibility as of the Django 4.2 release.&lt;/em>&lt;/p></description></item></channel></rss>