When there are multiple version of VS is installed side by side in Build Server, ensure right version of MSTest.exe is used by Build Server to execute the unit test. I have achieved it by setting exact path of MStest.exe to 'ToolPath property' of 'Run MSTest activity' in BTDF Default...

Hate to be the bearer of bad news, but simply put you cannot. Visual Studio does not support this. There is a userVoice item to hopefully add support in the future, but until then you cannot build your tests this way. http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/6030736-support-test-inheritance-for-base-classes-in-diffe FYI official MS response confirming it: https://connect.microsoft.com/VisualStudio/feedback/details/989781...

You could try creating multiple instances of the ui control (the class generated in the UIMap) and set an Instance search property for them (if you have any other unique search properties you can use those too). You only need to set these at the start of the test. I...

I have figured it out after a search in the net, the class name of the main window is changed because of the latest releases. I have check the latest main window name and add it in the UIMap constructor as instructed in the following link Mathew Aniyan's Blog

I think your problem is probably the path to the dlls containing the tests. you have the dll specified at the root, which means its expected to be found in the checkout directory. If you are building the dll's on TC then this is unlikely. We have the test set...

PostSharp ignores all the types that have [CompilerGenerated] attribute applied when performing the multicasting of the aspect attributes. This functionality is by design and is needed to avoid the application of the aspects on all the types generated by the C# compiler. The generated types represent the implementation details of...

I think you might be looking at this the wrong way. The purpose of a unit test is to test a unit of functionality that is isolated from any other unit. There is no need to Unit Test Entity Framework, it's been thoroughly tested. Any time that you create a...

Assuming the output format of the test results file is XML, after the first test, you could run a powershell script that changes the result URL to be the same as the URL in the second test. When you run the baseline, the result files should contain the same URL.

If you use resource in other tests, then move it to class fields and use [TestInitialize] and [TestCleanup] to get and free that resource: private Foo datasourceObject; [TestInitialize] public void TestInitialize() { this.datasourceObject = new DatasourceObject("location-string"); this.datasourceObject.Connect(); } [TestMethod] public void Test() { // Do some Stuff with Asserts }...

The closing curly bracket is not covered as the code will always throw an exception and never get to the end of the method. How do I obtain 100% coverage when an exception is thrown in a unit test? So it appears that to get 100% coverage you would need...

It sounds like those test runners may be using reflection to check whether the method returning Task really is an async method. That doesn't mean the method would behave differently if they were run - but they're just not being run. It's like saying that: public string Name { get;...

C# does not support multiple inheritance, so you cannot create an attribute that inherits from both TestMethodAttribute and TimeoutAttribute. You'll have to live with having both attributes on every method. Note, if all tests need the same timeout value, you can use the TestSettings file to specify the global timeout...

The issue here is the some runners of unit tests will forcefully close (terminate) all processes launched by the unit test after it has finished. The reason BeyondCompare is working if previously opened is that processes wasn't launched via the unit test. I have seen this happen in 2 main...

The test discovery process will not permit async void unit tests; I believe it will place a warning in the Output window. Since the async void method is skipped over by the test discovery, it won't actually run. For asynchronous unit tests, use async Task instead of async void. I...

When you created the "test" project, did you choose a testing project type? In the csproj, There is a tag called ProjectTypeGuids that gives the project a type or list of types for the IDE to understand what IDE tooling to use. You can edit it manually in the csproj....

The method execute doesn't exist in IDbConnection / SqlConnection. Therefore I assume that you have created a custom interface and class. The right way to test your code is to change the code into "code that designed to be a testable": public class A { public IDbConnection _dbConnection; public A()...

It is at C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE in my installation. Could you take a look at there. Edit: As it is express edition you should download and install Agents for Microsoft Visual Studio 2013. http://www.microsoft.com/en-gb/download/details.aspx?id=40750...

A short answer and a longer one :) As pointed out by @Lilshieste, you're working with two different repository objects. Your customer object is deleted from one of them and then attempted to be retrieved from the other, possibly without ever being added to the other in the first place....

Interestingly enough putting the category as the last argument seemed to have worked. Try moving the arguments if you are seeing the same issue. EDIT I only leave the answer above as a reference even though it is totally incorrect. As it turns out Jenkins batch command ignores " !...

Probably the easiest thing to do is use a TestCleanup and check the test outcome there: // This will be set by the test framework. public TestContext TestContext { get; set; } [TestCleanup] public void AfterTest() { if (TestContext.CurrentTestOutcome != UnitTestOutcome.Passed) { Driver.TakeScreenshot(); } } You can put this in...

