I'm using Eclipse Kepler CDT with Google Test. Unit testing is working fine, but I can't find a way to get a shortcut to run all unit testing. Everytime I need to run test, I have to click the little arrow near the run button and select the unit test icon.
I can't find c++ unit test in the "Keys" menu (although Run JUnit test is available).
Still you can use Ctrl+F11 to launch the last Run Configuration, so launch once your tests by clicking, and then hit Ctrl+F11.
CTRL+F11 to work the way you want, you must set (from "Windows/Preferences") the
"Run/debug > Launching : Launch Operation" setting to:
Answer in this post.
https://stackoverflow.com/a/1152039
Related
I've created a UWP Unit Test App in the past and remember it working fine.
I just tried to create a new one from scratch and hit F5 (no references, one empty test method) - out of box template.
I get a successful compile and launch, however the app window is empty and does not present the UWP testing UI.
Is this a known issue, or some basic prerequisite I've overlooked?
I'm running Visual Studio 15.5.5 on Windows 10 1709 (16299.192)
Thanks
-John
The Unit Test App should not be launched directly, instead it should run through the Test Explorer. In Test menu, choose Windows, and then choose Test Explorer. In the Unit Test Explorer window click Run all. This should execute all your tests. For more information follow the walkthrough here.
I have a solution with a test project in it, based on nUnit. All of the tests I created show in the test explorer window, I can execute, etc.
I added another unit test project to the solution, created references exactly like the first project, same nUnit version, same Platform target (Any CPU), same code structure, etc., just for a different product. But I added tests (with Test attribute) to that project and they don't show in the Test Explorer.
All of my tests in the original project still show but no tests in my new project show.
How do I get tests from multiple projects to show in the Test Explorer window?
Is the Test Explorer window tied to a specific project?
I spent a day trying to figure this out but once I posted the question, as luck would have it, I figured out the solution. I changed the nUnit version back to 3.7.1.0 and it works - both projects now show tests in the Test Explorer window.
I just installed Visual Studio 2013 Premium and was having a good time playing with it and writing unit tests (using MS unit tests). However, the "Test Lists" window and some other Test related windows suddenly disappeared AND they have disappeared from the menu item
Test->Windows. In fact I remember Test->Windows having 4 items under it and now I only see two: Test Explorer, Code Coverage Results. i stress they WERE present in Visual Studio 2013. Clearly, I hit some key combination that made them disappear or something happened to make them disappear. How do I get Test List back? Please don't see they are under Tests->Windows, because for me, they are not (at least now. they were!)
Anyone else seen this? Any solutions? I tried restarting Visual Studio, rebooting.
Also, previously, under the "Test" menu, there was a Debug->"Test in Context" and a Run->"Test in Context", or something like this. It was very handy. If your cursor was with in some test, you could run just that one. I'm guessing this is related.
For all I know, these features have been "optimized" into the new test-window... a.k.a. they have been removed. Some other unit test related features are also gone (the context menu item for "create unit tests" is gone for example, yet can still be called via the command window)
Personally I think this is Microsoft's way of pushing everybody towards the Team Foundation Server but that's just my two cents.
I just had the same issue. In my case I needed to install the NUnit plugin ("Nunit test adapter"). After restarting the tests came back.
Start Developer Command Prompt:
cd to UnitTest-folder\bin\Debug which contains .dll
enter command: mstest /testcontainer:UnitTestMyTest.dll
(this creates the test-result)
in VS:
menu View / Other Windows / Test Results
manage Test Runs: window Test Runs -> connect to Test Run
browse to test-folder\bin\Debug\TestResults
I'm following iOS Development Guide: Unit Testing Applications. However, when I attempt to build (Command+B) the LogicTests target (step 8 of "Setting Up Logic Testing"), I get the error: "The selected run destination is not valid for this action."
Since I added my application target to LogicTests's target dependencies, I'm able to run the unit tests with Command+U, but this also launches the iPhone Simulator.
To save time & resources, is it possible to run the OCUnit tests (both logic & application tests) without launching the iPhone Simulator?
I understand the annoyance of the simulator popping up in unit tests. The best remedy I've been able to find is to do Command + U, followed by Command + H when launching unit tests. (Control + H hides the simulator after it appears.) Since it appears nearly instantaneously, this can be an effective way of getting it out of your range of vision.
I've managed to run my unit tests which test my model classes without the simulator being launched as follows:
I didn't set any bundle loader or test host build settings, instead I just added the .m files I was unit testing to the Build Phases Compile Sources.
I then ran the unit tests from the command line using:
xcodebuild -verbose -target TheElementsUnitTests -configuration Debug -sdk iphonesimulator5.0 clean build
Not really sure why this didn't launch the simulator, but it definitely didn't!
Here's a small AppleScript that I set to run for Generates output in Testing behaviour configuration:
#!/usr/bin/osascript
activate application "Xcode"
It brings Xcode back immediately after pressing command + U.
P.S. I also opened a bug and Apple marked it as a duplicate. So, they're aware.
How much time/resources? Rather than focusing on reducing those, I'd focus on expanding your tests to go far beyond Apple's original "Logic Test" guidelines. Those guidelines were limiting, and written before Xcode 4. Now you can write tests without thinking, "Is this a logic test or an application test?" -- just test everything.
I've just started using resharper and I found a very annoying thing about it. When debugging a unit test, I try to step-into (F11) a method, but visual studio complains that source code is not available. The problem is that resharper is wrapping method calls with its own classes. Of course I can put a braeakpoint further in my source, but this is very annoying. Do you know if thereĀ“s a solution for this? By the way, I'm using NUnit to write my tests
Thanks
Federico
After some playing around I managed to recreate this on my setup (Xunit.net in resharper, visual studio 2008)... The steps I took to recreate this are:
Set the dll that contains the tests as the startup project (I know you don't need to do this, was just trying to get it to fail)
Put a breakpoint in the unit test
Push F11 (the shortcut key for 'step into' in my configuration)
This complains 'Cannot start test project 'RowanBeach.Crm.Domain.Test' because the project does not contain any tests.'
Run the 'Debug Unit Tests' command from the Resharper menu (I have this bound to a key combination on my machine)
This displays the 'No source code available...' message
Of course that's not how you should start unit tests from resharper! :) If that's what you were doing (or something similar), try this instead:
Don't bother setting the dll as the startup project - it doesn't need to be
build or rebuild the dll that contains the tests
set the breakpoint
Put the cursor somewhere in the source code for the unit test you want to debug to set it as the 'current context' unit test
Run the 'Debug Unit Tests' command from the Resharper menu (You might want to bind this to a key combination if you haven't already)
Hopefully, that should work
What type of tests are you running - NUnit? MS Test? Something else?
I've never found it difficult to debug tests using R# - just put a breakpoint in your test and go. What method are you trying to step into? I've generally not tried to step into the NUnit methods themselves (assertions etc) but stepping into your own code should be okay.
If you can come up with a quick example, I'd be happy to try it myself.