Troubles with executions of automation tests with Test Explorer in Visual Studio and MSTest - unit-testing

I use in my project SpecFlow to provide automation testing of web-site(with Selenium). I want create end-to-end test suite for provide full checking of project according to BDD. When I create tests playlist in test explorer in Visual Studio and start all tests in playlist all my tests launch according to their alphabetic name. But when I restart project and start this playlist newly all my tests launch in the wrong order. I think, that this problem may be because of rebuild playlist file, but I'm not sure. Could You help me, please?
TestRunner - MSTest

Related

Visual Studio 2013 running unit test

I'm using Visual Studio 2013, and I have a legacy solution that I need to modify, containing a a console application and a unit test project.
I want to run the console application project, and while it's running I also want to run one of my unit tests.
I run my console application, but when I go to the test explorer to run my unit test, the option is grayed out.
why is this, and how can I run my unit test?
You don't mention why you want to do this, so I'll just answer blind.
If you run your console app without debugging, then you can run your unit tests at the same time.
To run without debugging, use Ctrl+F5 (DEBUG -> Start Without Debugging).
Alternatively, open your console app's project folder, go to the bin\Debug folder and double-click on <your_app>.exe.
FWIW it doesn't sound like a very good idea to do this. Unit tests are meant to be runnable completely separately from your application.

How to get Visual Studio Online test runner to run my specflow tests?

I have a project which builds and runs tests in Visual Studio Online. I recently added SpecFlow the the project and wrote a bunch of scenarios, some of which run against a LocalDb database. I was half expecting the tests to fail on VSO, but when I pushed the code up it ran all of my tests and they all passed. When I checked the logs it seems that my Specflow tests were not run.
Is there something I have to do to get the specflow custom tool which generates the actual unit tests to run as part of the build, so that VSO will find the tests after it has built?
Can I run what are effectively integration tests in VSO, creating and destroying databases in my tests?
Ok so this was a bit of a D'oh moment. VSOnline wasn't running my tests because Specflow was building NUnit test. Changing it to build MSTest tests meant that the generated files containing the tests had the correct attributes and VSOnline recognized them and so happily built and ran them.
And using the LocalDb during the tests was fine as well, all worked like a dream.

How to write unit test for Visual studio package

I am now working on a visual studio package project, currently all our tests just simulates the way we interact with visual studio with windows open and close, menus selection, button click and so on.I think these tests can be classified as integrated test and they highly depends on the devenv.exe process. For pure unit test, I just want to test one of my business logic and mock other dependencies.Although visual studio SDK contains a test library under the path VisualStudioIntegration\Common\Source\CSharp\UnitTest in SDK folder, I found it a too simple project, too young to be used in my project. When I tried to write unit test from scratch, I got a lot of problems with mocking VSX interfaces. Also there is so little resources about VSX unit test, Can anyone give me some hints or links about this? Any help is appreciated.
In my case, I needed to launch and control Visual Studio from a control program to run some developer studies.
Basically, why not just have your tests run your plugin in the experimental hive on a programmatic instance?
This was a helpful resource for launching an instance of Visual Studio through COM:
http://blogs.msdn.com/b/kirillosenkov/archive/2009/03/03/how-to-start-visual-studio-programmatically.aspx

How to avoid breaking build when committing Visual Studio Unit Tests in CruiseControl.Net

I'm having a problem when a project is committed to SVN, which in turn is automatically picked up by our newly set-up CruiseControl.NET server, the UnitTests are failing.
The unit tests are written in the default Visual Studio Unit test framework - which is the problem. I spot that nUnit appears to be recommended as a good alternative. However, that doesn't change my current predicament - I would like a working build without having to re-write every single one of my Unit Tests in the nUnit Framework (Would converting a MS Unit Test project take any considerable amount of time - it looks the same to me?)
What is the best way for me to proceed now? We are unable to install Visual Studio on the box and our IT department won't allow us access to go fiddling in the registry.
I am not sure how to run unit tests without Visual Studio, but I had moved to NUnit from MSTests and its reasonably easy - as long as you don't use the test context from MSTest(can't remember the real name), all you have to do is to rename the tags [TestClass] -> [TestFixture], etc (there is always 1-1 mapping) and change the usings. Running NUnit tests on the build machine is trivial.
Also you can try to convince your company to buy you a copy of Resharper (preferred), or TestDriven.NET - so you can easily run NUnit tests from Visual Studio.

Integrate Silverlight Unit Testing with Visual Studio 2008 Test Results Panel?

I would like to run my Silverlight Unit Tests from Visual Studio instead of opening a new instance of my Silverlight Test App in the browser.
Apparently it is possible (http://www.jeff.wilcox.name/2008/09/rc0-new-test-features/ - search for "Visual Studio Team Test log provider output")....but I don't understand how you enable this, does anyone know how?
Would be great if these tests would run from the "Run All Tests in Solution" button (Ctrl+R, A).
The blog post you referenced clearly states that this is output only and does not integrate Silverlight UT with Visual Studio Team Testing System. It will simply output into a TRX format that can then be opened in that window within Visual Studio. You still cannot run your Silverlight tests from a vsmdi, you will need to run them from within the web browser test harness.
I agree it would be great if the tests would run from the "Run All Tests in Solution" button, but that is not possible with the current tools today.
I have written a blog post about how to get the Silverlight Testing Framework to output the Visual Studio "TestResults.trx" log files. I couldn't find anything about how to do this anywhere else.