If you are using VS 2012 or later, you should be using vstest.console.exe to run your tests. Mstext.exe is left there for backward compatibility. Using vstest.console.exe oftentimes fixes issues that only exist when run with mstest.exe.

As has been said by @Daniel J.G. in the comments above, one option would be to use reflection to fetch the values of your properties. Since you appear to be using MS testing framework another alternative is to use the PrivateObject class to do some of the reflection work for...

I'm not sure whether it's really the best approach, but you could make it a static variable - it's fine to access static variables from instance methods (your tests) after all. Note that this could cause problems if you try to run your tests in parallel, however. It's probably worth...

With this peice of code I can rethrow the exception from the UI thread on the main thread: [TestMethod] public void Test1() { Exception thread_ex = null; ThreadExceptionEventHandler eventHandler = (o, e) => { thread_ex = e.Exception; //store the exception from the UI thread Application.ExitThread(); //kill the UI thread };...

After some research found that I will need to pass the test adapter for visual studio, which makes the tests discover-able. /TestAdapterPath:"packages\xunit.runner.visualstudio.0.99.2 Here's the complete command, c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" /TestAdapterPath:"packages\xunit.runner.visualstudio.0.99.2" "C:\UnitTest\MyTests.dll" /settings:"C:\UnitTest\output.runsettings" /UseVsixExtensions:"true" /InIsolation /Logger:"trx" There is a nuget packahe...

I have tried steps given in the link. http://blogs.msdn.com/b/allendm/archive/2012/09/08/empty-coverage-file-with-profiler-related-errors-in-the-event-logs.aspx Slight change if you are using VS 2013. a) Environment variable VS120COMNTOOLS is set to \common7\tools b) Regkey HKLM\SOFTWARE\Microsoft\VisualStudio\12.0\InstallDir is set to your \Common7\IDE\ c) covrun32.dll and covrun64.dll exist in "\Team Tools\Dynamic Code Coverage" Removed VS110COMNTOOLS environment variable. These changes worked...

OK so I finally fixed the problem. Documenting here for completeness. The problem was that my MSTEST unit test could not find the resource/satellite assembly (some_referenced_dll.resources.dll) and was thus throwing the exception. I was using the deploymentItem attribute to deploy the dll (some_referenced_dll.dll) but not the resource dll. The solution...

The System.MissingMethodException is almost always a symptom of an incorrect .NET application environment (eg, DLL version mismatches). I would try the following actions: Rebuild and redeploy the entire solution. Depending on your deployment options, you may want to delete (clean) all existing .DLLs in the deployment folder prior to the...

If you are trying to test the service, I think you should avoid testing the proxy code and WCF access altogether - they add unnecessary complexity to the test meaning you're testing much more than you intended to. Just construct your service in your test method or test initialisation method,...

When Visual Studio runs a test from within a solution it understands deployment items, such as DLLs for plugins and it deploys them automatically. By contrast mstest.exe does not do any automatic deployment. Hence you need to deploy the files yourself. That is commonly done via the "deployment" sections of...

If you look at the IL generated for the VB project in debug mode, you will see the following in the catch block: IL_002f: call string [mscorlib]System.String::Format(string, object) IL_0034: newobj instance void [mscorlib]System.Exception::.ctor(string) IL_0039: throw IL_003a: call void [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.ProjectData::ClearProjectError() IL_003f: leave.s IL_0041 Since IL_0039 throws, you would never hit IL_003a,...

Almost every time I have run into this issue it boils down to a race condition which is less likely to occur when you are debugging since you are slowing the execution down as you step through the code. I would suggest adding debug or trace statements into the threads...

I fixed the problem. It was cause by the SyncPort assembly having a missing delay-loaded dependency. Therefore the syntax was correct but it would never load. The test detection engine loads the test assembly in the background after compilation, which attempts to load the SyncPort assembly and fails. The solution...

After debugging Visual Studio itself it turns out that Visual Studio is trying to launch vstest.executionengine.x86.exe. Which doesn't exist in your instance of 2012: Solution I repaired Visual Studio 2012 from the Programs and Features panel of Windows and that fixed the tests. Upgrading it to Visual Studio 2012.4 seems...

No. Below are your options. If these options do not tick your boxes I would recommend splitting your test into different assemblies and use the /testcontainer option to create different "playlists". That also makes sense if they are of different nature (hence you do not want to run them together)....