{"id":329416,"date":"2022-02-11T09:00:32","date_gmt":"2022-02-11T09:00:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=329416"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=329416","title":{"rendered":"<span>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0438\u043b\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Elementary<\/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>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442, \u043d\u0430 \u0441\u0432\u044f\u0437\u0438 Surf. \u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u043a\u0435\u0442\u0430 Elementary \u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438, \u043a\u0430\u043a \u043e\u043d \u0443\u0441\u0442\u0440\u043e\u0435\u043d. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. <\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_konoshenko6\">Elementary: \u043d\u043e\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 Flutter-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_konoshenko7\">\u041a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d Elementary<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a\u0438\u0435 \u0432\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u044b\u0432\u0430\u044e\u0442, \u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Elementary.<\/p>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_testing\"><u>pub.dev<\/u><\/a>. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_testing1\"><u>GitHub<\/u><\/a>.<\/p>\n<h2>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432<\/h2>\n<p>\u0412 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0432\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u043e\u0432: Unit, Widget, Integration.<\/p>\n<p><strong>Unit-\u0442\u0435\u0441\u0442<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043c\u0435\u0442\u043e\u0434 \u0438\u043b\u0438 \u043a\u043b\u0430\u0441\u0441. \u0426\u0435\u043b\u044c \u2014 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445.<\/p>\n<p><strong>Widget-\u0442\u0435\u0441\u0442<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043e\u0434\u0438\u043d \u0432\u0438\u0434\u0436\u0435\u0442. \u0426\u0435\u043b\u044c \u2014 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438 \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f \u0442\u0430\u043a, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u044b: \u043e\u043d\u0430 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442.<\/p>\n<p><strong>Integration-\u0442\u0435\u0441\u0442<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u044c. \u0426\u0435\u043b\u044c \u2014 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e,\u00a0 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>Surf \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0442\u0438\u043f \u0442\u0435\u0441\u0442\u043e\u0432 \u2014 Golden. \u0412 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e \u043d\u0451\u043c \u043d\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u0430\u043a\u0435\u0442\u0443 <a href=\"https:\/\/go.surf.dev\/hr\/QA\/habr\/elementary_testing2\"><u>golden_toolkit<\/u><\/a> golden-\u0442\u0435\u0441\u0442\u044b \u0432\u043e Flutter \u0441\u0442\u0430\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b.\u00a0<\/p>\n<p><strong>Golden-\u0442\u0435\u0441\u0442<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0438 \u0446\u0435\u043b\u044b\u0439 \u044d\u043a\u0440\u0430\u043d. \u0412\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435  \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0442\u0435\u0441\u0442\u043e\u0432. <\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" alt=\"\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\" title=\"\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\" height=\"1602\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/94c\/27c\/b4a\/94c27cb4ab2458b4e8c5daea0f946968.png\" data-width=\"2522\"\/><figcaption>\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/figure>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c UI<\/h2>\n<p>\u041f\u043e\u043a\u0440\u043e\u0435\u043c \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0442\u0430\u0442\u044c\u0438 \u00ab<a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_konoshenko6\">Elementary: \u043d\u043e\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 Flutter-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/a>\u00bb. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 golden-\u0442\u0435\u0441\u0442\u043e\u0432. \u0418\u0445 \u043b\u0435\u0433\u043a\u043e \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u2014\u00a0 \u0435\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 IDEA, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 golden.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" height=\"1602\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/15e\/d4e\/087\/15ed4e08748429b967c5dab6c4cb8ffd.png\" data-width=\"2522\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e golden-\u0442\u0435\u0441\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 CLI \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<pre><code class=\"bash\">flutter test -- update-goldens<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 golden-\u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e: \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0442\u0435\u0441\u0442 flutter_test_config.dart.<\/p>\n<p>\u041a\u043e\u0434 \u043d\u0438\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0435\u0441\u0442\u0435 \u0438 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0448\u0440\u0438\u0444\u0442\u044b.<\/p>\n<pre><code class=\"dart\">Future&lt;void> testExecutable(FutureOr&lt;void> Function() testMain) async {  await loadAppFonts();  return testMain(); }<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0433\u043e\u043b\u0434\u0435\u043d\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0430\u0431\u043e\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439: \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c \u0442\u0435\u0441\u0442\u0430.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" height=\"1602\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6a8\/a25\/f1c\/6a8a25f1cf2620146d8b8ddd747e4893.png\" data-width=\"2522\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" height=\"1602\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9ad\/e03\/9dc\/9ade039dcb45a7f7b286e29a478858a3.png\" data-width=\"2522\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430 \u0441\u0447\u0451\u0442 \u043c\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041c\u0430\u0433\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0449\u0451 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f WM \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u043e\u043a\u0438\u0440\u0443\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0441\u0442. <\/p>\n<h4>\u0422\u0435\u0441\u0442 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 \u0433\u043e\u0440\u043e\u0434\u0430<\/h4>\n<pre><code class=\"dart\">void main() {   const selectAddressScreen = SelectAddressScreen();   final selectAddressWm = SelectAddressWMMock();    setUp(() {     when(() => selectAddressWm.predictions).thenAnswer(       (_) => ValueNotifier&lt;List&lt;Location>>([]),     );     when(() => selectAddressWm.searchFieldController).thenAnswer(       (_) => TextEditingController(),     );   });    testGoldens('select address screen default golden test', (tester) async {     await tester.pumpWidgetBuilder(selectAddressScreen.build(selectAddressWm));     await multiScreenGolden(tester, 'select_address_screen');   });    testGoldens('select address screen with data golden test', (tester) async {     when(() => selectAddressWm.predictions).thenAnswer(       (_) => ValueNotifier&lt;List&lt;Location>>(_locationMock),     );      await tester.pumpWidgetBuilder(selectAddressScreen.build(selectAddressWm));     await multiScreenGolden(tester, 'select_address_screen_data');   }); }<\/code><\/pre>\n<h4>\u0422\u0435\u0441\u0442 \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043f\u043e\u0433\u043e\u0434\u044b<\/h4>\n<pre><code class=\"dart\">void main() {   final wm = WeatherScreenWMMock();   const weatherScreen = WeatherScreen();    setUp(() {     when(() => wm.topPadding).thenReturn(16);      when(() => wm.currentWeather).thenReturn(       EntityStateNotifier.value(_mockWeathers),     );      when(() => wm.locationTitle).thenReturn(_locationMock.title);   });    testGoldens('weather details screen with data golden test', (tester) async {     await tester.pumpWidgetBuilder(weatherScreen.build(wm));     await multiScreenGolden(tester, 'weather_details_screen_data');   });    testGoldens('weather details screen with error golden test', (tester) async {     when(() => wm.currentWeather).thenReturn(       EntityStateNotifier.value([])..error(Exception()),     );      await tester.pumpWidgetBuilder(weatherScreen.build(wm));     await multiScreenGolden(tester, 'weather_details_screen_err');   }); }<\/code><\/pre>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c WidgetModel<\/h2>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f WidgetModel \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 Elementary \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_testing3\"><u>elementary_test<\/u><\/a>: \u043e\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>testWidgetModel \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430. \u041f\u0440\u0438 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 WidgetModel \u043e\u043d\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0435\u0441\u0442\u0435\u0440 \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0444\u0430\u0437\u0430\u043c\u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 WidgetModel, \u0430 BuildContext \u2014 \u0434\u043b\u044f \u0438\u0445 \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u0430 \u0441\u0442\u043e\u0438\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0433\u043e\u043b\u043e\u0432\u0435, \u0447\u0442\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432\u043e\u043a\u0440\u0443\u0433 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043c\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e.<\/p>\n<h4>\u0422\u0435\u0441\u0442 \u0432\u0438\u0434\u0436\u0435\u0442-\u043c\u043e\u0434\u0435\u043b\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 \u0433\u043e\u0440\u043e\u0434\u0430<\/h4>\n<pre><code class=\"dart\">void main() {   group('init select address screen wm', () {     final getIt = GetIt.instance;      setUp(() {       getIt.registerSingleton&lt;AppModel>(AppModel());     });      test('createSelectAddressWM', () {       expect(() => createSelectAddressWM(BuildContextMock()), returnsNormally);     });   });    group('select address screen wm testing', () {     late SelectAddressModelMock modelData;     late NavigationHelperMock navigatorStateMock;      SelectAddressWM setupWm() {       modelData = SelectAddressModelMock();       navigatorStateMock = NavigationHelperMock();        when(() => modelData.getCityPrediction(any()))           .thenAnswer((invocation) => Future.value());        registerFallbackValue(MaterialPageRoute&lt;void>(builder: (_) {         return const Center();       }));        return SelectAddressWM(modelData, navigatorStateMock);     }      testWidgetModel&lt;SelectAddressWM, SelectAddressScreen>(       'onTapLocation call onLocationSelected and navigate to next screen',       setupWm,       (wm, tester, context) async {         tester.init();         wm.onTapLocation(_locationMock);          verify(() => modelData.onLocationSelected(_locationMock));         verify(() => navigatorStateMock.push(context, any()));       },     );      testWidgetModel&lt;SelectAddressWM, SelectAddressScreen>(       'onTextChanged call getCityPrediction',       setupWm,       (wm, tester, context) async {         tester.init();          wm.searchFieldController.text = 'Test';         verify(() => modelData.getCityPrediction(any()));       },     );   }); }<\/code><\/pre>\n<h4>\u0422\u0435\u0441\u0442 \u0432\u0438\u0434\u0436\u0435\u0442-\u043c\u043e\u0434\u0435\u043b\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043f\u043e\u0433\u043e\u0434\u044b<\/h4>\n<pre><code class=\"dart\">void main() {   group('WeatherScreenWm init', () {     final getIt = GetIt.instance;      setUp(() {       getIt.registerSingleton&lt;AppModel>(AppModel());     });      test('createWeatherScreenWM', () {       expect(() => createWeatherScreenWM(BuildContextMock()), returnsNormally);     });   });    group('WeatherScreenWM', () {     final modelData = WeatherScreenModelMock();     final contextHelperMock = ContextHelperMock();      WeatherScreenWM setupWm() {       when(modelData.getWeather).thenAnswer((invocation) => Future.value([]));        return WeatherScreenWM(contextHelperMock, modelData);     }      testWidgetModel&lt;WeatherScreenWM, WeatherScreen>(       'getWeather called after init wm ',       setupWm,       (wm, tester, context) async {         tester.init();         verify(modelData.getWeather);       },     );      testWidgetModel&lt;WeatherScreenWM, WeatherScreen>(       'topPadding getter return padding',       setupWm,       (wm, tester, context) async {         tester.init();          when(           () => contextHelperMock.getMediaQuery(context),         ).thenReturn(const MediaQueryData());          expect(wm.topPadding, 16);       },     );      testWidgetModel&lt;WeatherScreenWM, WeatherScreen>(       'onRetryPressed call getWeather',       setupWm,       (wm, tester, context) async {         tester.init();         wm.onRetryPressed();         verify(modelData.getWeather);       },     );   }); }<\/code><\/pre>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c<\/h2>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c unit-\u0442\u0435\u0441\u0442\u044b. \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043c\u0430\u0442\u0447\u0435\u0440\u043e\u0432: same, isTrue, isFalse, returnsNormally \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<h4>\u0422\u0435\u0441\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 \u0433\u043e\u0440\u043e\u0434\u0430<\/h4>\n<pre><code class=\"dart\">void main() {   final addressServiceMock = AddressServiceMock();   late SelectAddressModel model;    setUp(() {     model = SelectAddressModel(addressServiceMock, AppModel());   });    test('init with empty list', () async {     when(() => addressServiceMock.getCityPredictions('')).thenAnswer(       (_) => Future.value([]),     );     expect(model.predictions.value, isEmpty);   });    test('getCityPrediction return empty list', () async {     when(() => addressServiceMock.getCityPredictions('Test')).thenAnswer(       (_) => Future.value(_locationMock),     );     await model.getCityPrediction('');     expect(model.predictions.value, isEmpty);   });    test('getCityPrediction return prediction list', () async {     await model.getCityPrediction('Test');     expect(model.predictions.value, same(_locationMock));   }); }<\/code><\/pre>\n<h4>\u0422\u0435\u0441\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043f\u043e\u0433\u043e\u0434\u044b<\/h4>\n<pre><code class=\"dart\">void main() {   late WeatherScreenModel wm;   final weatherServiceMock = WeatherServiceMock();    setUp(() {     wm = WeatherScreenModel(weatherServiceMock, _locationMock);   });    test('location getter return selected location', () {     expect(wm.location, same(_locationMock));   });    test('method getWeather return weather from weather service', () async {     when(() => weatherServiceMock.getWeather(any())).thenAnswer(       (invocation) => Future.value(_weatherMock),     );      expect(await wm.getWeather(), same(_weatherMock));   }); }<\/code><\/pre>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435<\/h2>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438.\u00a0<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\"> \u00a0flutter test --coverage --update-goldens<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c HTML-\u043e\u0442\u0447\u0451\u0442.\u00a0<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">genhtml coverage\/lcov.info -o coverage\/html<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0442\u0447\u0451\u0442.\u00a0<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">open coverage\/html<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0442\u0435\u0441\u0442\u0430\u043c\u0438. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043c\u0435\u0441\u0442\u0430, \u0435\u0449\u0451 \u043d\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u044b\u0435 \u0442\u0435\u0441\u0442\u0430\u043c\u0438. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0435\u0441\u043b\u0438 \u0432\u044b \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u0438\u0448\u0435\u0442\u0435 \u0442\u0435\u0441\u0442\u044b.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" height=\"1602\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f9d\/338\/d8c\/f9d338d8c94a6d227464da2119897b91.png\" data-width=\"2522\"\/><figcaption><\/figcaption><\/figure>\n<hr\/>\n<p>\u041c\u044b \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0443\u0432\u0438\u0434\u0435\u043b\u0438, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 Elementary, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435\u043c\u0438 \u0432\u0438\u0434\u0430\u043c\u0438 \u0442\u0435\u0441\u0442\u043e\u0432. \u042d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u043b\u043e\u0438 \u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_testing4\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/a><\/p>\n<\/li>\n<\/ul>\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\/company\/surfstudio\/blog\/650557\/\"> https:\/\/habr.com\/ru\/company\/surfstudio\/blog\/650557\/<\/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>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442, \u043d\u0430 \u0441\u0432\u044f\u0437\u0438 Surf. \u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u043a\u0435\u0442\u0430 Elementary \u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438, \u043a\u0430\u043a \u043e\u043d \u0443\u0441\u0442\u0440\u043e\u0435\u043d. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. <\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_konoshenko6\">Elementary: \u043d\u043e\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 Flutter-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_konoshenko7\">\u041a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d Elementary<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a\u0438\u0435 \u0432\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u044b\u0432\u0430\u044e\u0442, \u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Elementary.<\/p>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_testing\"><u>pub.dev<\/u><\/a>. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_testing1\"><u>GitHub<\/u><\/a>.<\/p>\n<h2>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432<\/h2>\n<p>\u0412 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0432\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u043e\u0432: Unit, Widget, Integration.<\/p>\n<p><strong>Unit-\u0442\u0435\u0441\u0442<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043c\u0435\u0442\u043e\u0434 \u0438\u043b\u0438 \u043a\u043b\u0430\u0441\u0441. \u0426\u0435\u043b\u044c \u2014 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445.<\/p>\n<p><strong>Widget-\u0442\u0435\u0441\u0442<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043e\u0434\u0438\u043d \u0432\u0438\u0434\u0436\u0435\u0442. \u0426\u0435\u043b\u044c \u2014 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438 \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f \u0442\u0430\u043a, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u044b: \u043e\u043d\u0430 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442.<\/p>\n<p><strong>Integration-\u0442\u0435\u0441\u0442<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u044c. \u0426\u0435\u043b\u044c \u2014 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e,\u00a0 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>Surf \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0442\u0438\u043f \u0442\u0435\u0441\u0442\u043e\u0432 \u2014 Golden. \u0412 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e \u043d\u0451\u043c \u043d\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u0430\u043a\u0435\u0442\u0443 <a href=\"https:\/\/go.surf.dev\/hr\/QA\/habr\/elementary_testing2\"><u>golden_toolkit<\/u><\/a> golden-\u0442\u0435\u0441\u0442\u044b \u0432\u043e Flutter \u0441\u0442\u0430\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b.\u00a0<\/p>\n<p><strong>Golden-\u0442\u0435\u0441\u0442<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0438 \u0446\u0435\u043b\u044b\u0439 \u044d\u043a\u0440\u0430\u043d. \u0412\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435  \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0442\u0435\u0441\u0442\u043e\u0432. <\/p>\n<figure class=\"full-width\"><figcaption>\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/figure>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c UI<\/h2>\n<p>\u041f\u043e\u043a\u0440\u043e\u0435\u043c \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0442\u0430\u0442\u044c\u0438 \u00ab<a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_konoshenko6\">Elementary: \u043d\u043e\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 Flutter-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/a>\u00bb. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 golden-\u0442\u0435\u0441\u0442\u043e\u0432. \u0418\u0445 \u043b\u0435\u0433\u043a\u043e \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u2014\u00a0 \u0435\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 IDEA, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 golden.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e golden-\u0442\u0435\u0441\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 CLI \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<pre><code class=\"bash\">flutter test -- update-goldens<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 golden-\u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e: \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0442\u0435\u0441\u0442 flutter_test_config.dart.<\/p>\n<p>\u041a\u043e\u0434 \u043d\u0438\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0435\u0441\u0442\u0435 \u0438 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0448\u0440\u0438\u0444\u0442\u044b.<\/p>\n<pre><code class=\"dart\">Future&lt;void> testExecutable(FutureOr&lt;void> Function() testMain) async {  await loadAppFonts();  return testMain(); }<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0433\u043e\u043b\u0434\u0435\u043d\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0430\u0431\u043e\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439: \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c \u0442\u0435\u0441\u0442\u0430.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430 \u0441\u0447\u0451\u0442 \u043c\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041c\u0430\u0433\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0449\u0451 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f WM \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u043e\u043a\u0438\u0440\u0443\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0441\u0442. <\/p>\n<h4>\u0422\u0435\u0441\u0442 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 \u0433\u043e\u0440\u043e\u0434\u0430<\/h4>\n<pre><code class=\"dart\">void main() {   const selectAddressScreen = SelectAddressScreen();   final selectAddressWm = SelectAddressWMMock();    setUp(() {     when(() => selectAddressWm.predictions).thenAnswer(       (_) => ValueNotifier&lt;List&lt;Location>>([]),     );     when(() => selectAddressWm.searchFieldController).thenAnswer(       (_) => TextEditingController(),     );   });    testGoldens('select address screen default golden test', (tester) async {     await tester.pumpWidgetBuilder(selectAddressScreen.build(selectAddressWm));     await multiScreenGolden(tester, 'select_address_screen');   });    testGoldens('select address screen with data golden test', (tester) async {     when(() => selectAddressWm.predictions).thenAnswer(       (_) => ValueNotifier&lt;List&lt;Location>>(_locationMock),     );      await tester.pumpWidgetBuilder(selectAddressScreen.build(selectAddressWm));     await multiScreenGolden(tester, 'select_address_screen_data');   }); }<\/code><\/pre>\n<h4>\u0422\u0435\u0441\u0442 \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043f\u043e\u0433\u043e\u0434\u044b<\/h4>\n<pre><code class=\"dart\">void main() {   final wm = WeatherScreenWMMock();   const weatherScreen = WeatherScreen();    setUp(() {     when(() => wm.topPadding).thenReturn(16);      when(() => wm.currentWeather).thenReturn(       EntityStateNotifier.value(_mockWeathers),     );      when(() => wm.locationTitle).thenReturn(_locationMock.title);   });    testGoldens('weather details screen with data golden test', (tester) async {     await tester.pumpWidgetBuilder(weatherScreen.build(wm));     await multiScreenGolden(tester, 'weather_details_screen_data');   });    testGoldens('weather details screen with error golden test', (tester) async {     when(() => wm.currentWeather).thenReturn(       EntityStateNotifier.value([])..error(Exception()),     );      await tester.pumpWidgetBuilder(weatherScreen.build(wm));     await multiScreenGolden(tester, 'weather_details_screen_err');   }); }<\/code><\/pre>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c WidgetModel<\/h2>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f WidgetModel \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 Elementary \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/go.surf.dev\/hr\/flutter\/habr\/elementary_testing3\"><u>elementary_test<\/u><\/a>: \u043e\u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>testWidgetModel \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430. \u041f\u0440\u0438 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 WidgetModel \u043e\u043d\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0435\u0441\u0442\u0435\u0440 \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0444\u0430\u0437\u0430\u043c\u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 WidgetModel, \u0430 BuildContext \u2014 \u0434\u043b\u044f \u0438\u0445 \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u0430 \u0441\u0442\u043e\u0438\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0433\u043e\u043b\u043e\u0432\u0435, \u0447\u0442\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432\u043e\u043a\u0440\u0443\u0433 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043c\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e.<\/p>\n<h4>\u0422\u0435\u0441\u0442 \u0432\u0438\u0434\u0436\u0435\u0442-\u043c\u043e\u0434\u0435\u043b\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 \u0433\u043e\u0440\u043e\u0434\u0430<\/h4>\n<pre><code class=\"dart\">void main() {   group('init select address screen wm', () {     final getIt = GetIt.instance;      setUp(() {       getIt.registerSingleton&lt;AppModel>(AppModel());     });      test('createSelectAddressWM', () {       expect(() => createSelectAddressWM(BuildContextMock()), returnsNormally);     });   });    group('select address screen wm testing', () {     late SelectAddressModelMock modelData;     late NavigationHelperMock navigatorStateMock;      SelectAddressWM setupWm() {       modelData = SelectAddressModelMock();       navigatorStateMock = NavigationHelperMock();        when(() => modelData.getCityPrediction(any()))           .thenAnswer((invocation) => Future.value());        registerFallbackValue(MaterialPageRoute&lt;void>(builder: (_) {         return const Center();       }));        return SelectAddressWM(modelData, navigatorStateMock);     }      testWidgetModel&lt;SelectAddressWM, SelectAddressScreen>(       'onTapLocation call onLocationSelected and navigate to next screen',       setupWm,       (wm, tester, context) async {         tester.init();         wm.onTapLocation(_locationMock);          verify(() => modelData.onLocationSelected(_locationMock));         verify(() => navigatorStateMock.push(context, any()));       },     );      testWidgetModel&lt;SelectAddressWM, SelectAddressScreen>(       'onTextChanged call getCityPrediction',       setupWm,       (wm, tester, context) async {         tester.init();          wm.searchFieldController.text = 'Test';         verify(() => modelData.getCityPrediction(any()));       },     );   }); }<\/code><\/pre>\n<h4>\u0422\u0435\u0441\u0442 \u0432\u0438\u0434\u0436\u0435\u0442-\u043c\u043e\u0434\u0435\u043b\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043f\u043e\u0433\u043e\u0434\u044b<\/h4>\n<pre><code class=\"dart\">void main() {   group('WeatherScreenWm init', () {     final getIt = GetIt.instance;      setUp(() {       getIt.registerSingleton&lt;AppModel>(AppModel());     });      test('createWeatherScreenWM', () {       expect(() => createWeatherScreenWM(BuildContextMock()), returnsNormally);     });   });    group('WeatherScreenWM', () {     final modelData = WeatherScreenModelMock();     final contextHelperMock = ContextHelperMock();      WeatherScreenWM setupWm() {       when(modelData.getWeather).thenAnswer((invocation) => Future.value([]));        return WeatherScreenWM(contextHelperMock, modelData);     }      testWidgetModel&lt;WeatherScreenWM, WeatherScreen>(       'getWeather called after init wm ',       setupWm,       (wm, tester, context) async {         tester.init();         verify(modelData.getWeather);       },     );      testWidgetModel&lt;WeatherScreenWM, WeatherScreen>(       'topPadding getter return padding',       setupWm,       (wm, tester, context) async {         tester.init();          when(           () => contextHelperMock.getMediaQuery(context),         ).thenReturn(const MediaQueryData());          expect(wm.topPadding, 16);       },     );      testWidgetModel&lt;WeatherScreenWM, WeatherScreen>(       'onRetryPressed call getWeather',       setupWm,       (wm, tester, context) async {         tester.init();         wm.onRetryPressed();         verify(modelData.getWeather);       },     );   }); }<\/code><\/pre>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c<\/h2>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c unit-\u0442\u0435\u0441\u0442\u044b. \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043c\u0430\u0442\u0447\u0435\u0440\u043e\u0432: same, isTrue, isFalse, returnsNormally \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<h4>\u0422\u0435\u0441\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 \u0433\u043e\u0440\u043e\u0434\u0430<\/h4>\n<pre><code class=\"dart\">void main() {   final addressServiceMock = AddressServiceMock();   late SelectAddressModel model;    setUp(() {     model = SelectAddressModel(addressServiceMock, AppModel());   });    test('init with empty list', () async {     when(() => addressServiceMock.getCityPredictions('')).thenAnswer(       (_) => Future.value([]),     );     expect(model.predictions.value, isEmpty);   });    test('getCityPrediction return empty list', () async {     when(() => addressServiceMock.getCityPredictions('Test')).thenAnswer(       (_) => Future.value(_locationMock),     );     await model.getCityPrediction('');     expect(model.predictions.value, isEmpty);   });    test('getCityPrediction return prediction list', () async {     await model.getCityPrediction('Test');     expect(model.predictions.value, same(_locationMock));   }); }<\/code><\/pre>\n<h4>\u0422\u0435\u0441\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0430 \u043f\u043e\u0433\u043e\u0434\u044b<\/h4>\n<pre><code class=\"dart\">void main() {   late WeatherScreenModel wm;   final weatherServiceMock = WeatherServiceMock();    setUp(() {     wm = WeatherScreenModel(weatherServiceMock, _locationMock);   });    test('location getter return selected location', () {     expect(wm.location, same(_locationMock));   });    test('method getWeather return weather from weather service', () async {     when(() => weatherServiceMock.getWeather(any())).thenAnswer(       (invocation) => Future.value(_weatherMock),     );      expect(await wm.getWeather(), same(_weatherMock));   }); }<\/code><\/pre>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435<\/h2>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438.\u00a0<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\"> \u00a0flutter test --coverage --update-goldens<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c HTML-\u043e\u0442\u0447\u0451\u0442.\u00a0<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">genhtml<\/code><\/pre>\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-329416","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/329416","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=329416"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/329416\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=329416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=329416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=329416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}