In my project that is using Objective-C and Swift I have noticed that suddenly all tests in the Test navigator turned purple with “rT” icon:
I did some digging and I found out that they are runtime discovered tests. These tests are not discovered before you run them. Because of that I have to run all set of test when I add a new test. Code completion in the test target stopped working too. I also can't trigger a test with the little triangle icon offered inside the test class. I tried different suggestions - deleting derived data, deleting xcuserdata, cleaning the project, but still no luck. I am using the latest Xcode 7.3. Any others suggestions would be appreciated?
Related
Update:
This seems to be JestJS related, not WebStorm or IntelliJ.
I found a partial solution (see below) but maybe someone has a full solution.
Original:
I am running JestJS tests in WebStorm.
If I use console.log or console.warn in my code, then I get a full stack-trace and code snippet of the location where the log/warn is issued in the Test Runner console. This is often very handy but can be annoying too.
Is it possible to hide the stack-trace and code-snippet somehow?
Thanks
I found a (partial) solution.
It seems to be Jest which outputs the stack traces and the code snippets.
If I change the Jest CLI options and add --noStackTrace then I get a more condense, even acceptable view:
It would be great to have the possibility to even suppress the 'console.warn' and single 'at TreeState...' lines, though.
My project runs, and I see my mod populating within Minecraft, but for some reason my code doesn't do anything. I followed a basic tutorial that should be adding an item with a texture. I also set some basic method as such within Main to test whether this is working or not:
public void onPlayerTick(TickEvent.PlayerTickEvent tick)
{
System.out.println("testing 123");
}
Upon loading of the world, this doesn't output anything.
Any help?
I think it's working now. I made the dev environment again, this time with a different tutorial from the beginning. The main difference was this tutorial used intellij like me, unlike the other tutorial which used eclipse. Seems to be working because something in the init method printed out something in the format that is expected in the console (meaning it is compiling and using the code properly). So it appears to be working... It seems. I used these tutorials, they were very in depth, would recommend regardless. This is the playlist: https://www.youtube.com/playlist?list=PLxZiPYkNuhkQKH-QlM0C_3-LvjbQA8ZAu
So, say I have this code,
And then, normally, if I want to import that class, i just hover on the red-coded code (in this case MenuType), and press Alt+Enter. But, annoyingly, instead of importing the class, it turns into this:
And it's error.
To make it work, I need to manually insert the supposed-to-be-imported package into the import section, and it works normally. It's workable, but kinda annoying.
This however, work normally with non-project code (classes in dependencies, etc)
Anyone knows what caused this and how to fix it? Maybe it's because of Kotlin?
P.S. I think I didn't find this kind of bug in Android Studio prior to 3.0
I've got the following code in a thread in my application:
while (true) {
if (ready) {
progressIndicatorController.value++;
return;
}
}
The ready variable is changed from a delegate method. This code works great when I open the application by clicking the "Run" button in Xcode's toolbar. However, if I open this application's .app (which I create by clicking Product > Archive and then following the steps) this code somehow doesn't work anymore.
progressIndicatorController.value is never incremented and this if-statement never evaluates to true. What could cause this problem?
This is probably caused by optimization from the compiler.
When you build with Archive, XCode enabled optimization in the compiler that could throw this kind of code away. I think setting the ready variable to volatile could fix your problem, altough if I were you I'd just try to rewrite it so it doesn't trigger this problem.
You can test with optimization turned on by choosing Edit Schemes in the scheme dropdown. Then set Build Configuration to Release in the Run MyApp.app. Don't forget to set it back to Debug when you're done though, as the debugger gets somewhat confused when optimization are on (i.e. you can't see the value of most variables, some breakpoints may behave erratically, etc...)
I am writing tests for my iPhone app using OCUnit.
Is there any way to debug the unit tests and have a break point to see what the heck is happening?
It's ridiculously hard to write unit tests without being able to use breakpoints.
The link posted by David Gelhar is correct for Xcode 3.
For Xcode 4, things are much simpler. Edit your current scheme and go to the "Test" action. Click the '+' at the bottom and add the test bundle that contains the tests you want to run. Now when you choose Product -> Test, it will run those tests. Any active breakpoints will be hit just like you'd expect.
Using XCode 4.2, (with SenTestKit unit tests as set up by checking the "Include Unit Tests" checkbox when setting up the project), Product->Test wasn't hitting my breakpoints, but Product->Perform Action->Test Without Building seems to do the trick. Hope this helps.
You may have also accidentally disabled "Debugger: Debug Executable" option in Scheme -> Test -> Info
Here's a blog post: Debugging Cocoa application unit tests with instructions for how to do this (for XCode 3 at least; not sure about XCode 4).
Another item to watch for in XCode 4 is that you haven't added the classes being tested to the Unit Test Target as well as the main project. It appears that it's not necessary and it will mess up your ability to have breakpoints hit.
A clue will be warning messages in the debug log when you run. The messages will look like this:
"Class XXX is implemented in both YYY and ZZZ. One of the two will be used. Which one is undefined."
Once I removed the classes noted in the warnings from the unit test target, Xcode started hitting the breakpoints.
You can remove classes from a target by clicking on the .M file, and turning off its membership in the unit test target in the inspector window under "Target Membership".