Day 13 – Testing

Testing, that dreaded T-word is on my list of things again. Being a developer who always had one foot in design world code testing dosesn’t come naturally to me. And the fact that they didn’t teach me how to test at university doesn’t help one bit.

First thing that comes to my mind when starting to write tests is what to actually test. There are people who’d say everything, they are actually opposite of my past self who would question if tests are really that necessary. Current me is closer to everything camp because when I choose to do something I have to go all in.

On SlothCMS project it’s really a good question because a lot of things are unstable and the whole project is in prototype stage. So even though I’d like to introduce integration tests, it’s not certain at this point if and how end points will change. So from this perspective it might be a waste of time to do integration and API testing.

The paragraph above shouldn’t be understood as integration and API testing is useless, so no one should bother. Testing how things work together is important and at the same time there’s a big exception. In the initial stages when there are moving parts everywhere it might not be the wisest to spend half day on tests on a side project without a lot of finished analysis.

At this point I feel there are couple of parts stable enough that aren’t part of endpoints that can be tested. It’s a part with plenty of changes ahead and stable basic functionality. So it makes sense to create unit tests that those methods work as expected now and will produce the same results for current testing material in the future.

So currently I am researching unit testing in Python. For me it’s a change from front-end because Python seems to be less opinionated than front-end frameworks which most of  the times come with a testing framework like Jasmine or Jest.

So far my resources include:

  • https://docs.python.org/3.7/library/unittest.html
  • https://www.patricksoftwareblog.com/unit-testing-a-flask-application/
  • https://www.damyanon.net/post/flask-series-testing/
  • https://realpython.com/python-testing/
  • https://blogthetech.com/testing-flask-applications-using-unittest-in-python/

I gathered those resources before writing this post and thinking what needs to be tested at this point, which explains a lot of flask related posts. Python also suffers a split in community which doesn’t appear as much on front-end1 or in Java sphere and that’s a dialect split, so half of the things work in v2 and other half works in v3.

So let’s dive into unit testing the stable parts tomorrow 😉

  1. There’s dichotomy among Front-end devs but that’s for a post or series of posts