Running tests in parallel mono environment inside of MonoDevelop - c#

I have a parallel mono environment installed to run my app and unit
tests. The app relies on MONO_PATH to find some of the assemblies it
depends on.
Now when I run my unit tests in Monodevelop they don't work because
MONO_PATH gets cleared before running the tests. Setting environment
variables in the project options doesn't help because they don't get set
when running tests.
Any ideas how the tests could be made to work within MD? Are there any
extension points that I could plug in to?
(MD 5.9.8 with Mono 3.12.1; my app requires Mono 3.4)

Make your test project depend on the libraries so they get copied to your bin/DEBUG|RELEASE/ path before execution?
Take in account that MONO_PATH is just a debugging tool and shouldn't be used in production.

Related

How to enable Nunit tests to run only on Linux OS (and don't run on Windows)?

I'm using Nunit for testing My Program (The tests run automatically when we doing build to the program).
The program runs on both Windows and Linux operation systems, and I have some tests which supposed to run only on Linux Os. Is there some way to make sure those tests will run only on Linux and not on Windows OS?
I know That in JUnit for exmaple there is possibility to add the title #EnabledOnOs(LINUX) , but I could not find something similar to Nunit.
Thank you very much.
Short answer: [Platform("Linux")]
NUnit will generate a reason but if you want a more detailed one, you can specify it.
[Platform("Linux", Reason="Only runs on Linux because... ")]
You may use this on methods or on an entire fixture class.

Can't run unit tests on smart device emulator

I'm running Visual Studio 2008 and have a C# program that runs beautifully on the "Pocket PC 2003 Second Edition" emulator. However, when I try to run any unit tests I get an error on the first test:
The test adapter ('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter,
Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=9.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a') required to execute this test could not be loaded.
Check that the test adapter is installed properly.
ActiveSync bootstrap initialization failed.
Please connect/cradle a real device or download the User-level Windows Mobile Device Center Application
from http://go.microsoft.com/fwlink?linkid=67763
Comparing the properties for the unit test and the application:
Conditional compilation symbols are identical
Platform target is identical ("Any CPU")
Framework Version is identical (v3.5)
Platform is identical ("Windows CE")
Output file folder is identical
Both have "Display the latest version of the .NET Compact Framework" checked
Output type for the application is "Windows Application", for the unit test is "Class Library" but it seems like that's what it wants.
The error message seems to indicate the VS2008 can't connect to the emulator, but since the program is running I know that isn't the case. Can I not run unit tests on an emulator?
Or am I missing files? Is there something I need to install, in order to perform unit tests? Nowhere on my system do I have a file named Microsoft.VisualStudio.TestTools.TestTypes*.*.
The problem was in the SmartDeviceTestRun.testrunConfig file, it was set to run on the actual device instead of the emulator. This web site was helpful:
https://msdn.microsoft.com/en-us/library/bb384146%28v=vs.90%29.aspx

Running Load Tests with a Build Agent

I have been trying for a while and I am not able to run Load Tests with my Build Agent. I have a solution with different projects, running Coded UI Tests, Web Performance Tests; all of them running fine on the Build Agent. The problem is that I can't run Load tests.
I started thinking that it was not possible, but I found this at Visual Studio online documentation:
The build agent can run:
Code Coverage
Coded UI Tests (Requires a build server that is running in interactive
mode)
Database Test Data Generation
Database Unit Tests
Generic Tests
Load Tests
Unit Tests
Ordered Tests
Test Impact Analysis
Web Tests
So I guess it is possible somehow. Does anybody know how to do it?

Run NUnit Test Assemblies in Parallel on Team Foundation Server 2012

We have project with many NUnit test, and it taken longer to run them, an our build process. Our NUnit test are grouped together in different projects, that compile different assemblies (DLL files), we have about 10 projects full of NUnit tests, in our solution.
We decided to try and run our NUnit assemblies in parallel on our Team Foundation Server 2012, to try and speed up our test time. Note; assemblies in parallel and not each test in parallel, we still want our tests to run one after the other, in it's given assembly.
So how can we setup our Team Foundation Server to run our NUnit assemblies in parallel?
If they are taking longer then they are likely Integration Tests and not Unit Tests, even if they are written in a unit testing framework.
You should do only unit tests (tests that need no instances of your application) at build time. Integration and UI tests should be executed at deployment time. As you deploy the same code to progressive quality environments (DEV->QA->UA->PROD) you can run more and more long running verification tests.
This will reduce your build time significantly.

VS 2010 Unit testing code located on external drives?

I've recently noticed that if your source code that you are running in VS 2010 or 12 is not located on same drive as to where your IDE of choice is running, then some weird behaviors can be observed.
var location = Assembly.GetExecutingAssembly().Location;
I have a simple MSTest unit test that runs the above and yeilds the below:
C:\Users\Ibrar\AppData\Local\Temp\ckiwsrev.qh0\A-----.Main.Tests\assembly\dl3\7e61424f\b0b1ebcc_318ace01\A----.Main.Tests.dll
Even though my source code is located on an external drive ... can any one shed any light on why this seems to be getting copied and pasted into the AppData folder and ran from there?
Is there anywhere of forcing VS to run the tests from where the source code folder is located?
I suspect it may have something to do with trust, security and permissions?
Linked Questions/Same Questions: How can I get “Copy to Output Directory” to work with Unit Tests?
This is the expected behavior. When you installed Visual Studio, it also installed 2 extra services:
Test Agent
Test Controller
These services are used to execute tests. When you hit run from Visual Studio, it sends the request with all sources to the available and selected Test Controller and the later sends the same request to all agents that are connected to it and shares to them the tests that they have to execute.
Each agent and controller can be installed at any machine (physical or not) at your network. So, the source code have to be copied on a specific folder on each machine so each agent can access it. It would be impossible for them to access the code on your local pc.
The same procedure takes place in your case. You have just decided to run your tests in your local pc. However, the Controller and Agent are still part of the whole procedure and Visual Studio needs them in order to execute the tests.
Setting Up Test Machines to Run Tests or Collect Data.
Although this refers to automating testing via Microsoft Test Manager the same structure used from Visual Studio.
Basically, from what I can tell there does not seem to be way to do this to force VS to run your test directly from the bin folder.
Seems like the answer to this for now is to use Deployment Items.

Categories

Resources