nUnit Test Adapter 10 second limit: long-running tests in nUnit - visual-studio

I have some tests in nUnit that call an external program that sometimes takes more than 10 seconds to finish. This works fine when I run them in nUnit's "Unit Test Sessions" panel. However, when I use the test adapter (which has the benefits of more through error output and automatic test discovery), I get the following error:
The request has taken more than 10 seconds to respond, aborting it.
Exception has been thrown by the target of an invocation.
Is there any way I can extend this time limit for my tests? Is this an issue with the adapter, or with Visual Studio itself?
Edit: To clarify, I know that mocking out time-consuming functionality is the proper thing to do. Right now, though, it's not worth the time (in my estimation) that it would take to refactor my unit tests.

It has nothing to do with VS, as the Resharper is able to run tests well exceeding 10 seconds. This is most likely a limitation of the adapter.

This issue (https://github.com/nunit/nunit-vs-adapter/issues/24) is fixed in version 1.2 of the adapter.

Related

Cypress soaking up all available memory

I'm having serious issues with Cypress soaking up all my available memory (16Gb). I have 30+ tests and if I attempt to run them through the UI all at once then Cypress gradually uses all my available memory and then typically fails with a test timeout error. Closing the Cypress UI always recovers all the memory. I've seen https://github.com/cypress-io/cypress/issues/431 which suggests setting numTestsKeptInMemory to 0 but this makes no difference, also running in headless mode with cypress run makes no difference either: Ultimately all my memory get soaked up.
Also during development of the tests I've been using it.only but even when running only one test at a time the memory gradually gets soaked up until restarting Cypress is needed.
I'm using Cypress 1.4.1 on Ubuntu 16.04 (elementaryOS Loki)
Does anyone else have the same trouble?
I'm assuming this is happening while using cypress open?
cypress open is used for TDD, so you can get immediate feedback while you're developing. It's recommended in the docs to NOT run all your tests in the test runner, but with cypress run instead.
You won't get to do the snapshot history navigating, and instead will only get pictures and a video recording, but your tests will run in a headless browser and not soak up your memory.
PS: If you need to fix a broken test and want to use the test runner, you can isolate it using it.only('test case...)

Watin tests running much slower on Teamcity

I have a set of Watin GUI tests that run on Teamcity. They each run in about 300 seconds locally. They previously ran in about the same time on a TeamCity agent (PC specs are about the same). For some reason they now run incredibly slow. The tests have a timeout of 1500 seconds and this is being triggered to cause them to fail.
I have checked the tests again locally and they run in the same time as expected (about 300 seconds). When I remote view into the Team City agent I can see that the tests are keying in text at a very slow pace. The actual speed at which tests operate is slower. It almost seems as if the tests are set to run at a quarter speed if such a thing existed.
These tests are only run about once every two weeks so its possible something on the agent has changed to effect their functionality.
I am at a loss as to what could be wrong. I've never encountered this before and on paper everything is correct but it is just going slow.
Does anyone have any ideas?

Selenium Webdriver test works locally but fails on the build server

my selenium webdriver - ruby test builds locally and identifies all the elements on firefox. However, it fails on the server. Strange thing is that the step it is failing on comes up 4 times in the test. And it passes the first 3 times and fails on the 4th time. How can I troubleshoot this issue? what could be the possible cause of failure?
Not as simple as it sounds, I could resolve this issue by adding some time waits in the test script, especially around the steps which required actions on a child window. Since my test involved lots of child windows, modal windows, flash messages etc., It took me a lot of time to identify the exact step where the script failed.
The server that I was running the test has a headless browser and therefore few actions(pop up window actions) take longer than usual.

How to run a test while attached to a process in Visual Studio

I'm trying to debug some web services. I have a number of integration tests setup. I want to attach the debugger to my web process and then execute one of my tests. The problem is Visual Studio doesn't seem to allow me to run a test while I'm already attached to a process. Is there any way around this? The only way I've been able to do it is set a breakpoint in the test prior to calling the webservice, debug the unit test, and then once it hits the breakpoint attach the debugger to my webservice process. That's too many steps.
No I don't believe you could. You can however start up a second instance of visual studio and attach it to your web process with the appropriate breakpoints.
I know this is late but it's still relevant, at least up to VS2019.
What I do to work around this is this:
Attach the debugger to my web service
Detach the debugger
Take note of the 'Reattach to process' shortcut. I think the default is Shift+Alt+P
Run the unit test
Immediately hit the reattach shortcut
Unless your test starts up exceptionally quickly, this method will reattach the debugger before the tests start running.
Allen's answer is better if your machine can handle 2 instances of VS.

Unreliable test running behaviour in VS 2010

I have a problem with unit tests hanging, without any visible result, i.e. even if I set a breakpoint very early in the unit test, like the first line, this breakpoint is not hit, and the test remains listed indefinitely in the Test Results window. Using the stop button doesn't change anything, and any subsequent attempts are running a test are greeted with a "Cannot start more than one local run" error popup.
Short of finding a low level hack into VS2010 to rudely kill it's test runs, what else can I do? Right now I end up restarting Visual Studio, a very timely affair.
NEW INFO: When I finally found a button somewhere on the test run view to show run details, I was rewarded with this surprising piece of information:
An error occurred while installing and
starting the HTTP proxy used to
associate tests with web requests.
PRXY0022: When registering the proxy,
another instance of the proxy was
detected at end point
'172.30.0.30:3128'. Multiple instances
of this proxy are not allowed for the
same user on the same computer. (To
override this behavior, use the
'AllowMultipleProxies' configuration
option.) ASP.NET Client Proxy for
IntelliTrace and Test Impact
That proxy address is our company's internet proxy.
I will certainly preserve with this problem, despite taking a short break now to seek a workaround.

Resources