CI-järjestelmän automatisoitu yksikkötestaus
Lehtomaa, Eetu (2021)
Lehtomaa, Eetu
2021
All rights reserved. This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:amk-2024061723502
https://urn.fi/URN:NBN:fi:amk-2024061723502
Tiivistelmä
Tämän opinnäytetyön tavoitteena oli suorittaa automatisoitu yksikkötestausprosessi Polarin CI (Continuous Integration) -järjestelmään. Yksikkötestit testaavat CI-järjestelmän koodia. Toimeksiantajana työlle toimi suomalainen terveysteknologia-alan yritys Polar Electro Oy. Toimeksiantaja suorittaa automatisoituja yksikkötestejä tuotteilleen, mutta havaitsi, ettei CI-järjestelmälle ollut luotu testejä, ja huomasi tarpeen CI-järjestelmän testeille.
Opinnäytetyön teoriaosassa esitellään jatkuvan integraation käsite ja Jenkins-automaatiopalvelin, jotka ovat työssä käytettäviä menetelmiä. Teoriaosiossa on käytetty laajasti eri lähteitä. Lopuksi opinnäytetyössä esitellään projekti ja käydään automatisoidun yksikkötestauksen prosessi läpi vaiheittain.
Lopputuloksena saatiin toteutettua Jenkins-toimitusputki, joka suorittaa yksikkötestit automaattisesti aina, kun uusi vetopyyntö luodaan CI-järjestelmän tietolähteeseen. Yksikkötestien suorittamisen jälkeen toimitusputki esittää testien tulokset Jenkins-palvelimella ja Bitbucket-versionhallintajärjestelmässä sekä generoi koodinkattavuusraportin, joka ilmaisee, kuinka suuri osa koodista on testattu. Yksikkötestit verifioivat, että CI-järjestelmän koodi on laadukasta sekä varmistaa, etteivät uudet koodimuunnokset riko järjestelmän toimintaa. The goal of this thesis was to perform an automated unit testing process for the Polar’s CI (Continuous Integration) - system. The purpose of the unit tests is to test the code used by CI- system. Polar Electro Ltd. is a Finnish health technology company. The client performs unit tests on their products but found that no tests had been created for the CI- system.
Initially, the thesis describes the work at a general level and goes through the theory section, where the methods used in the work are reviewed. The methods used include continuous integration and Jenkins sections. Various sources have been used extensively in the theory section. Finally, the project is presented in the thesis and the process of automated unit testing is reviewed in stages.
The final result was an implemented Jenkins job that automatically performs unit tests whenever a new pull-request is created in the CI- system’s repository. After performing the unit tests, the job presents the test results on the Jenkins server and Bitbucket version control system and generates a code coverage report indicating how much of the code has been tested. The purpose of unit tests is to verify that the code of the CI- system is of good quality and to ensure that new code transformations do not violate the operation of the system.
Opinnäytetyön teoriaosassa esitellään jatkuvan integraation käsite ja Jenkins-automaatiopalvelin, jotka ovat työssä käytettäviä menetelmiä. Teoriaosiossa on käytetty laajasti eri lähteitä. Lopuksi opinnäytetyössä esitellään projekti ja käydään automatisoidun yksikkötestauksen prosessi läpi vaiheittain.
Lopputuloksena saatiin toteutettua Jenkins-toimitusputki, joka suorittaa yksikkötestit automaattisesti aina, kun uusi vetopyyntö luodaan CI-järjestelmän tietolähteeseen. Yksikkötestien suorittamisen jälkeen toimitusputki esittää testien tulokset Jenkins-palvelimella ja Bitbucket-versionhallintajärjestelmässä sekä generoi koodinkattavuusraportin, joka ilmaisee, kuinka suuri osa koodista on testattu. Yksikkötestit verifioivat, että CI-järjestelmän koodi on laadukasta sekä varmistaa, etteivät uudet koodimuunnokset riko järjestelmän toimintaa.
Initially, the thesis describes the work at a general level and goes through the theory section, where the methods used in the work are reviewed. The methods used include continuous integration and Jenkins sections. Various sources have been used extensively in the theory section. Finally, the project is presented in the thesis and the process of automated unit testing is reviewed in stages.
The final result was an implemented Jenkins job that automatically performs unit tests whenever a new pull-request is created in the CI- system’s repository. After performing the unit tests, the job presents the test results on the Jenkins server and Bitbucket version control system and generates a code coverage report indicating how much of the code has been tested. The purpose of unit tests is to verify that the code of the CI- system is of good quality and to ensure that new code transformations do not violate the operation of the system.