Oooh, shiny! Just one more …

The lure of Jenkins was too much to resist …

So now I have a toy REST application, made by copying a tutorial and making a few modifications, and a few tests for it – a couple that are simple pytest, and a few more that are Tavern tests for the REST API. The tests are just barely more than the equivalent of “hello world”, but they and their app are in GitHub. I can execute them by running py.test from the command line, or by invoking py.test on the test directory from Pycharm. I can execute them by launching my AWS instance, pulling the whole package from GitHub, and running the application and tests there. Or – I can tell Jenkins to scan my repository, and it will pull the latest code, run the application, and then run my tests.

Enough infrastructure. Must practice writing tests with Python.

Borrowing MIT’s favorite cliche

Jerry Wiesner’s famous “Getting an education from MIT is like taking a drink from a fire hose” quote has been on my mind recently. (And yes, it certainly was like that.) I’ve set myself the task of learning Python, and how I as a tester might use it.

The language itself? Straightforward enough, I have a couple of hardcopy books, and the internet is full of Python tutorials and interview-type coding problems that can be worked in Python. That’s plenty of material for the practice I need.

On to how I might use it, and that’s where the fire hose got turned on. In Python, I made a simplified version of functionality that a previous employer’s automated testing framework had implemented in Perl, and wow, even allowing for the simplification, I’m pretty sure that framework would have been much easier to deal with if they’d built it in Python instead of Perl. I started working with PyDev in Eclipse, and getting acquainted with the Python unittest module, and that led to pushing code to GitHub, and then pulling it on an AWS instance for execution. 

I wanted to get an idea of how to test a REST API, and that means I needed a REST API to test – right, the tutorial I found for that uses Flask to make an application, and then shows you how to package it in Docker. I might as well do my experiments with extending that application and testing it from Pycharm. Ok, I like Pycharm better than PyDev. On to testing that REST application – there’s pyresttest, but that doesn’t quite look quite right, but hey, there’s this thing called Tavern! It’s pretty new but looks like I can make it do what I want, and you’re supposed to use it via pytest, and yes, pytest looks like better support for what I’m working on learning than unittest, and Pycharm can be made to run pytest for me.

There’s lots more out there,  all this stuff has fascinating references to other things that I’d love to pursue, but I really think I’d better stop collecting tools and work on learning more about what I’ve got so far before I add more. Though I’d like to get that REST application and tests for it into Jenkins …