{"id":330379,"date":"2022-03-06T21:00:24","date_gmt":"2022-03-06T21:00:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=330379"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=330379","title":{"rendered":"<span>Unit \u0442\u0435\u0441\u0442\u044b \u0432 Swift (\u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435)<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u0438 \u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u0440\u0438\u0448\u043b\u0438 \u043a \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0430 \u044d\u0442\u043e \u0437\u0430\u043b\u043e\u0433 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u0438 \u0437\u0430\u0431\u043e\u0442\u0430 \u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u0432\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/strong><\/p>\n<p>\u2013\u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u0435\u0441\u0442\u044b<br \/>\u2013\u043a\u0430\u043a\u0438\u0435 \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0435\u0441\u0442\u044b<br \/>\u2013\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442<br \/>\u2013\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<br \/>\u2013\u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<br \/>\u2013\u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432<br \/>\u2013\u043f\u0438\u0448\u0438\u043c \u0442\u0435\u0441\u0442\u044b<br \/>\u2013\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<br \/>\u2013\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/p>\n<h2>\u0418 \u0432\u0441\u0451 \u0436\u0435, \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u0435\u0441\u0442\u044b?<\/h2>\n<p>\u041e\u043f\u0438\u0448\u0443 \u0441\u0430\u043c\u044b\u0435, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0432\u0430\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b:<\/p>\n<p>\u2013\u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432\u044b \u043f\u0440\u043e\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0442\u0435 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u0430\u0439\u0442\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u00ab\u043f\u0440\u043e\u0434\u0435\u00bb. \u041a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440: \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438, \u0442\u043e \u0432\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u0443, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0438\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u0430\u043c\u0438\u00a0<\/p>\n<p>\u2013\u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 (\u043b\u0438\u0431\u043e \u0432\u044b \u0432\u0435\u0440\u043d\u0443\u043b\u0438\u0441\u044c \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438) \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e\u00a0 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0442\u0430\u0440\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e \u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e<\/p>\n<p>\u2013\u043d\u0443 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u044d\u0442\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439, \u0430 \u0430\u043c\u0431\u0438\u0446\u0438\u043e\u0437\u043d\u044b\u0439 \u0438 \u0441 \u0434\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u044b\u043c\u0438 \u043f\u043b\u0430\u043d\u0430\u043c\u0438<\/p>\n<h2>\u041a\u0430\u043a\u0438\u0435 \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0435\u0441\u0442\u044b?<\/h2>\n<p>\u0422\u0435\u0441\u0442\u044b \u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0442\u0440\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438:<\/p>\n<p><strong>Unit test<\/strong> (\u041c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435) &#8212; \u044d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0442\u0435\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u0443\u0441\u043a\u0430 \u043a\u043e\u0434\u0430 (\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430)<\/p>\n<p><strong>Integration test<\/strong> (\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435) &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. \u0412 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 API.<\/p>\n<p><strong>UI test<\/strong> (\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430) &#8212; \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043e\u043b\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u0448\u0438\u0440\u043d\u0430\u044f \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0442\u043e \u0437\u0434\u0435\u0441\u044c \u044f \u0437\u0430\u0442\u0440\u043e\u043d\u0443 \u0442\u043e\u043b\u044c\u043a\u043e Unit \u0442\u0435\u0441\u0442\u044b.<br \/> P.S. \u0421\u0442\u0430\u0442\u044c\u0438 \u043f\u043e <em>\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/em> \u0438 <em>\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/em> \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0439.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c!<\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Unit \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442<\/h2>\n<p>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0435 \u0433\u0430\u043b\u043e\u0447\u043a\u0430\u043c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043e\u043d\u0438 (\u0432 \u0432\u0438\u0434\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432) \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u0430\u043c\u0438<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/8ae\/026\/fe0\/8ae026fe039ecb04696d43fd78217734.jpeg\" width=\"1684\" height=\"1264\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8ae\/026\/fe0\/8ae026fe039ecb04696d43fd78217734.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435, \u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0431\u0435\u0437 \u0442\u0435\u0441\u0442\u043e\u0432, \u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043c\u0435\u043d\u044e \u0447\u0435\u0440\u0435\u0437 \u00ab<strong>File<\/strong> -> <strong>New<\/strong> -> <strong>Target<\/strong>\u2026\u00bb \u0433\u0434\u0435 \u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u00ab<strong>Unit Test Bundle<\/strong>\u00bb \u0438 \u0434\u043e\u0431\u0430\u0432\u044f\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/d0e\/dd5\/634\/d0edd5634d2e66b3ac9c113d7559e7e6.jpeg\" width=\"1684\" height=\"1264\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d0e\/dd5\/634\/d0edd5634d2e66b3ac9c113d7559e7e6.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432 \u043d\u0430\u0432\u0438\u0433\u0430\u0442\u043e\u0440\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432 (\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d)<\/p>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/411\/65e\/718\/41165e718795a9a81f7d928f3b7eaf5b.png\" width=\"538\" height=\"620\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/411\/65e\/718\/41165e718795a9a81f7d928f3b7eaf5b.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0442\u0435\u0441\u0442\u0430\u043c\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u043c\u0443 \u0442\u0430\u0440\u0433\u0435\u0442 (\u0446\u0435\u043b\u044c) \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<br \/> \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u00ab<strong>@testable import UnitTestExample<\/strong>\u00bb (<strong>UnitTestExample<\/strong> &#8212; \u044d\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430)<\/p>\n<pre><code class=\"swift\">import XCTest @testable import UnitTestExample  class UnitTestExampleTests: XCTestCase {      override func setUpWithError() throws {         \/\/ Put setup code here. This method is called before the invocation of each test method in the class.     }      override func tearDownWithError() throws {         \/\/ Put teardown code here. This method is called after the invocation of each test method in the class.     }      func testExample() throws {         \/\/ This is an example of a functional test case.         \/\/ Use XCTAssert and related functions to verify your tests produce the correct results.         \/\/ Any test you write for XCTest can be annotated as throws and async.         \/\/ Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.         \/\/ Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.     }      func testPerformanceExample() throws {         \/\/ This is an example of a performance test case.         measure {             \/\/ Put the code you want to measure the time of here.         }     } } <\/code><\/pre>\n<p><strong>setUp()<\/strong> &#8212; \u043c\u0435\u0442\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<br \/><strong>tearDown()<\/strong> &#8212; \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u0430 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0442\u044b\u00a0<\/p>\n<p>\u0421\u043b\u0435\u0434\u043e\u043c \u0437\u0430 \u043d\u0438\u043c\u0438 \u0438\u0434\u0443\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0438 \u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p><strong>testExample()<\/strong> &#8212; \u043c\u0435\u0442\u043e\u0434 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430<br \/><strong>testPerformanceExample()<\/strong> &#8212; \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0432 \u043d\u0451\u043c \u043a\u043e\u0434\u0430<\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a <s>\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0441\u0435 \u0442\u044f\u0436\u043a\u0438\u0435<\/s> \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0418\u043c \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a\u043b\u0430\u0441 <strong>Coffee<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b (\u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b):<\/p>\n<pre><code class=\"swift\">class Coffee {     \/\/ \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430 \u0442\u0435\u0441\u0442\u0430\u0445     var water = 0     var milk = 0     var groundCoffee = 0     var sugar = 0     var status = false          \/\/ \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u043e     private func americano() {         water += 1         groundCoffee += 1         status = true     }          \/\/ \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u043f\u0443\u0447\u0438\u043d\u043e     private func cappuccino() {         water += 1         groundCoffee += 1         milk += 1         status = true     }          \/\/ \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043a\u043e\u0444\u0435 \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u0430\u0445\u0430\u0440\u0430 (\u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e =))     func makeCoffee(coffee: TypesOfCoffee, sugar: Int) {         switch coffee {         case .americano:             americano()         case .cappuccino:             cappuccino()         }                  self.sugar += sugar     } }<\/code><\/pre>\n<p>\u0412 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u043e\u0434\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0437\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0444\u0435. (\u0432\u0441\u0451 \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u0432 \u043a\u043e\u0434\u0435)<\/p>\n<h2>\u041f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0438\u043c\u0435\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u043e\u0432! \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c, \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043e\u043f\u0438\u0448\u0443 \u0438\u0445 \u043d\u0438\u0436\u0435:<\/p>\n<p><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/boolean_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssert<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0441\u0442\u0438\u043d\u043d\u043e<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/nil_and_non-nil_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertNil<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f nil<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/nil_and_non-nil_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertNotNil<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f nil<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/nil_and_non-nil_assertions\" rel=\"noopener noreferrer nofollow\">XCTUnwrap<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Nil, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/equality_and_inequality_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertEqual<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0432\u043d\u044b<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/equality_and_inequality_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertNotEqual<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0440\u0430\u0432\u043d\u044b<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/equality_and_inequality_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertIdentical<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/equality_and_inequality_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertNotIdentical<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/comparable_value_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertGreaterThan<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/comparable_value_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertGreaterThanOrEqual<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/comparable_value_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertLessThanOrEqual<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/comparable_value_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertLessThan<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044c\u0448\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/error_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertThrowsError<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/error_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertNoThrow<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/unconditional_test_failures\" rel=\"noopener noreferrer nofollow\">XCTFail<\/a> &#8212; \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0439 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/methods_for_skipping_tests\" rel=\"noopener noreferrer nofollow\">XCTSkip<\/a> &#8212; \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a \u0442\u0435\u0441\u0442\u0430<\/p>\n<h2>\u041f\u0438\u0448\u0435\u043c \u0442\u0435\u0441\u0442\u044b<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0439 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0430\u0448 \u0442\u0435\u0441\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0438\u043d\u043e\u043c\u0443 \u0438\u0442\u043e\u0433\u0443. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u0434 \u043d\u0438\u0436\u0435 \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043d\u0430 \u043f\u0440\u0435\u043c\u0435\u0440\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<pre><code class=\"swift\">import XCTest @testable import UnitTestExample  class UnitTestExampleTests: XCTestCase {          \/\/ \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0442\u0435\u0441\u0442\u0430\u0445     var coffee: Coffee!      override func setUpWithError() throws {         try super.setUpWithError()         \/\/ \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432, \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u0430\u0441\u0430, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c         coffee = Coffee()     }      override func tearDownWithError() throws {         \/\/ \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430, \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432         coffee = nil         try super.tearDownWithError()     }      \/\/ \u043c\u0435\u0442\u043e\u0434 \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430     func testExample() throws {                  let sugar = 2                  \/\/ \"\u0433\u043e\u0442\u043e\u0432\u0438\u043c\" \u0434\u0432\u0435 \u043a\u0440\u0443\u0436\u043a\u0438 \u043a\u043e\u0444\u0435, \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u043e \u0438 \u043a\u0430\u043f\u0443\u0447\u0438\u043d\u043e, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u043e\u0441\u0442\u0430\u0432 \u0438\u043d\u0433\u0440\u0438\u0434\u0438\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u043a\u043b\u0430\u0441\u0430 Coffee         coffee.makeCoffee(coffee: .cappuccino, sugar: sugar)         coffee.makeCoffee(coffee: .americano, sugar: 0)                  \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438. \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0451\u0442 \u0435\u0441\u043b\u0438 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 true         XCTAssert(coffee.status, \"\u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0444\u0435\")                  \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0433\u0440\u0438\u0434\u0438\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0432\u0443\u0445 \u043a\u0440\u0443\u0436\u0435\u043a \u043a\u043e\u0444\u0435         \/\/ \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u043e\u043b\u043e\u043a\u0430, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u043b\u043e\u043a\u0430 \u0441 \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0437\u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f         XCTAssertEqual(coffee.milk, 1, \"\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u043b\u043e\u043a\u0430\")         XCTAssertEqual(coffee.water, 2, \"\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u0434\u044b\")         XCTAssertEqual(coffee.groundCoffee, 2, \"\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u043b\u043e\u0442\u043e\u0433\u043e \u043a\u043e\u0444\u0435\")         XCTAssertEqual(coffee.sugar, 2, \"\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0430\u0445\u0430\u0440\u0430\")      }      \/\/ \u043c\u0435\u0442\u043e\u0434 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u043a\u043e\u0434\u0430     func testPerformanceExample() throws {                  let sugar = 2                  measure {             coffee.makeCoffee(coffee: .cappuccino, sugar: sugar)         }     } }<\/code><\/pre>\n<p><strong><em>**<\/em><\/strong><em> \u041f\u0440\u043e\u0448\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0441 \u0441 test<\/em><strong><em>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u041c\u0435\u0442\u043e\u0434\u0430<\/em><\/strong><em> , \u0438\u043d\u0430\u0447\u0435 \u043e\u043d\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043a\u0430\u043a \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435<\/em><\/p>\n<p>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b \u0432 \u043a\u043e\u0434\u0435 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043e \u043c\u0435\u0442\u043e\u0434\u0435 testPerformanceExample():<\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043d\u0430\u0432\u0435\u0440\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0431\u043b\u043e\u043a <strong>measure <\/strong>\u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<br \/>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439, \u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"swift\">func testPerformanceExample() throws {                  let sugar = 2                  measure(             metrics: [               XCTClockMetric(),               XCTCPUMetric(),               XCTStorageMetric(),               XCTMemoryMetric()             ]           ) {             coffee.makeCoffee(coffee: .cappuccino, sugar: sugar)         }     }<\/code><\/pre>\n<p><strong>XCTClockMetric()<\/strong> &#8212; \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0441\u044f \u0442\u0435\u0441\u0442<br \/><strong>XCTCPUMetric()<\/strong> &#8212; \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 CPU (\u0432\u0440\u0435\u043c\u044f, \u0446\u0438\u043a\u043b\u044b, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439)<br \/><strong>XCTStorageMetric()<\/strong> &#8212; \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0451\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u043a\u043e\u0434\u0430<br \/><strong>XCTMemoryMetric()<\/strong> &#8212; \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/p>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0437\u0430\u043f\u0443\u0441\u043a\u0430:<\/p>\n<p>1.\u0427\u0435\u0440\u0435\u0437 \u043c\u0435\u043d\u044e <strong>Product<\/strong> -> <strong>Test<\/strong> (\u0447\u0442\u043e \u0437\u0430\u043f\u043a\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0441\u0442\u044b)<br \/>2.\u0427\u0435\u0440\u0435\u0437 \u0433\u043e\u0440\u044f\u0447\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 <strong>Command + U<\/strong> (\u0447\u0442\u043e \u0442\u0430\u043a \u0436\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0441\u0442\u044b)<br \/>3.\u041b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043c\u0435\u043d\u044e, \u043d\u0430\u0436\u0430\u0432 \u043d\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0440\u043e\u043c\u0431\u0438\u043a\u0438, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u0430\u043a \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u0440\u0430\u0437\u043e\u043c, \u0442\u0430\u043a \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/02e\/23c\/5ab\/02e23c5abc9d47460865bf0839dcb491.png\" width=\"1634\" height=\"392\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/02e\/23c\/5ab\/02e23c5abc9d47460865bf0839dcb491.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0432\u0441\u0435 \u0440\u043e\u043c\u0431\u0438\u043a\u0438 \u0437\u0430\u043a\u0440\u0430\u0441\u044f\u0442\u0441\u044f \u0437\u0435\u043b\u0451\u043d\u044b\u043c.<\/p>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/h2>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c, \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u043d\u043e \u0432\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u0434 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0414\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0439\u0442\u0438 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0441\u0445\u0435\u043c\u044b \u0442\u0435\u0441\u0442\u043e\u0432<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/379\/403\/6a0\/3794036a0bd616192c344e0b9e3e41a6.png\" width=\"1622\" height=\"684\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/379\/403\/6a0\/3794036a0bd616192c344e0b9e3e41a6.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0433\u0430\u043b\u043e\u0447\u043a\u0443 \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 \u00abCode Coverage\u00bb<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/88d\/ecf\/fe6\/88decffe6336f25414039679ed8a0edb.png\" width=\"2090\" height=\"1232\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/88d\/ecf\/fe6\/88decffe6336f25414039679ed8a0edb.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0447\u0435\u0440\u0435\u0437 \u0433\u043e\u0440\u044f\u0447\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 Command + U \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u0432 \u043e\u0442\u0447\u0451\u0442\u044b \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0432 \u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 % \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<p>\u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/55b\/dff\/bdf\/55bdffbdf1ce16de564cdfba5a6a0b1b.png\" width=\"1912\" height=\"594\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/55b\/dff\/bdf\/55bdffbdf1ce16de564cdfba5a6a0b1b.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u044f \u0432 \u0444\u0430\u0439\u043b \u0438 \u043d\u0430\u0432\u0435\u0434\u044f \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u043e\u043d\u0430 \u0437\u0430\u043a\u0440\u0430\u0441\u0438\u0442\u0441\u044f \u0437\u0435\u043b\u0451\u043d\u044b\u043c (\u0435\u0441\u043b\u0438 \u043a\u043e\u0434 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u0430\u043c\u0438) \u0438\u043b\u0438 \u043a\u0440\u0430\u0441\u043d\u044b\u043c (\u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0fe\/d48\/f9a\/0fed48f9a25f557bca523d1a02ec8e63.png\" width=\"2420\" height=\"868\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0fe\/d48\/f9a\/0fed48f9a25f557bca523d1a02ec8e63.png\"\/><figcaption><\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/654591\/\"> https:\/\/habr.com\/ru\/post\/654591\/<\/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_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u0438 \u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u0440\u0438\u0448\u043b\u0438 \u043a \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0430 \u044d\u0442\u043e \u0437\u0430\u043b\u043e\u0433 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u0438 \u0437\u0430\u0431\u043e\u0442\u0430 \u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u0432\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/strong><\/p>\n<p>\u2013\u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u0435\u0441\u0442\u044b<br \/>\u2013\u043a\u0430\u043a\u0438\u0435 \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0435\u0441\u0442\u044b<br \/>\u2013\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442<br \/>\u2013\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<br \/>\u2013\u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<br \/>\u2013\u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432<br \/>\u2013\u043f\u0438\u0448\u0438\u043c \u0442\u0435\u0441\u0442\u044b<br \/>\u2013\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<br \/>\u2013\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/p>\n<h2>\u0418 \u0432\u0441\u0451 \u0436\u0435, \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u0435\u0441\u0442\u044b?<\/h2>\n<p>\u041e\u043f\u0438\u0448\u0443 \u0441\u0430\u043c\u044b\u0435, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0432\u0430\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b:<\/p>\n<p>\u2013\u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432\u044b \u043f\u0440\u043e\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0442\u0435 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u0430\u0439\u0442\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u00ab\u043f\u0440\u043e\u0434\u0435\u00bb. \u041a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440: \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438, \u0442\u043e \u0432\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u0443, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0438\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u0430\u043c\u0438\u00a0<\/p>\n<p>\u2013\u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 (\u043b\u0438\u0431\u043e \u0432\u044b \u0432\u0435\u0440\u043d\u0443\u043b\u0438\u0441\u044c \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438) \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e\u00a0 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0442\u0430\u0440\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e \u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e<\/p>\n<p>\u2013\u043d\u0443 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u044d\u0442\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439, \u0430 \u0430\u043c\u0431\u0438\u0446\u0438\u043e\u0437\u043d\u044b\u0439 \u0438 \u0441 \u0434\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u044b\u043c\u0438 \u043f\u043b\u0430\u043d\u0430\u043c\u0438<\/p>\n<h2>\u041a\u0430\u043a\u0438\u0435 \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0435\u0441\u0442\u044b?<\/h2>\n<p>\u0422\u0435\u0441\u0442\u044b \u043f\u043e\u0434\u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0442\u0440\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438:<\/p>\n<p><strong>Unit test<\/strong> (\u041c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435) &#8212; \u044d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0442\u0435\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u0443\u0441\u043a\u0430 \u043a\u043e\u0434\u0430 (\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430)<\/p>\n<p><strong>Integration test<\/strong> (\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435) &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. \u0412 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 API.<\/p>\n<p><strong>UI test<\/strong> (\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430) &#8212; \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043e\u043b\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u0448\u0438\u0440\u043d\u0430\u044f \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0442\u043e \u0437\u0434\u0435\u0441\u044c \u044f \u0437\u0430\u0442\u0440\u043e\u043d\u0443 \u0442\u043e\u043b\u044c\u043a\u043e Unit \u0442\u0435\u0441\u0442\u044b.<br \/> P.S. \u0421\u0442\u0430\u0442\u044c\u0438 \u043f\u043e <em>\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/em> \u0438 <em>\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/em> \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0439.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c!<\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Unit \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442<\/h2>\n<p>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0435 \u0433\u0430\u043b\u043e\u0447\u043a\u0430\u043c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043e\u043d\u0438 (\u0432 \u0432\u0438\u0434\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432) \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u0430\u043c\u0438<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435, \u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0431\u0435\u0437 \u0442\u0435\u0441\u0442\u043e\u0432, \u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043c\u0435\u043d\u044e \u0447\u0435\u0440\u0435\u0437 \u00ab<strong>File<\/strong> -> <strong>New<\/strong> -> <strong>Target<\/strong>\u2026\u00bb \u0433\u0434\u0435 \u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u00ab<strong>Unit Test Bundle<\/strong>\u00bb \u0438 \u0434\u043e\u0431\u0430\u0432\u044f\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432 \u043d\u0430\u0432\u0438\u0433\u0430\u0442\u043e\u0440\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432 (\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d)<\/p>\n<figure class=\"bordered full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0442\u0435\u0441\u0442\u0430\u043c\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u043c\u0443 \u0442\u0430\u0440\u0433\u0435\u0442 (\u0446\u0435\u043b\u044c) \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<br \/> \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u00ab<strong>@testable import UnitTestExample<\/strong>\u00bb (<strong>UnitTestExample<\/strong> &#8212; \u044d\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430)<\/p>\n<pre><code class=\"swift\">import XCTest @testable import UnitTestExample  class UnitTestExampleTests: XCTestCase {      override func setUpWithError() throws {         \/\/ Put setup code here. This method is called before the invocation of each test method in the class.     }      override func tearDownWithError() throws {         \/\/ Put teardown code here. This method is called after the invocation of each test method in the class.     }      func testExample() throws {         \/\/ This is an example of a functional test case.         \/\/ Use XCTAssert and related functions to verify your tests produce the correct results.         \/\/ Any test you write for XCTest can be annotated as throws and async.         \/\/ Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.         \/\/ Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.     }      func testPerformanceExample() throws {         \/\/ This is an example of a performance test case.         measure {             \/\/ Put the code you want to measure the time of here.         }     } } <\/code><\/pre>\n<p><strong>setUp()<\/strong> &#8212; \u043c\u0435\u0442\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<br \/><strong>tearDown()<\/strong> &#8212; \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u0430 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0442\u044b\u00a0<\/p>\n<p>\u0421\u043b\u0435\u0434\u043e\u043c \u0437\u0430 \u043d\u0438\u043c\u0438 \u0438\u0434\u0443\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0438 \u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p><strong>testExample()<\/strong> &#8212; \u043c\u0435\u0442\u043e\u0434 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430<br \/><strong>testPerformanceExample()<\/strong> &#8212; \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0432 \u043d\u0451\u043c \u043a\u043e\u0434\u0430<\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a <s>\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0441\u0435 \u0442\u044f\u0436\u043a\u0438\u0435<\/s> \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0418\u043c \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a\u043b\u0430\u0441 <strong>Coffee<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b (\u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b):<\/p>\n<pre><code class=\"swift\">class Coffee {     \/\/ \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430 \u0442\u0435\u0441\u0442\u0430\u0445     var water = 0     var milk = 0     var groundCoffee = 0     var sugar = 0     var status = false          \/\/ \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u043e     private func americano() {         water += 1         groundCoffee += 1         status = true     }          \/\/ \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u043f\u0443\u0447\u0438\u043d\u043e     private func cappuccino() {         water += 1         groundCoffee += 1         milk += 1         status = true     }          \/\/ \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043a\u043e\u0444\u0435 \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u0430\u0445\u0430\u0440\u0430 (\u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e =))     func makeCoffee(coffee: TypesOfCoffee, sugar: Int) {         switch coffee {         case .americano:             americano()         case .cappuccino:             cappuccino()         }                  self.sugar += sugar     } }<\/code><\/pre>\n<p>\u0412 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u043e\u0434\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0437\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0444\u0435. (\u0432\u0441\u0451 \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u0432 \u043a\u043e\u0434\u0435)<\/p>\n<h2>\u041f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0438\u043c\u0435\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0442\u0435\u0441\u0442\u043e\u0432! \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c, \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043e\u043f\u0438\u0448\u0443 \u0438\u0445 \u043d\u0438\u0436\u0435:<\/p>\n<p><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/boolean_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssert<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0441\u0442\u0438\u043d\u043d\u043e<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/nil_and_non-nil_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertNil<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f nil<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/nil_and_non-nil_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertNotNil<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f nil<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/nil_and_non-nil_assertions\" rel=\"noopener noreferrer nofollow\">XCTUnwrap<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Nil, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/equality_and_inequality_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertEqual<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0432\u043d\u044b<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/equality_and_inequality_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertNotEqual<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0440\u0430\u0432\u043d\u044b<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/equality_and_inequality_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertIdentical<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/equality_and_inequality_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertNotIdentical<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/comparable_value_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertGreaterThan<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/comparable_value_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertGreaterThanOrEqual<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/comparable_value_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertLessThanOrEqual<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/comparable_value_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertLessThan<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044c\u0448\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/error_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertThrowsError<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/error_assertions\" rel=\"noopener noreferrer nofollow\">XCTAssertNoThrow<\/a> &#8212; \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/unconditional_test_failures\" rel=\"noopener noreferrer nofollow\">XCTFail<\/a> &#8212; \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0439 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438<br \/><a href=\"http:\/\/developer.apple.com\/documentation\/xctest\/methods_for_skipping_tests\" rel=\"noopener noreferrer nofollow\">XCTSkip<\/a> &#8212; \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a \u0442\u0435\u0441\u0442\u0430<\/p>\n<h2>\u041f\u0438\u0448\u0435\u043c \u0442\u0435\u0441\u0442\u044b<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0439 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0430\u0448 \u0442\u0435\u0441\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043a \u0442\u043e\u043c\u0443 \u0438\u043b\u0438 \u0438\u043d\u043e\u043c\u0443 \u0438\u0442\u043e\u0433\u0443. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u0434 \u043d\u0438\u0436\u0435 \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043d\u0430 \u043f\u0440\u0435\u043c\u0435\u0440\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<pre><code class=\"swift\">import XCTest @testable import UnitTestExample  class UnitTestExampleTests: XCTestCase {          \/\/ \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0442\u0435\u0441\u0442\u0430\u0445     var coffee: Coffee!      override func setUpWithError() throws {         try super.setUpWithError()         \/\/ \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432, \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u0430\u0441\u0430, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c         coffee = Coffee()     }      override func tearDownWithError() throws {         \/\/ \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430, \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432         coffee = nil         try super.tearDownWithError()     }      \/\/ \u043c\u0435\u0442\u043e\u0434 \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430     func testExample() throws {                  let sugar = 2                  \/\/ \"\u0433\u043e\u0442\u043e\u0432\u0438\u043c\" \u0434\u0432\u0435 \u043a\u0440\u0443\u0436\u043a\u0438 \u043a\u043e\u0444\u0435, \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u043e \u0438 \u043a\u0430\u043f\u0443\u0447\u0438\u043d\u043e, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u043e\u0441\u0442\u0430\u0432 \u0438\u043d\u0433\u0440\u0438\u0434\u0438\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u043a\u043b\u0430\u0441\u0430 Coffee         coffee.makeCoffee(coffee: .cappuccino, sugar: sugar)         coffee.makeCoffee(coffee: .americano, sugar: 0)                  \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438. \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0451\u0442 \u0435\u0441\u043b\u0438 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 true         XCTAssert(coffee.status, \"\u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0444\u0435\")                  \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0433\u0440\u0438\u0434\u0438\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0432\u0443\u0445 \u043a\u0440\u0443\u0436\u0435\u043a \u043a\u043e\u0444\u0435         \/\/ \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u043e\u043b\u043e\u043a\u0430, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u043b\u043e\u043a\u0430 \u0441 \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0437\u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f         XCTAssertEqual(coffee.milk, 1, \"\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u043b\u043e\u043a\u0430\")         XCTAssertEqual(coffee.water, 2, \"\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u0434\u044b\")         XCTAssertEqual(coffee.groundCoffee, 2, \"\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u043b\u043e\u0442\u043e\u0433\u043e \u043a\u043e\u0444\u0435\")         XCTAssertEqual(coffee.sugar, 2, \"\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0430\u0445\u0430\u0440\u0430\")      }      \/\/ \u043c\u0435\u0442\u043e\u0434 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u043a\u043e\u0434\u0430     func testPerformanceExample() throws {                  let sugar = 2                  measure {             coffee.makeCoffee(coffee: .cappuccino, sugar: sugar)         }     } }<\/code><\/pre>\n<p><strong><em>**<\/em><\/strong><em> \u041f\u0440\u043e\u0448\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0441 \u0441 test<\/em><strong><em>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u041c\u0435\u0442\u043e\u0434\u0430<\/em><\/strong><em> , \u0438\u043d\u0430\u0447\u0435 \u043e\u043d\u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043a\u0430\u043a \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435<\/em><\/p>\n<p>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b \u0432 \u043a\u043e\u0434\u0435 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043e \u043c\u0435\u0442\u043e\u0434\u0435 testPerformanceExample():<\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043d\u0430\u0432\u0435\u0440\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0431\u043b\u043e\u043a <strong>measure <\/strong>\u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<br \/>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439, \u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"swift\">func testPerformanceExample() throws {                  let sugar = 2                  measure(             metrics: [               XCTClockMetric(),               XCTCPUMetric(),               XCTStorageMetric(),               XCTMemoryMetric()             ]           ) {             coffee.makeCoffee(coffee: .cappuccino, sugar: sugar)         }     }<\/code><\/pre>\n<p><strong>XCTClockMetric()<\/strong> &#8212; \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0441\u044f \u0442\u0435\u0441\u0442<br \/><strong>XCTCPUMetric()<\/strong> &#8212; \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 CPU (\u0432\u0440\u0435\u043c\u044f, \u0446\u0438\u043a\u043b\u044b, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439)<br \/><strong>XCTStorageMetric()<\/strong> &#8212;<\/p>\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-330379","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/330379","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=330379"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/330379\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=330379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=330379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=330379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}