Click here to code!

How to Test Your Django App with Selenium and pytest

Posted by Bob on Thu 22 November 2018 in Testing • Tagged with django, pytest, selenium, platform, fixtures, dateutil • 8 min read

In this article I will show you how to test a Django app with pytest and Selenium. We will test our CodeChalleng.es platform comparing the logged out homepage vs the logged in dashboard. We will navigate the DOM matching elements and more. Overall you should learn enough Selenium and pytest to start testing a web page including a login. Sounds exciting? Let's dive straight in!


Continue reading

Why Python is Great for Test Automation

Posted by Andrew Knight on Wed 25 July 2018 in Testing • Tagged with guest, test, testing, automation, tdd, selenium, pytest, IDE • 5 min read

Testing in Python is consistently growing in popularity. In this article our friend Andrew Knight from Automation Panda walks through 10 reasons why Python is great for Test Automation.


Continue reading

Enough pytest to be Dangerous, 10 Things I Learned Writing Tests for 100 Python (Bites of Py) Exercises

Posted by Bob on Thu 07 June 2018 in Testing • Tagged with pytest, learning, mock, parametrize, capfd, fixtures • 8 min read

We hit 100 Bite exercises on our Code Platform and that means we have written tests for 100 exercises. In this article I share 10 things I learned about writing test code and pytest.


Continue reading

All You Need to Know to Start Using Fixtures in Your pytest Code

Posted by Bob on Thu 15 March 2018 in Testing • Tagged with pytest, fixtures, testing, refactoring, pytest-cov, coverage • 11 min read

Setting up test cases for code that manage data can be challenging but it's an important skill to reliably test your code. You might have heard of the setup and teardown methods in unittest. In pytest you use fixtures and as you will discover in this article they are actually not that hard to set up. Fixtures have been labelled pytest's killer feature so let's explore them in this article using a practical example.


Continue reading

Parsing Twitter Geo Data and Mocking API Calls by Example

Posted by Bob on Sat 17 June 2017 in Testing • Tagged with twitter, API, mock, geo, data, unittest, pickle, tweepy, testing, 100days • 2 min read

"Is this Bob or Julian?!" ... yeah tweeting from our shared @pybites Twitter account can be confusing! So I made a little script to parse the location of our tweets. Then I extended it to make it testable. I wrote a decorator to cache a couple of API outputs to be used with the unittest.mock patch decorator I learned about. A simple script turned into a good learning exercise.


Continue reading