PyCon CZ 2016 - day 1
My experience as an attendant on PyCon CZ 2016, day 1
“Somewhere, something incredible is waiting to be known” - Carl Sagan.
PyCon CZ aims to be the largest annual gathering for the Python community in the Czech Republic. It’s focused on honoring and supporting awesome people teaching, learning and innovating with Python in Czech Republic and surrounding EU.
My plan for the first day of the PyCon CZ was to attend as much Test related talks as possible.
“Because Web API Testing Should be Easy”
The first talk for me was “Because Web API Testing Should be Easy” by Vilibald Wanča. The main goal of this talk was to show us how to avoid outdated API documentation in our projects. For this purpose Vilibald introduced Dredd tool. Idea is pretty simple: Dredd reads your API description and step by step validates whether your API implementation replies with responses as they are described in the documentation. Real cool thing for me is that Dredd supports Swagger. You can find more information about Dredd here
“If it moves, Test it anyway”
After a short break Miro Hrončok has began his talk “If it moves, Test it anyway”. Basically he was talking about how it is important to test your code, which is, of course, well-known fact itself, but there was another important thing for me to know, and it is Betamax library. Is someone here remembered Betamax cassetes? Right… So : “Betamax records your HTTP interactions so the NSA does not have to.” or in non-humorous way: this library helps to mock HTTP requests much easier. Let’s imagine that we created a project that uses some well-known service like Twitter, Facebook, etc. So to test it properly you should have some credentials that you don’t want to share with the rest of the world. Solution? You can write your own simple http Twitter server implementation. But more features you will need to test - more code you will need to write for your fake Twitter server, and in the end you will have your own implementation of Twiiter, which is pretty cool itself, of course, but this was not the goal of our project. Solution? We can write our HTTP request-response session to the disk. And Betamax library can help us here. If you want to know more about Betamax you should check out this link. This library was first written for ruby and as Miro said: “they (ruby guys) can invent really great things, except for syntax of course”.
“DOS yourself a.k.a Load Testing”
Next talk was also really interesting plus it’s something that can be useful for my day-to-day job. I’m talking about Load Tests and “DOS yourself a.k.a Load Testing” by Dariusz Aniszewski. So if we have some web application / web interface (Crowbar???) it is really good idea to run not only unit tests but also load tests against it. So we have a couple of choices here:
- Apache Benchmark - good choice, but cons are obvious: we can’t use it in case our services run on nginx or on caddy.
- Jmeter - I’ve never used it before. It’s also from Apache Foundation, but if you look at interface it’s really verbose and hard to understand.
- beeswithmachineguns - what a name, huh? Unfortunately it was created and can be used only for Amazon instances.
- Locust - my favorite in this list. It is open source, and we can define user behavior with Python code, and swarm our system with millions of simultaneous users.
Locust looks really interesting so I’ll definitely spend some time during my next Hackweek at SUSE on creating load tests for crowbar with it.
“Feed your code to coala”
And the last talk for me on Day 1 was “Feed your code to coala” by “Robert Kuska”. It’s interesting talk for me as a beginner python developer because Robert showed how one can improve it’s code easily with coala - linting and Fixing Code for All Languages; it is fully language independent and any analysis routine can be used for as many languages as it is fit for. Here is the short demo of coala usage for Python:
As was mentioned before it is not only for Python, actually list of supported languages is pretty long and awesome:
- Natural Language,
- Python 2,
- Python 3,
So you definitely can find coala useful for any of your favorite language.
Continue: Day 2