{"id":359990,"date":"2024-05-21T00:44:07","date_gmt":"2024-05-21T00:44:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=359990"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T00:44:07","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=359990","title":{"rendered":"<span>JUnit 5 Extensions \u2014 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e (\u0447\u0430\u0441\u0442\u044c 1)<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442. \u0412 \u0420\u0443\u043d\u0435\u0442\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043f\u043e JUnit 5 Extensions \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u043e\u043d \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (\u0432 \u0440\u0435\u0434\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 &#8212; \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u0437\u0430\u0440\u0443\u0431\u0435\u0436\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a.<\/p>\n<p>\u0412 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 JUnit 5, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e \u0440\u0435\u0448\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u0432\u044b\u0431\u0435\u0440\u0443 Kotlin.<\/p>\n<h2>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/h2>\n<p>\u041e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c \u0441\u0440\u0430\u0437\u0443, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442: \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b JUnit 5, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f JUnit 5 \u0441 JUnit 4, \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c\u0438, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 kotlin reflection, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u0435\u043c\u043e\u0432 (&#8230;\u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u0447\u043d\u043e!).<\/p>\n<p>&#171;\u0418 \u0437\u0430\u0447\u0435\u043c \u0442\u044b \u0442\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0435\u0439 \u043e\u043f\u0443\u0441&#187;- \u0441\u043a\u0430\u0436\u0435\u0442 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c &#171;\u0445\u0430\u0431\u0440\u0430&#187;, \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0430\u0432. \u041d\u043e \u043d\u0435 \u0441\u043f\u0435\u0448\u0438\u0442\u0435 \u0440\u0430\u0437\u043c\u0430\u0445\u0438\u0432\u0430\u0442\u044c \u0448\u043f\u0430\u0433\u0430\u043c\u0438, \u0433\u043e\u0441\u043f\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0438! \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0430\u043a\u0446\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438, \u0430 \u0435\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f &#171;\u0431\u0430\u0437\u044b&#187;, \u0442\u043e \u0435\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/junit.org\/junit5\/docs\/current\/user-guide\/#extensions\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>\u0421\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <em>&#171;\u0417\u0432\u0435\u0437\u0434\u0430\u043c \u0442\u044f\u0436\u0435\u043b\u043e\u0433\u043e \u043c\u0435\u0442\u0430\u043b\u043b\u0430&#187; aka &#171;\u041c\u0430\u0442\u0435\u0440\u044b\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c \u0438 SDET-\u0430\u043c&#187;<\/em> \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043a\u0443\u0447\u043d\u043e \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u043d\u0438 \u0434\u0430\u0436\u0435 \u043d\u0430\u0439\u0434\u0443\u0442 \u0442\u0443\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 (\u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438 \u043d\u0435 \u043e\u0434\u043d\u0443&#8230;)<\/p>\n<h2>\u041a\u0440\u0430\u0442\u043a\u0430\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0430<\/h2>\n<p>JUnit 5 Extensions &#8212; \u043c\u043e\u0449\u043d\u043e\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0442\u0435\u0441\u0442\u043e\u0432. \u041f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u0435\u0449\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0438\u0448\u0435\u043a \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0430\u043c \u0441\u0435\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0432 JUnit 5.<\/p>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e: \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u0441 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 json, \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430 \u0432 TMS \u0438\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u043e \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\u0430\u043c (\u0434\u0435\u043d\u044c-\u0442\u043e \u0442\u044f\u0436\u0435\u043b\u044b\u0439!!!) \u0442\u043e \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0434\u043e!<\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a &#8212; \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f JUnit \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0444\u0430\u0437\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f extension point (\u0442\u043e\u0447\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f), \u0438 \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u0448\u0430\u0433\u0435, \u0442\u043e JUnit \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0438\u0445. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u0439 &#171;extension \u0441 \u043f\u0440\u0435\u0444\u0435\u0440\u0430\u043d\u0441\u043e\u043c \u0438 \u043a\u0443\u0440\u0442\u0438\u0437\u0430\u043d\u043a\u0430\u043c\u0438&#187;, \u0442\u043e \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 JUnit 5 Extension API.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a2d\/9df\/40f\/a2d9df40f30e7af3dda660caad939fea.png\" alt=\"Lifecycle of JUnit 5 Extension API \" title=\"Lifecycle of JUnit 5 Extension API \" width=\"3513\" height=\"2898\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a2d\/9df\/40f\/a2d9df40f30e7af3dda660caad939fea.png\"\/><\/p>\n<div><figcaption>Lifecycle of JUnit 5 Extension API <\/figcaption><\/div>\n<\/figure>\n<h2>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c!<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0434\u043b\u044f JUnit5, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u0411\u0435\u0440\u0435\u043c Gradle (\u0438\u043b\u0438 Maven, \u0435\u0441\u043b\u0438 \u043c\u0441\u044c\u0435\/\u043c\u0430\u0434\u0430\u043c \u0437\u043d\u0430\u0435\u0442 \u0442\u043e\u043b\u043a \u0432 \u0438\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f\u0445) \u0438 \u0432 \u0444\u0430\u0439\u043b build.gradle.kts \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<p><code>testImplementation(platform(\"org.junit:junit-bom:5.10.0\")) testImplementation(\"org.junit.jupiter:junit-jupiter\") testImplementation(\"org.junit.jupiter:junit-jupiter-api:5.10.0\") <\/code><\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u0430\u043a\u0442\u043e\u0432 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0430\u043c\u0443\u044e \u0441\u0432\u0435\u0436\u0443\u044e, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 &#8212; <code>.\/gradlew clean build<\/code> \u0438 \u0432\u044b\u0434\u044b\u0445\u0430\u0435\u043c. \u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u0441\u0434\u0435\u043b\u0430\u043d! \u041d\u0430 &#171;\u0432\u0441\u044f\u043a\u0438\u0439 \u043f\u043e\u0436\u0430\u0440\u043d\u044b\u0439&#187; &#8212; <a href=\"https:\/\/docs.gradle.org\/current\/userguide\/kotlin_dsl.html\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443 Gradle<\/a>, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u0432 Gradle \u0441 Groovy \u043d\u0430 Kotlin \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b.<\/p>\n<h3>\u041a\u043e\u043b\u043b\u0431\u044d\u043a\u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u0442\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043f\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0438 \u0443 \u0442\u0435\u0431\u044f \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>Allure &#8212; 1 \u0448\u0442.<\/p>\n<\/li>\n<li>\n<p>RestAssured &#8212; 1 \u0448\u0442.<\/p>\n<\/li>\n<li>\n<p>TestRail &#8212; 1 \u0448\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0438\u043c\u043b\u0438\u0434 &#8212; 1 \u0448\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441\u0430 \u0432 TMS TestRail \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430. <em>\u0421\u043a\u0430\u0437\u0430\u043d\u043e &#8212; \u0441\u0434\u0435\u043b\u0430\u043d\u043e!<\/em> \u0418 \u043a\u0430\u043a \u0442\u0435\u0430\u0442\u0440 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0432\u0435\u0448\u0430\u043b\u043a\u0438, \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u0447\u043d\u0435\u0442\u0441\u044f \u0441 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"kotlin\">\/\/ \u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f TestRail class TestRailExtension {     private val testRailHost = \"https:\/\/rails.yourcompany.tech\/index.php?\/api\/v2\" } <\/code><\/pre>\n<p>\u0418 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 <code>enum class<\/code> \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0443 \u0441\u0435\u0431\u044f \u0432 TMS.<\/p>\n<pre><code class=\"kotlin\">\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 enum \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432 \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441\u0430 enum class TestCaseStatus(val id: Int) {     PASSED(1), FAILED(2) }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u043b\u043e \u0437\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439. \u0418 \u0442\u0443\u0442 \u0434\u0432\u0430 \u043f\u0443\u0442\u0438 &#8212; \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0443\u044e\u0441\u044f <em>(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 TMSLink \u0432 Allure)<\/em>. \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438 \u043f\u0438\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0440\u0430\u0437\u0443 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 TestRail API, \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0432 <em>rails.yourcompany.tech<\/em> &#8212; \u043d\u0430 \u0441\u0432\u043e\u0439 \u0434\u043e\u043c\u0435\u043d.<\/p>\n<p>\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f TMSLink &#8212; \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441\u044b \u0432 TMS (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 TestRail). \u0427\u0442\u043e\u0431\u044b \u0441\u0441\u044b\u043b\u043a\u0430 \u0432 Allure \u043e\u0442\u0447\u0435\u0442\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430, \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b <code>allure.properties<\/code> \u0432 resources \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043c:<\/p>\n<pre><code>allure.link.tms.pattern=https:\/\/youcompany.tech\/projects\/777\/tests\/{}<\/code><\/pre>\n<p>&#8230;\u0433\u0434\u0435 <code>https:\/\/youcompany.tech\/projects\/777\/tests\/<\/code> &#8212; \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441, \u0430 <code>{}<\/code> &#8212; \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u043e\u043c\u0435\u0440 \u043a\u0435\u0439\u0441\u0430 \u0432 TMS-\u043a\u0435.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043b\u0430\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a LifeCycle Callbacks. Junit 5 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0435\u0433\u043e \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c: \u043e\u0442 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <em>TestInstancePostProcessor<\/em> \u0438 <em>ParameterResolver<\/em> \u0434\u043e \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441 <em>ExecutionCondition<\/em> \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0441 <em>TestExecutionExceptionHandler<\/em>. \u041d\u043e \u043d\u0430\u043c \u043f\u043e\u043a\u0430 \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f &#8212; <em>\u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430:<\/em><\/p>\n<ul>\n<li>\n<p><em>BeforeAllCallback<\/em> \u0438 <em>AfterAllCallback<\/em> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><em>BeforeEachCallBack \u0438 AfterEachCallback<\/em> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p><em>BeforeTestExecutionCallback \u0438 AfterTestExecutionCallback<\/em> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043e \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435 BeforeEachCallBack \u0438 AfterEachCallback \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 <em>AfterEachCallback<\/em>, \u043d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0438-\u0434\u0436\u0435\u0434\u0430\u0438 \u0434\u043e\u0431\u0430\u0432\u044f\u0442 \u0432 \u043a\u043b\u0430\u0441\u0441 \u043c\u0435\u0442\u043e\u0434 \u0441 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@AfterEach<\/code>? \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0430\u0444\u0444\u0435\u043a\u0442\u0438\u0442\u044c \u043a\u043e\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043c\u0435\u043b\u043e \u0431\u0435\u0440\u0435\u043c &#8212; <em>AfterTestExecutionCallback<\/em><\/p>\n<pre><code class=\"kotlin\">class TestRailExtension : AfterTestExecutionCallback {     private val testRailHost = \"https:\/\/rails.yourcompany.tech\/index.php?\/api\/v2\"     private val setOfCases = HashMap&lt;String, Int>()         override fun afterTestExecution(context: ExtensionContext) {         val annotation: TmsLink? = context.element.get().getAnnotation(TmsLink::class.java)         val caseStatus = when (!context.executionException.isPresent) {             true -> TestCaseStatus.PASSED.id             else -> TestCaseStatus.FAILED.id         }         annotation?.let { setOfCases[it.value] = caseStatus }     } }<\/code><\/pre>\n<p>&#8230;\u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <code>afterTestExecution<\/code>. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e &#171;\u0445\u044d\u0448\u043c\u0430\u043f\u0443&#187; \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <em>&#171;\u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435&#187;<\/em>, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; <em>&#171;\u043d\u043e\u043c\u0435\u0440 \u043a\u0435\u0439\u0441\u0430 &#8212; \u0441\u0442\u0430\u0442\u0443\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f&#187;<\/em>. \u0415\u0449\u0435 \u0445\u044d\u0448\u043c\u0430\u043f\u0430 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0442\u043e \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0442\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u0430 \u043d\u0430\u043c \u0432\u0435\u0434\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u0435\u0439\u0441\u0430?..<\/p>\n<p>\u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@TMSLink<\/code> \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0438 \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0435\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u0432\u0435\u0440\u043d\u0435\u0442 &#8212; <code>context.executionException.isPresent<\/code>. \u0412\u043e\u043e\u0431\u0449\u0435, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 ExecutionContext \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e, \u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u043e\u0442 <em>AfterAllCallback<\/em> \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <code>afterAll<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>AfterTestExecutionCallback \u0438 AfterAllCallback <\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class TestRailExtension : AfterTestExecutionCallback, AfterAllCallback {  private val testRailHost = \"https:\/\/rails.yourcompany.tech\/index.php?\/api\/v2\" private val setOfCases = HashMap&lt;String, Int>() private var testRunID = 91  override fun afterTestExecution(context: ExtensionContext) {     val annotation: TmsLink? = context.element.get().getAnnotation(TmsLink::class.java)     val caseStatus = when (!context.executionException.isPresent) {         true -> TestCaseStatus.PASSED.id         else -> TestCaseStatus.FAILED.id     }     annotation?.let { setOfCases[it.value] = caseStatus } }  private fun setCaseStatus(caseStatus: Int, caseId: String) {     RestAssured.given()         .auth().preemptive().basic(\"YOUR_EMAIL\", \"YOUR_PASSWORD\")         .contentType(ContentType.JSON)         .body(hashMapOf(\"status_id\" to caseStatus))         .post(\"$testRailHost\/add_result_for_case\/$testRunID\/$caseId\") }  override fun afterAll(context: ExtensionContext?) {     setOfCases.forEach { (caseId, caseStatus) ->         setCaseStatus(caseStatus, caseId)         }     }      }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, <code>testRunID<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0437\u0430\u0439\u0434\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0441\u0430\u043c TestRun, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u043b\u0435\u0432\u043e\u043c \u0443\u0433\u043b\u0443, \u0442\u0430\u043a\u0436\u0435 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0432 &#171;\u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c chrome devtools&#187; \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0432 \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u0435\u0439\u0441\u0430 \u0432 \u0442\u0435\u0441\u0442-\u0440\u0430\u043d\u0435. <code>Project ID<\/code> &#8212; \u0431\u0435\u0440\u0435\u043c \u0442\u0430\u043c \u0436\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/865\/1c1\/c76\/8651c1c76206e2c87b2fe93f0b706c68.jpg\" alt=\"TMS TestRail\" title=\"TMS TestRail\" width=\"2554\" height=\"1530\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/865\/1c1\/c76\/8651c1c76206e2c87b2fe93f0b706c68.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>TMS TestRail<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0434\u0438 &#171;\u043d\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c&#187; \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u043d\u0430\u0432\u0435\u0448\u0438\u0432\u0430\u0435\u043c \u043d\u0430\u0434 \u043e\u043d\u044b\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@ExtendWith(TestRailExtension::class)<\/code>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/p>\n<pre><code class=\"kotlin\">@ExtendWith(TestRailExtension::class) class HabrDemo {          @Test     @TmsLink(\"1595\")     fun `demo test one`() = assertTrue(true) } <\/code><\/pre>\n<p>\u0421\u0442\u0430\u0440\u0442\u0443\u0435\u043c. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0443 \u043a\u0435\u0439\u0441\u0430. \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434. \u0420\u0430\u0434\u0443\u0435\u043c\u0441\u044f, \u043d\u043e \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u0434\u043e\u043b\u0433\u043e. \u0422\u0438\u043c\u043b\u0438\u0434 \u044f\u0432\u043d\u043e \u043d\u0435 \u0434\u043e\u0432\u043e\u043b\u0435\u043d, \u0438\u0431\u043e \u0436\u0435\u043b\u0430\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 TestRun \u0432 TestRails.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0442\u044c TestRun &#8212; \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f BeforeAllCallback. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0442\u0440\u0438\u0445\u043e\u0432, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u0435\u0442\u043e\u0434\u044b <code>createTestRun<\/code> \u0438 <code>beforeAll<\/code> \u0438 \u0432\u044b\u0434\u0430\u0435\u043c \u043d\u0430-\u0433\u043e\u0440\u0430 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<details class=\"spoiler\">\n<summary>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class TestRailExtension : AfterTestExecutionCallback, AfterAllCallback, BeforeAllCallback {   private val testRailHost = \"https:\/\/rails.yourcompany.tech\/index.php?\/api\/v2\"   private val setOfCases = HashMap&lt;String, Int>()   private var testRunID = 91   private val projectId = 2   private val localDatetime = LocalDateTime.now()     .format(DateTimeFormatter.ofPattern(\"dd-MM-yyyy HH:mm\"))  override fun afterTestExecution(context: ExtensionContext) {     val annotation: TmsLink? = context.element.get().getAnnotation(TmsLink::class.java)     val caseStatus = when (!context.executionException.isPresent) {         true -> TestCaseStatus.PASSED.id         else -> TestCaseStatus.FAILED.id     }     annotation?.let { setOfCases[it.value] = caseStatus } }  private fun setCaseStatus(caseStatus: Int, caseId: String) {     RestAssured.given()         .auth().preemptive().basic(\"YOUR_EMAIL\", \"YOUR_PASSWORD\")         .contentType(ContentType.JSON)         .body(hashMapOf(\"status_id\" to caseStatus))         .post(\"$testRailHost\/add_result_for_case\/$testRunID\/$caseId\") }  private fun createTestRun(projectId: Int, testCases: List&lt;Int>): Int {      val requestBody = hashMapOf(         \"name\" to \"New test run $localDatetime\",         \"include_all\" to false,         \"case_ids\" to testCases     )      val response = RestAssured.given()         .auth().preemptive().basic(\"YOUR_EMAIL\", \"YOUR_PASSWORD\")         .contentType(ContentType.JSON)         .body(requestBody)         .post(\"$testRailHost\/add_run\/$projectId\")      return response.body.jsonPath().getString(\"id\").toInt() }  override fun afterAll(context: ExtensionContext) {     setOfCases.forEach { (caseId, caseStatus) ->         setCaseStatus(caseStatus, caseId)     } }  override fun beforeAll(context: ExtensionContext) {     val cases = arrayListOf&lt;Int>()     context.requiredTestClass.declaredMethods.forEach { method ->         cases.addAll(             method.annotations.filterIsInstance&lt;TmsLink>().map { it.value.toInt() }         )     }      if (cases.isNotEmpty()) {         testRunID = createTestRun(projectId, cases)       }   } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d2b\/5ab\/2b8\/d2b5ab2b835fd014950f2d0b27f8f1b5.png\" alt=\"TMS TestRail\" title=\"TMS TestRail\" width=\"1220\" height=\"834\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d2b\/5ab\/2b8\/d2b5ab2b835fd014950f2d0b27f8f1b5.png\"\/><\/p>\n<div><figcaption>TMS TestRail<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 <code>createTestRun<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0442\u0435\u0441\u0442-\u0440\u0430\u043d \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e &#171;\u0430\u0439\u0434\u0438\u0448\u043d\u0438\u043a&#187;. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c <a href=\"https:\/\/support.testrail.com\/hc\/en-us\/articles\/7077874763156-Runs\">\u0447\u0438\u0442\u0430\u0435\u043c \u0442\u0443\u0442<\/a>. \u0418\u0442\u0430\u043a! TestRun \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f, \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u0432 \u043d\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u0430 \u0442\u0438\u043c\u043b\u0438\u0434 \u0431\u043e\u043b\u0435\u0435 \u043d\u0435 \u0436\u0435\u043b\u0430\u0435\u0442 \u043d\u0430\u0448\u0435\u0439 \u043a\u0440\u043e\u0432\u0438. \u0418 \u0442\u0443\u0442 \u0442\u0438\u043c\u043b\u0438\u0434 \u0437\u0430\u044f\u0432\u043b\u044f\u0435\u0442: &#171;\u0417\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435! \u041f\u043e\u0433\u0443\u0433\u043b\u0438 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443&#187;.<\/p>\n<p>\u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0448\u0430\u043c\u043f\u0430\u043d\u0441\u043a\u043e\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a <em><s>\u0447\u0435\u0440\u0442\u0435\u0436\u043d\u043e\u0439 \u0434\u043e\u0441\u043a\u0435<\/s><\/em> \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435&#8230;<\/p>\n<h2>Test Watcher \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0442\u0435\u0441\u0442\u0430<\/h2>\n<p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 TestWatcher \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0431\u043e\u0433\u0430\u0442\u044b\u0439 API \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432, \u043d\u0435\u0436\u0435\u043b\u0438  \u0447\u0435\u043c LifeCycleCallbacks. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e &#171;\u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c&#187; \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043f\u0430\u0432\u0448\u0438\u0435 \u0438\/\u0438\u043b\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b, \u043d\u043e \u0438 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435, \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u044b\u0435, \u0447\u0442\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430\u043c \u0438 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 TestRail API \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c enum-\u043a\u043b\u0430\u0441\u0441 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u043c\u0438<\/p>\n<pre><code class=\"kotlin\">enum class TestCaseStatus(val id: Int) {     PASSED(1), BLOCKED(2), RETEST(4), FAILED(5) } <\/code><\/pre>\n<p>TestWatcher \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0442\u0435\u0441\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><em>testSuccessful(context: ExtensionContext)<\/em> &#8212; \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430<\/p>\n<\/li>\n<li>\n<p><em>testFailed(context: ExtensionContext, cause: Throwable)<\/em>&#8212; \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0443\u043f\u0430\u0432\u0448\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u0430<\/p>\n<\/li>\n<li>\n<p><em>testAborted(context: ExtensionContext, cause: Throwable)<\/em> &#8212; \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430<\/p>\n<\/li>\n<li>\n<p><em>testDisabled(context: ExtensionContext, reason: Optional)<\/em> &#8212; \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0440\u043e\u043c\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0435\u0449\u0435 2 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f &#8212; <code>cause: Throwable<\/code> \u0438 <code>reason: Optional<\/code>.  \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u0443 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 &#8212; \u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0430 (<em>\u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <a class=\"mention\" href=\"\/users\/Disabled\">@Disabled<\/a>(&#171;Cause text&#8230;&#187;)<\/em>).<\/p>\n<p>\u041f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c TestWatcherExtension &#8212; \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u043e\u0442 TestWatcher, BeforeAllCallback, AfterAllCallback. \u0414\u0430\u043b\u0435\u0435 \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u043e\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 <em>(\u0432\u044b\u043d\u043e\u0441\u0438\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a TestRail API \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b)<\/em> \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f<\/p>\n<details class=\"spoiler\">\n<summary>TestWatcherExtension<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class TestWatcherExtension : TestWatcher, BeforeAllCallback, AfterAllCallback {      private val testRailHost = \"https:\/\/rails.yourcompany.tech\/index.php?\/api\/v2\"     private val setOfCases = HashMap&lt;String, Int>()     private var testRunID = 91     private val projectId = 2     private val localDatetime = LocalDateTime.now()         .format(DateTimeFormatter.ofPattern(\"dd-MM-yyyy HH:mm\"))      private fun updateResult(body: HashMap&lt;String, Any>, url: String): Response {         return RestAssured.given()             .auth().preemptive().basic(\"YOUR_EMAIL\", \"YOUR_PASSWORD\")             .contentType(ContentType.JSON)             .body(body)             .post(url)     }      private fun createTestRun(projectId: Int, testCases: List&lt;Int>): Int {         val requestBody = hashMapOf(             \"name\" to \"New test run $localDatetime\",             \"include_all\" to false,             \"case_ids\" to testCases         )         val response = updateResult(requestBody, \"$testRailHost\/add_run\/$projectId\")         return response.body.jsonPath().getString(\"id\").toInt()     }      private fun setStatus(ctx: ExtensionContext, caseStatus: TestCaseStatus) {         val annotation: TmsLink? = ctx.element.get().getAnnotation(TmsLink::class.java)         annotation?.let { setOfCases[it.value] = caseStatus.id }     }      override fun testSuccessful(context: ExtensionContext) {         setStatus(context, TestCaseStatus.PASSED)     }      override fun testFailed(context: ExtensionContext, cause: Throwable) {         setStatus(context, TestCaseStatus.FAILED)     }      override fun testAborted(context: ExtensionContext, cause: Throwable) {         setStatus(context, TestCaseStatus.RETEST)     }      override fun testDisabled(context: ExtensionContext, reason: Optional&lt;String>) {         setStatus(context, TestCaseStatus.BLOCKED)     }      override fun beforeAll(context: ExtensionContext) {         val cases = arrayListOf&lt;Int>()         context.requiredTestClass.declaredMethods.forEach { method ->             cases.addAll(                 method.annotations.filterIsInstance&lt;TmsLink>().map { it.value.toInt() }             )         }         if (cases.isNotEmpty()) {             testRunID = createTestRun(projectId, cases)         }     }      override fun afterAll(context: ExtensionContext) {         setOfCases.forEach { (caseId, caseStatus) ->             updateResult(                 hashMapOf(\"status_id\" to caseStatus),                 \"$testRailHost\/add_result_for_case\/$testRunID\/$caseId\"             )         }     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0427\u0442\u043e \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c? \u0412\u044b\u043d\u0435\u0441\u0442\u0438 \u0430\u0434\u0440\u0435\u0441 \u0445\u043e\u0441\u0442\u0430, \u043b\u043e\u0433\u0438\u043d, \u043f\u0430\u0440\u043e\u043b\u044c \u0438 id \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, env). \u0422\u0430\u043a\u0436\u0435, \u0432 TestRail \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043a\u0435\u0439\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>cause: Throwable <\/code> \u0438\u043b\u0438 <code>reason: Optional&lt;String><\/code> \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>\u0410 \u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u043b\u043e \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 <code>@TMSLink<\/code>, \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043d\u044b\u0445 \u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 \u0438, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c API \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u0448\u0438\u0431\u043e\u043a (<em>\u0445\u043e\u0442\u044f \u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u044b&#8230;<\/em>), \u0434\u0430\u0431\u044b \u043d\u0430\u0448\u0438 \u0442\u0435\u0441\u0442\u044b \u043d\u0435 \u0443\u043f\u0430\u043b\u0438 \u0438\u0437-\u0437\u0430 \u043d\u0435 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0432\u0448\u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f. \u041d\u043e \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0443\u0436\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0441\u0442\u0430\u0442\u044c\u0438&#8230;<\/p>\n<h2>\u0412\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0430<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e <a href=\"https:\/\/github.com\/klesarev\/kotlin-learn\/tree\/master\/src\/main\/kotlin\/qa\/extensions\">\u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0430 github<\/a>. \u0410 \u0443\u0436\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 <em>ArgumentAccessor,  ArgumentAggregator, ArgumentsProvider<\/em>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Dependency Injection \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <em>ParameterResolver<\/em> \u0438 <em>TestInstancePostProcessor<\/em><\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u0435\u0439 \u043e\u043f\u044b\u0442 \u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u0442\u0438\u043a\u0435 \u0438 \u0441\u043e\u0432\u0435\u0442\u0430\u043c!<\/p>\n<h3>\u0427\u0442\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c?<\/h3>\n<ul>\n<li>\n<p>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f TestRail API &#8212; <a href=\"https:\/\/support.testrail.com\/hc\/en-us\/articles\/7077083596436-Introduction-to-the-TestRail-API\">Introduction to the TestRail API<\/a><\/p>\n<\/li>\n<li>\n<p>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c &#8212; <a href=\"https:\/\/junit.org\/junit5\/docs\/current\/user-guide\/#extensions-overview\">JUnit 5 Extension Model<\/a><\/p>\n<\/li>\n<li>\n<p>\u0425\u043e\u0440\u043e\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c &#8212; <a href=\"https:\/\/www.petrikainulainen.net\/programming\/testing\/introduction-to-junit-5-extensions\/\">Introduction to JUnit 5 Extensions<\/a><\/p>\n<\/li>\n<li>\n<p>&#8230;\u0438 \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c &#8212; <a href=\"https:\/\/habr.com\/ru\/articles\/589135\/\">\u041f\u043e\u043b\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c JUnit 5<\/a><\/p>\n<\/li>\n<\/ul>\n<h3>P.S.<\/h3>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u0438 \u043e\u0434\u0438\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0442\u043e\u0440 \u0438\u043b\u0438 \u0442\u0438\u043c\u043b\u0438\u0434 \u043d\u0435 \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u043b! \u041b\u044e\u0431\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043b\u044e\u0434\u044c\u043c\u0438 \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b! \u0412\u0441\u0435\u043c \u0434\u043e\u0431\u0440\u0430!<\/p>\n<p>\u0410\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438: <a href=\"https:\/\/habr.com\/ru\/users\/foxcode85\/\">@foxcode85<\/a> <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/773530\/\"> https:\/\/habr.com\/ru\/articles\/773530\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442. \u0412 \u0420\u0443\u043d\u0435\u0442\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043f\u043e JUnit 5 Extensions \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u043e\u043d \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (\u0432 \u0440\u0435\u0434\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 &#8212; \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u0437\u0430\u0440\u0443\u0431\u0435\u0436\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a.<\/p>\n<p>\u0412 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 JUnit 5, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e \u0440\u0435\u0448\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u0432\u044b\u0431\u0435\u0440\u0443 Kotlin.<\/p>\n<h2>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/h2>\n<p>\u041e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c \u0441\u0440\u0430\u0437\u0443, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442: \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b JUnit 5, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f JUnit 5 \u0441 JUnit 4, \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c\u0438, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 kotlin reflection, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u0435\u043c\u043e\u0432 (&#8230;\u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u0447\u043d\u043e!).<\/p>\n<p>&#171;\u0418 \u0437\u0430\u0447\u0435\u043c \u0442\u044b \u0442\u043e\u0433\u0434\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0435\u0439 \u043e\u043f\u0443\u0441&#187;- \u0441\u043a\u0430\u0436\u0435\u0442 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c &#171;\u0445\u0430\u0431\u0440\u0430&#187;, \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0430\u0432. \u041d\u043e \u043d\u0435 \u0441\u043f\u0435\u0448\u0438\u0442\u0435 \u0440\u0430\u0437\u043c\u0430\u0445\u0438\u0432\u0430\u0442\u044c \u0448\u043f\u0430\u0433\u0430\u043c\u0438, \u0433\u043e\u0441\u043f\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0438! \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0430\u043a\u0446\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438, \u0430 \u0435\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f &#171;\u0431\u0430\u0437\u044b&#187;, \u0442\u043e \u0435\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/junit.org\/junit5\/docs\/current\/user-guide\/#extensions\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>\u0421\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <em>&#171;\u0417\u0432\u0435\u0437\u0434\u0430\u043c \u0442\u044f\u0436\u0435\u043b\u043e\u0433\u043e \u043c\u0435\u0442\u0430\u043b\u043b\u0430&#187; aka &#171;\u041c\u0430\u0442\u0435\u0440\u044b\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c \u0438 SDET-\u0430\u043c&#187;<\/em> \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043a\u0443\u0447\u043d\u043e \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u043d\u0438 \u0434\u0430\u0436\u0435 \u043d\u0430\u0439\u0434\u0443\u0442 \u0442\u0443\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 (\u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438 \u043d\u0435 \u043e\u0434\u043d\u0443&#8230;)<\/p>\n<h2>\u041a\u0440\u0430\u0442\u043a\u0430\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0430<\/h2>\n<p>JUnit 5 Extensions &#8212; \u043c\u043e\u0449\u043d\u043e\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0442\u0435\u0441\u0442\u043e\u0432. \u041f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u0435\u0449\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0438\u0448\u0435\u043a \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0430\u043c \u0441\u0435\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0432 JUnit 5.<\/p>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e: \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u0441 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 json, \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430 \u0432 TMS \u0438\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u043e \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a\u0430\u043c (\u0434\u0435\u043d\u044c-\u0442\u043e \u0442\u044f\u0436\u0435\u043b\u044b\u0439!!!) \u0442\u043e \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0434\u043e!<\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a &#8212; \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f JUnit \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0444\u0430\u0437\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f extension point (\u0442\u043e\u0447\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f), \u0438 \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u0448\u0430\u0433\u0435, \u0442\u043e JUnit \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0438\u0445. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u0439 &#171;extension \u0441 \u043f\u0440\u0435\u0444\u0435\u0440\u0430\u043d\u0441\u043e\u043c \u0438 \u043a\u0443\u0440\u0442\u0438\u0437\u0430\u043d\u043a\u0430\u043c\u0438&#187;, \u0442\u043e \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 JUnit 5 Extension API.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>Lifecycle of JUnit 5 Extension API <\/figcaption><\/div>\n<\/figure>\n<h2>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c!<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0434\u043b\u044f JUnit5, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u0411\u0435\u0440\u0435\u043c Gradle (\u0438\u043b\u0438 Maven, \u0435\u0441\u043b\u0438 \u043c\u0441\u044c\u0435\/\u043c\u0430\u0434\u0430\u043c \u0437\u043d\u0430\u0435\u0442 \u0442\u043e\u043b\u043a \u0432 \u0438\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f\u0445) \u0438 \u0432 \u0444\u0430\u0439\u043b build.gradle.kts \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c:<\/p>\n<p><code>testImplementation(platform(\"org.junit:junit-bom:5.10.0\")) testImplementation(\"org.junit.jupiter:junit-jupiter\") testImplementation(\"org.junit.jupiter:junit-jupiter-api:5.10.0\") <\/code><\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u0430\u043a\u0442\u043e\u0432 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0430\u043c\u0443\u044e \u0441\u0432\u0435\u0436\u0443\u044e, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 &#8212; <code>.\/gradlew clean build<\/code> \u0438 \u0432\u044b\u0434\u044b\u0445\u0430\u0435\u043c. \u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u0441\u0434\u0435\u043b\u0430\u043d! \u041d\u0430 &#171;\u0432\u0441\u044f\u043a\u0438\u0439 \u043f\u043e\u0436\u0430\u0440\u043d\u044b\u0439&#187; &#8212; <a href=\"https:\/\/docs.gradle.org\/current\/userguide\/kotlin_dsl.html\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443 Gradle<\/a>, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u0432 Gradle \u0441 Groovy \u043d\u0430 Kotlin \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b.<\/p>\n<h3>\u041a\u043e\u043b\u043b\u0431\u044d\u043a\u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u0442\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043f\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0438 \u0443 \u0442\u0435\u0431\u044f \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>Allure &#8212; 1 \u0448\u0442.<\/p>\n<\/li>\n<li>\n<p>RestAssured &#8212; 1 \u0448\u0442.<\/p>\n<\/li>\n<li>\n<p>TestRail &#8212; 1 \u0448\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0438\u043c\u043b\u0438\u0434 &#8212; 1 \u0448\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441\u0430 \u0432 TMS TestRail \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430. <em>\u0421\u043a\u0430\u0437\u0430\u043d\u043e &#8212; \u0441\u0434\u0435\u043b\u0430\u043d\u043e!<\/em> \u0418 \u043a\u0430\u043a \u0442\u0435\u0430\u0442\u0440 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0432\u0435\u0448\u0430\u043b\u043a\u0438, \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u0447\u043d\u0435\u0442\u0441\u044f \u0441 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"kotlin\">\/\/ \u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f TestRail class TestRailExtension {     private val testRailHost = \"https:\/\/rails.yourcompany.tech\/index.php?\/api\/v2\" } <\/code><\/pre>\n<p>\u0418 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 <code>enum class<\/code> \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0443 \u0441\u0435\u0431\u044f \u0432 TMS.<\/p>\n<pre><code class=\"kotlin\">\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 enum \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432 \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441\u0430 enum class TestCaseStatus(val id: Int) {     PASSED(1), FAILED(2) }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u043b\u043e \u0437\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439. \u0418 \u0442\u0443\u0442 \u0434\u0432\u0430 \u043f\u0443\u0442\u0438 &#8212; \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0443\u044e\u0441\u044f <em>(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 TMSLink \u0432 Allure)<\/em>. \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438 \u043f\u0438\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0440\u0430\u0437\u0443 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 TestRail API, \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0432 <em>rails.yourcompany.tech<\/em> &#8212; \u043d\u0430 \u0441\u0432\u043e\u0439 \u0434\u043e\u043c\u0435\u043d.<\/p>\n<p>\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f TMSLink &#8212; \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441\u044b \u0432 TMS (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 TestRail). \u0427\u0442\u043e\u0431\u044b \u0441\u0441\u044b\u043b\u043a\u0430 \u0432 Allure \u043e\u0442\u0447\u0435\u0442\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430, \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b <code>allure.properties<\/code> \u0432 resources \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043c:<\/p>\n<pre><code>allure.link.tms.pattern=https:\/\/youcompany.tech\/projects\/777\/tests\/{}<\/code><\/pre>\n<p>&#8230;\u0433\u0434\u0435 <code>https:\/\/youcompany.tech\/projects\/777\/tests\/<\/code> &#8212; \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441, \u0430 <code>{}<\/code> &#8212; \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u043e\u043c\u0435\u0440 \u043a\u0435\u0439\u0441\u0430 \u0432 TMS-\u043a\u0435.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043b\u0430\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a LifeCycle Callbacks. Junit 5 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0435\u0433\u043e \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c: \u043e\u0442 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <em>TestInstancePostProcessor<\/em> \u0438 <em>ParameterResolver<\/em> \u0434\u043e \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441 <em>ExecutionCondition<\/em> \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0441 <em>TestExecutionExceptionHandler<\/em>. \u041d\u043e \u043d\u0430\u043c \u043f\u043e\u043a\u0430 \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f &#8212; <em>\u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430:<\/em><\/p>\n<ul>\n<li>\n<p><em>BeforeAllCallback<\/em> \u0438 <em>AfterAllCallback<\/em> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><em>BeforeEachCallBack \u0438 AfterEachCallback<\/em> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p><em>BeforeTestExecutionCallback \u0438 AfterTestExecutionCallback<\/em> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043e \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435 BeforeEachCallBack \u0438 AfterEachCallback \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 <em>AfterEachCallback<\/em>, \u043d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0438-\u0434\u0436\u0435\u0434\u0430\u0438 \u0434\u043e\u0431\u0430\u0432\u044f\u0442 \u0432 \u043a\u043b\u0430\u0441\u0441 \u043c\u0435\u0442\u043e\u0434 \u0441 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 <code>@AfterEach<\/code>? \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0430\u0444\u0444\u0435\u043a\u0442\u0438\u0442\u044c \u043a\u043e\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043c\u0435\u043b\u043e \u0431\u0435\u0440\u0435\u043c &#8212; <em>AfterTestExecutionCallback<\/em><\/p>\n<pre><code class=\"kotlin\">class TestRailExtension : AfterTestExecutionCallback {     private val testRailHost = \"https:\/\/rails.yourcompany.tech\/index.php?\/api\/v2\"     private val setOfCases = HashMap&lt;String, Int>()         override fun afterTestExecution(context: ExtensionContext) {         val annotation: TmsLink? = context.element.get().getAnnotation(TmsLink::class.java)         val caseStatus = when (!context.executionException.isPresent) {             true -> TestCaseStatus.PASSED.id             else -> TestCaseStatus.FAILED.id         }         annotation?.let { setOfCases[it.value] = caseStatus }     } }<\/code><\/pre>\n<p>&#8230;\u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <code>afterTestExecution<\/code>. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e &#171;\u0445\u044d\u0448\u043c\u0430\u043f\u0443&#187; \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <em>&#171;\u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435&#187;<\/em>, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; <em>&#171;\u043d\u043e\u043c\u0435\u0440 \u043a\u0435\u0439\u0441\u0430 &#8212; \u0441\u0442\u0430\u0442\u0443\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f&#187;<\/em>. \u0415\u0449\u0435 \u0445\u044d\u0448\u043c\u0430\u043f\u0430 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0442\u043e \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0442\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u0430 \u043d\u0430\u043c \u0432\u0435\u0434\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u0435\u0439\u0441\u0430?..<\/p>\n<p>\u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@TMSLink<\/code> \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0438 \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0435\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u0432\u0435\u0440\u043d\u0435\u0442 &#8212; <code>context.executionException.isPresent<\/code>. \u0412\u043e\u043e\u0431\u0449\u0435, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 ExecutionContext \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e, \u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u043e\u0442 <em>AfterAllCallback<\/em> \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <code>afterAll<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>AfterTestExecutionCallback \u0438 AfterAllCallback <\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class TestRailExtension : AfterTestExecutionCallback, AfterAllCallback {  private val testRailHost = \"https:\/\/rails.yourcompany.tech\/index.php?\/api\/v2\" private val setOfCases = HashMap&lt;String, Int>() private var testRunID = 91  override fun afterTestExecution(context: ExtensionContext) {     val annotation: TmsLink? = context.element.get().getAnnotation(TmsLink::class.java)     val caseStatus = when (!context.executionException.isPresent) {         true -> TestCaseStatus.PASSED.id         else -> TestCaseStatus.FAILED.id     }     annotation?.let { setOfCases[it.value] = caseStatus } }  private fun setCaseStatus(caseStatus: Int, caseId: String) {     RestAssured.given()         .auth().preemptive().basic(\"YOUR_EMAIL\", \"YOUR_PASSWORD\")         .contentType(ContentType.JSON)         .body(hashMapOf(\"status_id\" to caseStatus))         .post(\"$testRailHost\/add_result_for_case\/$testRunID\/$caseId\") }  override fun afterAll(context: ExtensionContext?) {     setOfCases.forEach { (caseId, caseStatus) ->         setCaseStatus(caseStatus, caseId)         }     }      }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, <code>testRunID<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0437\u0430\u0439\u0434\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0441\u0430\u043c TestRun, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u043b\u0435\u0432\u043e\u043c \u0443\u0433\u043b\u0443, \u0442\u0430\u043a\u0436\u0435 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0432 &#171;\u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c chrome devtools&#187; \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0432 \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u0435\u0439\u0441\u0430 \u0432 \u0442\u0435\u0441\u0442-\u0440\u0430\u043d\u0435. <code>Project ID<\/code> &#8212; \u0431\u0435\u0440\u0435\u043c \u0442\u0430\u043c \u0436\u0435.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>TMS TestRail<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0434\u0438 &#171;\u043d\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c&#187; \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u043d\u0430\u0432\u0435\u0448\u0438\u0432\u0430\u0435\u043c \u043d\u0430\u0434 \u043e\u043d\u044b\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@ExtendWith(TestRailExtension::class)<\/code>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/p>\n<pre><code class=\"kotlin\">@ExtendWith(TestRailExtension::class) class HabrDemo {          @Test     @TmsLink(\"1595\")     fun `demo test one`() = assertTrue(true) } <\/code><\/pre>\n<p>\u0421\u0442\u0430\u0440\u0442\u0443\u0435\u043c. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0443 \u043a\u0435\u0439\u0441\u0430. \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434. \u0420\u0430\u0434\u0443\u0435\u043c\u0441\u044f, \u043d\u043e \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u0434\u043e\u043b\u0433\u043e. \u0422\u0438\u043c\u043b\u0438\u0434 \u044f\u0432\u043d\u043e \u043d\u0435 \u0434\u043e\u0432\u043e\u043b\u0435\u043d, \u0438\u0431\u043e \u0436\u0435\u043b\u0430\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 TestRun \u0432 TestRails.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0442\u044c TestRun &#8212; \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f BeforeAllCallback. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0442\u0440\u0438\u0445\u043e\u0432, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u0435\u0442\u043e\u0434\u044b <code>createTestRun<\/code> \u0438 <code>beforeAll<\/code> \u0438 \u0432\u044b\u0434\u0430\u0435\u043c \u043d\u0430-\u0433\u043e\u0440\u0430 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<details class=\"spoiler\">\n<summary>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"kotlin\">class TestRailExtension : AfterTestExecutionCallback, AfterAllCallback, BeforeAllCallback {   private val testRailHost = \"https:\/\/rails.yourcompany.tech\/index.php?\/api\/v2\"   private val setOfCases = HashMap&lt;String, Int>()   private var testRunID = 91   private val projectId = 2   private val localDatetime = LocalDateTime.now()     .format(DateTimeFormatter.ofPattern(\"dd-MM-yyyy HH:mm\"))  override fun afterTestExecution(context: ExtensionContext) {     val annotation: TmsLink? = context.element.get().getAnnotation(TmsLink::class.java)     val caseStatus = when (!context.executionException.isPresent) {         true -> TestCaseStatus.PASSED.id         else -> TestCaseStatus.FAILED.id     }     annotation?.let { setOfCases[it.value] = caseStatus } }  private fun setCaseStatus(caseStatus: Int, caseId: String) {     RestAssured.given()         .auth().preemptive().basic(\"YOUR_EMAIL\", \"YOUR_PASSWORD\")         .contentType(ContentType.JSON)         .body(hashMapOf(\"status_id\" to caseStatus))         .post(\"$testRailHost\/add_result_for_case\/$testRunID\/$caseId\") }  private fun createTestRun(projectId: Int, testCases: List&lt;Int>): Int {      val requestBody = hashMapOf(<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-359990","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/359990","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=359990"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/359990\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=359990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=359990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=359990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}