I've just started writing unit tests and I've encountered an issue. So far I've dug through different blogs on google and stackoverflow but I haven't been able to resolve this.
Every time I write a function to be tested the run button (shaped like a diamond) does not appear. The only run buttons that do show up are the default functions created by Xcode when you create a new unit test target.
Here's an example of the issues.
Xcode screenshot
Could it be a bug or am I missing something?
test needs to be on the front of the function signature. ie: test"functionName"()
Related
I have a question and I have been looking for a lot of reviews and nothing seems to work.
I am trying to run my project in my mac.
And always than I put in my cucumber file for example:
example:
only the line where I use "<>" show the next message : "step does not have a matching glue code.
and I totally sure that the same name is connected with his method in my page objects.
The weird thing is that in my windows computer the project run perfectly. I don't know why occurs this.
I hope you can help me.
I am looking to override protractors click method because we are getting some sporadic test failures due to some intermittent problems in our app. We are looking to override the click so we can add some custom functionality so overcome this issue and all our automation scripts to continue to run despite this issue.
Tests are to test if everything in your app is working as it should. If something causes tests to be unreliable you should refrain from hacking in a temp workaround and instead mark a test as pending (xit instead of it) and try to fix the issue either in the tests or in the client side to make it reliable again. Pending tests will be listed in the final report and will give you a reminder to test it manually or nag you about fixing it properly :)
If you provide more information about the nature of the problem maybe we could come up with an idea to solve it?
I'm using xcode 4.5 and trying to add logic tests to the project. (This is actually a test, newly created project without unit tests). I'm following this guide:
http://developer.apple.com/library/mac/#documentation/developertools/Conceptual/UnitTesting/02-Setting_Up_Unit_Tests_in_a_Project/setting_up.html
So, what i've done so far:
Created a new project (View Based Application template)
Click on File -> New- CocoaTouchUnitTestBundle
That's it. The tests (as documentation states) are ready to use.
But I have the following problems:
The SenTestinKit.framework appears in red
If I press Test button issue navigator shows nothing:
If I select another debugger here(LLDB by default, trying to select GDB):
Xcode just hangs out:
P.S I also tried to remove SenTestingKit.framework (which is in red) and add new. Nothing changed.
What am I doing wrong ?? I suppose to see something like this(screenshot from apple guide):
Any help will be greatly appriciated!
Actually, your code works now.
I don't know why Xcode didn't initially add the SenTestingKit framework in correctly when you created the test bundle.
But now the code, "testExample" which was auto-generated for you, is running, and it is telling you to add in some real tests, by giving you an error. That's what STFail does.
So, if you take out that line, and start writing your own tests, you should be fine.
I've taken a screenshot of the compiler inconsistencies that I have been getting when creating new ViewControllers in my current project.
In this example, the debugger shows a different value for my variables 'kim', 'fakekim', and 'blah' from my log output (which shows the correct values). The debugger consistently shows the next instance variable obtaining the current instance variable's value ('fakekim' is assigned the value that 'kim' is supposed to have).
The issue seems to be project-specific. I've been able to reproduce the issue by importing my project on another Mac. However, if I create a new project, the debugger works fine. Was hoping to figure out the issue to prevent this from happening in the future.
Thanks for your help, StackOverflow community!
Edit: Larger screenshot image: http://i.imgur.com/QfZme.png
This was a (very annoying) bug with LLDB in Xcode 4.3. It has been fixed in 4.3.2.
Probably an Xcode bug. Try dragging the .xcuserstate file from you working project to your real one, and see whether that fixes it.
You could also try a clean build (shift-command-k).
I've managed to set up unit tests for my library in Xcode 4. I've performed builds with tests that I know will pass and fail (i.e. STAssertTrue(YES) and STAssertTrue(NO) ) just to make sure it's working. I'm using the default apple SenTest libraries following this document.
However, when my tests are running I'm getting this error in the build log :
An internal error occurred when handling command output: -[IDEActivityLogSectionRecorder endMarker]: unrecognized selector sent to instance 0x20310b580
To be clear, it's not affecting the running of the tests at all, just the output into the build window. All the tests run each time so I can tell a pass / fail by looking to see if the build succeeds or fails.
However, when my tests fail I can't find out which one fails because the output seems to stop when it gets to that error.
Does anyone have experience with unit testing / Xcode 4 / this error?
I just posted this on another thread, but I'm going the opposite direction for Xcode 4.
Please see my blog post exploring the topic, leave a comment if you think I'm wrong.
I realise it doesn't directly answer your question, but forget SenTestingKit and use GHUnit. It'll take you about 10 minutes to figure out (much more straightforward than OCUnit) and will save you a lot of headaches. IMHO, Apple should be shipping it with Xcode instead of OCUnit.
GHUnit can run your tests in a true application environment (with a GUI), or on the command line. It literally just drops into your existing project as a separate target.
https://github.com/gabriel/gh-unit