{"id":159985,"date":"2012-11-23T19:47:03","date_gmt":"2012-11-23T15:47:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=159985"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=159985","title":{"rendered":"<span class=\"post_title\">OCUnit \u0432 XCode 4.5 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043c\u043d\u0435 \u043d\u0430\u0434\u043e\u0435\u043b\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u0433\u043e\u0432 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0443 \u043c\u0435\u043d\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438 \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u043f\u0443\u0442\u0435\u0439 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044f \u043f\u0440\u0438\u0448\u0435\u043b \u043a TDD \u2014 Test-driven development (<a href=\"http:\/\/ru.wikipedia.org\/wiki\/%D0%A0%D0%B0%D0%B7%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%BA%D0%B0_%D1%87%D0%B5%D1%80%D0%B5%D0%B7_%D1%82%D0%B5%D1%81%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5\">\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a>).<\/p>\n<p>  \u0412 \u044d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 \u0448\u0430\u0433\u0438 \u0432 XCode 4.5, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f unit test-\u044b, \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u0434 IOS.<\/p>\n<p>  \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0437\u0443\u0431\u0440\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043e\u0442\u043c\u0435\u0442\u0438\u043c \u0433\u0430\u043b\u043e\u0447\u043a\u0443 \u00abInclude Unit Tests\u00bb \u0438 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e Ocu:<br \/>  file -&gt; new -&gt; project -&gt; single view application<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/6f4\/f0a\/4fe\/6f4f0a4fec52df93712faa725d39d426.jpg\" alt=\"step 1\"\/><br \/>  \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ARC, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0441\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u0447\u0442\u043e \u043d\u043e\u0432\u044b\u0435 \u0444\u0438\u0447\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u043a\u0430 \u0438\u0445 \u043d\u0435 \u0434\u043e\u0432\u0435\u0434\u0443\u0442 \u0434\u043e \u0443\u043c\u0430, \u0430 \u043e\u043d \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u0433\u043e\u0434 \u043d\u0430\u0437\u0430\u0434. \u0414\u0430 \u0438 \u0440\u0443\u0447\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0443\u0436 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0432 \u044d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430.<\/p>\n<p>  \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a SenTestingKit, \u044d\u0442\u043e\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u0430\u0442\u044c.<br \/>  \u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0432\u0438\u0434\u0438\u043c 2 \u0433\u0440\u0443\u043f\u043f\u044b \u2014 Ocu \u0438 OcuTests, \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u044b.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/720\/8f0\/823\/7208f0823dba3dee646f6bd2d6802549.jpg\" alt=\"step 2\"\/><\/p>\n<p>  \u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b \u00abOcuTests.m\u00bb \u0438 \u043d\u0430\u0439\u0434\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u00abtestExample\u00bb.<br \/>  OcuTests.m  <\/p>\n<pre><code class=\"objectivec\">#import &quot;OcuTests.h&quot;  @implementation OcuTests  - (void)setUp {     [super setUp];          \/\/ Set-up code here. }  - (void)tearDown {     \/\/ Tear-down code here.          [super tearDown]; }  - (void)testExample {     STFail(@&quot;Unit tests are not implemented yet in OcuTests&quot;); }  @end <\/code><\/pre>\n<p>  setUp \u2014 \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0430.<br \/>  tearDown \u2014 \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0432\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<br \/>  testExample \u2014 \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c, \u043e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0430\u043a\u0440\u043e\u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0435\u0449\u0435 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u0430.<\/p>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435, \u0435\u0441\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043d\u0430 test \u0438 \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 void, \u0442\u043e SenTestingKit \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u0442 \u0435\u0433\u043e \u043a\u0430\u043a \u0442\u0435\u0441\u0442 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442.<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0442\u0435\u0441\u0442 (\u043d\u0430\u0436\u0430\u0442\u0438\u0435\u043c \u00abcmd+U\u00bb \u0438\u043b\u0438 \u043d\u0430\u0436\u0430\u0432 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u00abRun\u00bb \u0438 \u043f\u043e\u0434\u0435\u0440\u0436\u0430\u0432 \u0435\u0435, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0432\u044b\u043f\u0430\u0432\u0448\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u00abTest\u00bb) \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0430\u043f\u0438\u0448\u0435\u0442 \u0434\u0435\u0431\u0430\u0433\u0433\u0435\u0440.  <\/p>\n<pre><code class=\"objectivec\">Test Suite 'OcuTests' started at 2012-11-22 22:27:01 +0000. Test Case '-[OcuTests testExample]' started. \/Ocu\/OcuTests\/OcuTests.m:29: error: -[OcuTests testExample] : Unit tests are not implemented yet in OcuTests Test Case '-[OcuTests testExample]' failed (0.000 seconds). Test Suite 'OcuTests' finished at 2012-11-22 22:27:01 +0000. Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.000) seconds <\/code><\/pre>\n<p>  \u0414\u0435\u0431\u0430\u0433\u0433\u0435\u0440 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0447\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d 1 \u0442\u0435\u0441\u0442, \u0438 \u0442\u0435\u0441\u0442 \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043d, \u0438 \u0432\u044b\u0434\u0430\u043b \u043d\u0430\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0432 \u043c\u0430\u043a\u0440\u043e\u0441\u0435.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0433\u0434\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442, \u043a\u0430\u043a \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 \u0433\u0434\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 1 \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c 2 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0445 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c 2 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c, \u0438 \u043c\u0435\u0442\u043e\u0434 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448 \u0442\u0435\u0441\u0442.<br \/>  OcuTests.h  <\/p>\n<pre><code class=\"objectivec\">#import &lt;SenTestingKit\/SenTestingKit.h&gt;  @interface OcuTests : SenTestCase {     float foo;     float bar; }  - (void) testMathAdd;  @end <\/code><\/pre>\n<p>  \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 setUp \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u043c \u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 testMathAdd \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  OcuTests.m  <\/p>\n<pre><code class=\"objectivec\">- (void)setUp {     [super setUp];          foo = 2.0;     bar = 5.0; }  - (void)tearDown {     \/\/ Tear-down code here.          [super tearDown]; }  - (void) testMathAdd {     STAssertTrue (foo + bar == 6.0, @&quot;%f + %f should be 7.0&quot;, foo, bar); } <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u044b \u00abcmd+U\u00bb \u0438 \u0432\u0438\u0434\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u043c.  <\/p>\n<pre><code class=\"objectivec\">Test Suite 'OcuTests' started at 2012-11-23 12:26:14 +0000 Test Case '-[OcuTests testMathAdd]' started. \/Ocu\/OcuTests\/OcuTests.m:30: error: -[OcuTests testMathAdd] : &quot;foo + bar == 6.0&quot; should be true. 2.000000 + 5.000000 should be 7.0 Test Case '-[OcuTests testMathAdd]' failed (0.000 seconds). Test Suite 'OcuTests' finished at 2012-11-23 12:20:42 +0000. Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.000) seconds <\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0433\u043e, \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443.<br \/>  OcuTests.m  <\/p>\n<pre><code class=\"objectivec\">- (void) testMathAdd {     STAssertTrue (foo + bar == 7.0, @&quot;%f + %f should be 7.0&quot;, foo, bar); } <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442 \u0438 \u0432\u0438\u0434\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d.  <\/p>\n<pre><code class=\"objectivec\">Test Suite 'OcuTests' started at 2012-11-23 12:26:14 +0000 Test Case '-[OcuTests testMathAdd]' started. Test Case '-[OcuTests testMathAdd]' passed (0.000 seconds). Test Suite 'OcuTests' finished at 2012-11-23 12:26:14 +0000. Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds <\/code><\/pre>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 2 \u2014 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430<\/h4>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442, \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043b\u043e\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u2014 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u00abObjective-C class\u00bb \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u00abSubclass of NSObject\u00bb, \u0432\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u00abTriangle\u00bb, \u043f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u043e\u0442\u043c\u0435\u0447\u0430\u0435\u043c \u0433\u0430\u043b\u043e\u0447\u043a\u043e\u0439 \u00abTargets OcuTests\u00bb. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 OcuTests \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 2 \u043d\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u0430 \u00abTriangle.h\u00bb \u0438 \u00abTriangle.m\u00bb.<br \/>  \u0412 \u043d\u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<p>  Triangle.h  <\/p>\n<pre><code class=\"objectivec\">#import &lt;Foundation\/Foundation.h&gt;  @interface Triangle : NSObject {     float cathetus1;     float cathetus2; }  - (id)initWithCathetus1:(float)cat1 andCathetus2:(float)cat2; - (float)getHypotenuse;  @end <\/code><\/pre>\n<p>  Triangle.m  <\/p>\n<pre><code class=\"objectivec\">#import &quot;Triangle.h&quot;  @implementation Triangle  - (id)initWithCathetus1:(float)cat1 andCathetus2:(float)cat2 {     cathetus1 = cat1;     cathetus2 = cat2;          return self; }  - (float)getHypotenuse {     float hypotenuse = hypotf(cathetus1, cathetus2);     return hypotenuse; }  @end <\/code><\/pre>\n<p>  \u0418 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445.<br \/>  OcuTests.h  <\/p>\n<pre><code class=\"objectivec\">#import &lt;SenTestingKit\/SenTestingKit.h&gt;  @interface OcuTests : SenTestCase  - (void)testTriangleHypotenuse;  @end <\/code><\/pre>\n<p>  OcuTests.m  <\/p>\n<pre><code class=\"objectivec\">#import &quot;OcuTests.h&quot; #import &quot;Triangle.h&quot; \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c  @implementation OcuTests  - (void)setUp {     [super setUp]; }  - (void)tearDown {         [super tearDown]; }  - (void)testTriangleHypotenuse {     float cat1 = 3.0;     float cat2 = 4.0;     Triangle *tri = [[Triangle alloc] initWithCathetus1:cat1 andCathetus2:cat2];          STAssertTrue([tri getHypotenuse]==5.0, @&quot;Hypotenuse should be 5.0 with catheti: %f, %f&quot;, cat1, cat2);              [tri release]; } <\/code><\/pre>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0442\u0435\u0441\u0442 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u0435.  <\/p>\n<pre><code class=\"objectivec\">Test Suite 'OcuTests' started at 2012-11-23 14:25:39 +0000 Test Case '-[OcuTests testTriangleHypotenuse]' started. Test Case '-[OcuTests testTriangleHypotenuse]' passed (0.000 seconds). Test Suite 'OcuTests' finished at 2012-11-23 14:25:39 +0000. Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds <\/code><\/pre>\n<p>  PS:<br \/>  \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c.    \t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/159985\/\"> http:\/\/habrahabr.ru\/post\/159985\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043c\u043d\u0435 \u043d\u0430\u0434\u043e\u0435\u043b\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u0433\u043e\u0432 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0443 \u043c\u0435\u043d\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438 \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u043f\u0443\u0442\u0435\u0439 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044f \u043f\u0440\u0438\u0448\u0435\u043b \u043a TDD \u2014 Test-driven development (<a href=\"http:\/\/ru.wikipedia.org\/wiki\/%D0%A0%D0%B0%D0%B7%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%BA%D0%B0_%D1%87%D0%B5%D1%80%D0%B5%D0%B7_%D1%82%D0%B5%D1%81%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5\">\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a>).<\/p>\n<p>  \u0412 \u044d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 \u0448\u0430\u0433\u0438 \u0432 XCode 4.5, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f unit test-\u044b, \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u0434 IOS.<\/p>\n<p>  \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0437\u0443\u0431\u0440\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.  <\/p>\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-159985","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/159985","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=159985"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/159985\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=159985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=159985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=159985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}