Xcode does not show what is covered by tests - swift

I know that the Xcode should highlight in green and number how many tests have been written for my method and in red where there are no tests.
Where can I enable this?

You need to click on the "Adjust Editor Options" button (right hand side of the currently opened Xcode minitab), then you'll see the "Code Coverage" option.

Related

All codes in a Eclips package are showing pink and fade green Highlighting.? [duplicate]

If I change the code the color will disappear, I do not know how does this happen.and when do we will use this features.
It looks like you accidentally pressed the Coverage button instead of the Run or Debug button next to it.
To remove the red background color do the following: in the Coverage view click the Remove Active Session or Remove All Sessions button.
For information on what this Coverage does and what it is used for, see the EclEmma web site.
This is activated because of code coverage. If you want to remove it then follow these steps.
Go to "Windows -> Show View -> Coverage" Select it. Click on "Open".
Open the "Coverage" view.
There are "X" and "XX" signs at upper right side.
Click on one of them as per your requirement to remove the coverage session.
Refer the screenshot for more details.

How to remove this red box [duplicate]

If I change the code the color will disappear, I do not know how does this happen.and when do we will use this features.
It looks like you accidentally pressed the Coverage button instead of the Run or Debug button next to it.
To remove the red background color do the following: in the Coverage view click the Remove Active Session or Remove All Sessions button.
For information on what this Coverage does and what it is used for, see the EclEmma web site.
This is activated because of code coverage. If you want to remove it then follow these steps.
Go to "Windows -> Show View -> Coverage" Select it. Click on "Open".
Open the "Coverage" view.
There are "X" and "XX" signs at upper right side.
Click on one of them as per your requirement to remove the coverage session.
Refer the screenshot for more details.

How does this Color marker happen in eclipse IDE ,and what should I do to clear the Color marker

If I change the code the color will disappear, I do not know how does this happen.and when do we will use this features.
It looks like you accidentally pressed the Coverage button instead of the Run or Debug button next to it.
To remove the red background color do the following: in the Coverage view click the Remove Active Session or Remove All Sessions button.
For information on what this Coverage does and what it is used for, see the EclEmma web site.
This is activated because of code coverage. If you want to remove it then follow these steps.
Go to "Windows -> Show View -> Coverage" Select it. Click on "Open".
Open the "Coverage" view.
There are "X" and "XX" signs at upper right side.
Click on one of them as per your requirement to remove the coverage session.
Refer the screenshot for more details.

Adding OCUnit to excisting project in XCode

I am trying to add OCUnit to a excisting XCode project however I am not able to run it. The "Test" row in the "Product" menu is gray after following this guide. Anyone having another tutorial or know how to that? Or other solutions.
You have to edit the scheme for the application target to enable the Test item in the Product menu. To open the scheme editor, click on the Scheme menu in the project window toolbar and choose Edit Scheme. Select the Test step on the left side of the scheme editor. The list of tests should be empty. Click the + button to open a target sheet. Select the unit testing target from the list and click the Add button.

Xcode 4: How do you view the console?

I can't seem to find a way to have the console run (to show NSLog comments) in XCode 4. The normal method for the previous version of XCode does not work. Does anyone have an idea of how to accomplish this?
You need to click Log Navigator icon (far right in left sidebar). Then choose your Debug/Run session in left sidebar, and you will have console in editor area.
for Xcode 5:
View->Debug Area->Activate Console
shift + cmd + c
If you just want to have the log output display when you run your app then you can go into XCode4 preferences -> Alerts and click on 'Run starts' on the left hand column.
Then select 'Show Debugger' and when you run the app the NSLog output will be displayed below the editor pane.
This way you don't have to select on the 'up arrow' button at the bottom bar.
The console is no extra window anymore but it is under the texteditor area. You can set the preferences to always show this area. Go to "General" "Run Start" and activate "Show Debugger". Under "Run completes" the Debugger is set to hide again. You should deactivate that option. Now the console will remain visible.
EDIT
In the latest GM Release you can show and hide the console via a button in the toolbar. Very easy.
Here' an alternative
In Xcode 4 short cut to display and hide console is (command-shift-Y) , this will show the console and debugger below ur text edior in the same window.
You can always see the console in a different window by opening the Organiser, clicking on the Devices tab, choosing your device and selecting it's console.
Of course, this doesn't work for the simulator :(
There's two options:
Log Navigator (command-7 or view|navigators|log) and select your debug session.
"View | Show Debug Area" to view the NSLog output and interact with the debugger.
Here's a pic with both on. You wouldn't normally have both on, but I can only link one image per post! http://i.stack.imgur.com/4gG4P.png
Here's an alternative.
In XCode4 double-click your Project (Blueprint Icon).
Select the Target (Gray Icon)
Select the Build Phases (Top Center)
Add Build Phase "Run Script" (Green Plus Button, bottom right)
In the textbox below the Shell textfield replace
"Type a script or drag a script file from your workspace" with
"open ${TARGET_BUILD_DIR}/${TARGET_NAME}"
This will open a terminal window with your command-line app running in it.
This is not a great solution because XCode 4 still runs and debugs the app independently of what you're doing in the terminal window that pops up.