Register to get access to free programming courses with interactive exercises

Continuous integration Python: Automated testing

We have already dealt with the tests, so we will discover how you run them properly now. In this lesson, we'll discuss continuous integration and learn how to test.

What is continuous integration

It is a personal responsibility to run tests locally. Good developers use tests continuously during development and run them before pushing using the git push command. But this is not enough because there are always human errors. Even though they run locally, tests should be run automatically on continuous integration servers.

Continuous integration is a development practice that consists of frequent and automated assembly of an application to identify problems quickly. Programmers usually perform integration on commits to the repository and monitor them using a specialized server or a continuous integration service. It loads the code, assembles it if necessary, and then runs various checks.

What do we launch, and how? The programmer determines this in advance. First, we run the tests and the linter, which check the design of the code. In addition, we can run utilities to analyze security, the relevance of dependencies, and much more. We can depict continuous integration in this diagram:

GitHub Actions Travis Continuous Integration Server

Let us take a closer look at the terminology and the process itself:

  • To launch a build for each commit
  • To assemble the application, install dependencies, run tests, and all other checks during the build
  • To get a successful test if the build completes without errors
  • To get a notification if the build fails
  • To look at the report, correct the errors, make another commit, and the process begins again

There are two ways to implement continuous integration.

The first way is to install Jenkins or its equivalent on your server. This option requires a lot of manual work, including server support. This solution is suitable for companies that:

  • Make very complex applications
  • Want their code to be secure
  • Make so many projects that their server is cheaper than a third-party solution

The second way is to use the continuous integration service. There are dozens, if not hundreds, of such services. There are plenty to choose from. As a rule, most of them are free for open-source projects.

One of the popular solutions is Github Actions, a built-in Github service:

Github Actions

GitHub Actions provides continuous integration and can do much more than that. Hexlet uses Actions in all its open and closed projects (example of such a project).

For convenience, the service gives a badge — a picture inserted into the README file in your project. The badge shows the current project status, including whether the last build was successful. Clicking on it, you can go to the page with the latest builds.


Are there any more questions? Ask them in the Discussion section.

The Hexlet support team or other students will answer you.

About Hexlet learning process

For full access to the course you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.bookmate">Bookmate</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.healthsamurai">Healthsamurai</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.dualboot">Dualboot</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.abbyy">Abbyy</span>
Suggested learning programs
profession
new
Developing web applications with Django
10 months
from scratch
under development
Start at any time

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions
Toto Image

Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.