Programming is our passion. It drives us to create internal tools that improve our creative process. For the time being, over 50 such tools have come out of our production. Most of them we will definitely make "public" because we are not a typical, passive part of the community and we love to create Open Source solutions. A month ago we presented you Deep Image, today we want to show you InspectR.
Developers don't like to write tests
Let's be honest: developers don't like to write tests. First of all, they are convinced that their code is good enough, so there is no need to check it, secondly writing tests is a tedious work, about which we would like to forget. At this stage, procrastination and process delaying are often included.
Meanwhile, testing on a regular basis is a huge time saver, especially during the implementation.
We know from experience that it is best to implement tests systematically, then spend a few days or nights manually checking the application.
What is the problem then?
- Lack of a bait - an element that will act as a mobilizer.
- Lack of a central place with test reports (to check the results of tests we have to enter CI/CD builds),
- Lack of visualization of results and tools to compare several projects relative to tests.
How InspectR solves these problems?
- Motivates to build tests - thanks to gamification and competition elements.
- Modifies the typical practice that involves running test process manually or, in a CI/CD process, gives a focused place with tests reports.d
- In one window collects data from all projects - shows in black and white, which tests have passed and which have failed and how we look like in comparison to other projects.
"Let's do IT!" - mobilizing gamification in programmer daily work
In InspectR, we put an element of competition between teams, that warms up the fight for testing. It's a rank system that shows us how our design looks like in comparison to other projects.
While working on InspectR, we were thinking about how to visually show the classification of projects - from the best to the weakest. Normally, we could simply give them numbers, or apply a normal score on a scale of 1-10. However, this is not our style - we are geeks and even the smallest details we like to develop in the climates of games, films, technologies. So... our graphic artist Jarek designed "level badges" based on the experience gained in games. You can also find them on our Behance profile: https://www.behance.net/TEONITE
Apart from them, in InspectR you will also find other forms of visualization of results - colors and dots, showing individual activities that determine what is working properly in a given project (green) and what needs to be improved (red). Thanks to them, you can immediately see what is happening in projects. Colors signal positive or negative test results and encourage you to fight for the best possible rank.
The central place with test reports
At TEONITE, we value our and our clients time, that's why we focus on: repetitive processes automatization and the most transparent possible visualization. Kamil Chudy wrote about it a year ago on our blog and confirmed his words during the June 2017 edition of Netcamp.
InspectR works best when working on CI/CD - Continuous Integration and Continuous Delivery. In TEONITE, we use GitLab for this and instead of running tests manually or in a pipeline, we enable InspectR and run tools for QA, including:
- automatic tests,
- test coverage,
- measures such as maintainability and cyclical complexity.
After activating InspectR to the test sequence, the application starts tests, inserts the results into the database and the dashboard reads the information. Et Voilà! All data is published on the dashboard.
InspectR consists of two parts:
- Command line tool, which we run on our projects.
Currently, we have plugins for our projects, which we have written:
- FLAKE 8 - Python code linter, a tool that tells whether code standards are preserved
- PYTEST TEST - Python automatic tests
- python unittest - Python automatic tests
- COVERAGE.PY - test coverage for Python
- RADON MAINTAINABILITY - a measure of code complexity
- RADON CYCLOMATIC COMPLEXITY - a cyclomatic complexity - a - measure that looks at the complexity of functions and depths of nesting
- mocha - j.w.
You can also add your own plugins! We have made the InspectR available in the open source version (you can read about it later in the text).
Visualization of progress in building a project
The whole analysis mentioned above is presented on one,
transparent dashboard and this is the main task of InspectR - combining healthy competition, pointing out possible mistakes and encouraging continuous development of the test database. The dashboard is sorted starting from the design that is the best - passed the tests and meets all requirements.
After clicking on a given project, we can view a detailed inspection report, which contains the output of individual tools: InspectR downloads this output, parses it and translates it into a dashboard results, giving the image of the original test result, thanks to which we know what works and what has failed.
InspectR has no limit of projects. The application has a built-in automatic scrolling function that allows you to set the view (for example, on a company TV) so that the whole team can see the progress of individual or all projects.
What appears in the view?
- High-level preview of how the project is maintained -shows us if everything works and we do not generate "technological debt"
- Detailed output of all tools.
- Refreshing the content - InspectR works on the basis of (mentioned earlier) RethinkDB database with the Horizon overlay. Thanks to this, new results that will be available in the database immediately appear on the dashboard.
- Project sorting - InspectR displays the best projects (which have the least errors and require the least amount of work to be repaired) in the first place.
InspectR in the open source version
We will make InspectR available on GitHub. The files are currently ready for publication and modification:
- Command line tool that we run on the project: https://github.com/teonite/inspectr-cli
- Dashboard, or web application for the visualization of results:: https://github.com/teonite/inspectr-dashboard
You can improve applications, change elements or expand according to your needs. Probably the first element you will want to add is the support of the tools you use. We tried to make these changes easy to implement.
However, if you do not have time to build your own parser for testing, all you need to do is create a GitHub issue, and the open source community (or we!) can write it in free time and let you know when it's available. Viva Comunità!
InspectR is a simple tool that actually does a rather important thing - thanks to it we have a clearly presented situation regarding the quality of the code.
This is a project that could be used by people responsible for QA, individuals, companies and even larger teams that develop their products, eg. by dividing projects into modules.
For us, InspectR is a universal tool that helps us maintain the right level of testing in many projects while giving a large portion of fun.