<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: higuri</title>
    <description>The latest articles on DEV Community by higuri (@higuri).</description>
    <link>https://dev.to/higuri</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F92449%2F3ceeeb37-c6bd-4ee6-8f24-a06d05b4ac44.png</url>
      <title>DEV Community: higuri</title>
      <link>https://dev.to/higuri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/higuri"/>
    <language>en</language>
    <item>
      <title>How to Run Individual XCTestCases</title>
      <dc:creator>higuri</dc:creator>
      <pubDate>Wed, 15 Aug 2018 07:40:42 +0000</pubDate>
      <link>https://dev.to/higuri/how-to-run-individual-xctestcases-495f</link>
      <guid>https://dev.to/higuri/how-to-run-individual-xctestcases-495f</guid>
      <description>&lt;h1&gt;
  
  
  Background
&lt;/h1&gt;

&lt;p&gt;You can run XCTest (unit tests for your Xcode project) easily with 'Run Test' ('Product'&amp;gt;'Test' or &lt;code&gt;Command+U&lt;/code&gt;) on Xcode. This is useful if you make extensive changes to your product code and want to test them all at once because 'Run Test' executes all the test cases implemented in your project.&lt;/p&gt;

&lt;p&gt;But there are times when you want to run individual test cases, such as while fixing bugs for a specific method and want to run only test cases for the method.&lt;/p&gt;

&lt;h2&gt;
  
  
  Xcode
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Edit Scheme
&lt;/h3&gt;

&lt;p&gt;Select 'Product' &amp;gt; 'Scheme' &amp;gt; 'Edit Scheme' &amp;gt; 'Test' pane &amp;gt; 'Info' tab, and then check and uncheck test case names. By doing this, you can specify which test cases are executed with 'Run Test'. This method is more troublesome as you implement more test cases...&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rJfZ3Q8R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/42kno5agq1o13m7j3poc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rJfZ3Q8R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/42kno5agq1o13m7j3poc.png" alt="Screenshot of Edit Scheme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Test Navigator
&lt;/h3&gt;

&lt;p&gt;Show 'Test Navigator' in the left side panel of the Xcode window, and push the 'PLAY' icon displayed to the right of the test case name.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1ckrTa-K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/j7xyajf6c957zlzh71ol.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1ckrTa-K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/j7xyajf6c957zlzh71ol.png" alt="Screenshot of Test Navigator"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Run Current Test
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Control + Option + Command + U&lt;/code&gt;&lt;br&gt;
This executes a test case in which your cursor is.&lt;/p&gt;

&lt;h3&gt;
  
  
  Re-Run Last Test
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Control + Option + Command + G&lt;/code&gt;&lt;br&gt;
This re-runs the last test cases executed.&lt;/p&gt;

&lt;h2&gt;
  
  
  xcodebuild
&lt;/h2&gt;

&lt;p&gt;You may find value in specifying test cases with command line interface, if you have many test cases and want to switch execution targets frequently. xcodebuild is one of the command line tools bundled with Xcode.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sample Usage
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; xcodebuild test \
&amp;gt;   -workspace MyXCWorkSpace \
&amp;gt;   -scheme MyAppScheme \
&amp;gt;   -destination "platform=iOS,name=my_iphonex" \
&amp;gt;   -only-testing:MyXCTargetForTest/MyTestSuite/MyTestMethod
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Remarks
&lt;/h2&gt;

&lt;p&gt;Xcode Version: 9.2&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;Is there a keyboard shortcut in Xcode 6 to run a single current test function under cursor?&lt;br&gt;
&lt;a href="https://stackoverflow.com/q/28057643"&gt;https://stackoverflow.com/q/28057643&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Running individual XCTest (UI, Unit) test cases for iOS apps from the command line&lt;br&gt;
&lt;a href="https://stackoverflow.com/q/35166214"&gt;https://stackoverflow.com/q/35166214&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How to use xcodebuild with -only-testing and -skip-testing flag?&lt;br&gt;
&lt;a href="https://stackoverflow.com/q/39427263"&gt;https://stackoverflow.com/q/39427263&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ios</category>
      <category>xcode</category>
      <category>unittest</category>
    </item>
  </channel>
</rss>
