Run a single test in Flash Builder? - tdd

I have been using Flash Builder to build my flex software and I am a TDD guy. I find it irritating that I have to run ALL my tests in order to run any tests. It causes friction in my TDD workflow. I really want to write a test, and run that test in isolation. I do this in .Net all the time (with TD.NET plugin), but I can't find a way to do it in Flash Builder. Is there a way?
I just downloaded the trial InteliJ IDEA and it support the behavior I want. Can I do this in Flash Builder?

If you right-click on the actual test method in the Package Explorer and select the "Execute FlexUnit Tests" option it will only execute that specific test.

Related

Setting up test projects in your solution for a Xamarian app

I have experience unit testing but I have never unit tested a Xamarian solution.
My question is should I add two unit test projects to my solution? One would be a MSTest or NUnit test that tests the logic and another project Xamarian.UITest that only tests the UI? From my browsing on the internet it seems the Xamarian.UITest is only able to test the UI? Is this true or can you test the logic as well?
Thanks.
Don't try to make Xamarin.UITest test the entire application. Use Xamarin.UITest to automate the testing of the UI and, providing you have a decent separation of concerns, use xUnit, NUnit, etc, to test the logic part(s) of your app.

Running Visual Studio Load Test From Build Definition

I created a build definition that runs automated tests using MTM build environments and test suites. I recently created a Visual Studio Load Test, which can be added to a test suite just like any test method marked with the [TestMethod] attribute. However, when I run the build, I get no errors and it appears the aggregate tests don't run. Is there a way to make this work?
I found this article: https://blogs.msdn.microsoft.com/testingspot/2013/01/22/how-to-automatically-run-a-load-test-as-part-of-a-build/ which describes a way to do it, but I can't find a build template that matches what he describes, and it appears this only allows you to run a single load test.
Also, when you configure a test controller, there is an option to configure it for load testing, but to do this, you must unregister it from the Team Project Collection. If this is done, it appears the controller can no longer be used in an environments to run project automated tests. This defeats the purpose of what I want to do and makes it seem that Load Tests and Team Projects are mutually exclusive. Is this the case? If so, this is a big oversight. Load tests are the kind of thing you would like to run automatically. Thanks for the help.
You are unfortunately right. A test controller used for load testing cannot be used for other automated test execution 'at the same time'. In your scenario I would recommend that you setup a different test controller and agent for load testing and you would be able to queue it as a part of your build to achieve what you are looking for.
There is no special build process template for this case.

How to run coded UI tests from TFS?

I'm new to Coded UI testing and TFS. I've written a coded UI test for my web application and looking for different options to automatically run it. Apparently the first option is to run it from visual studio. I have also found an article explaining how to associate a test method with a test case however I don't know whether I can run my test method (s) from TFS or not? How about running them with my build? I know the unit tests can be run with the build however I'm not sure about coded UI tests.
Yes, it is possible for you to run Coded UI test in the TFS build process.
Firstly, you need to configure the Team Build Service Host run as an interactive process. See this link.
Secondly, add the Coded UI test project into TFS Version Control.
Thirdly, create a build definition to build the Coded UI test project, and also specify tests to run.
Please have a check of this blog for the detailed steps: http://blogs.msdn.com/b/mathew_aniyan/archive/2009/05/26/coded-ui-test-in-a-team-build.aspx

Running unit tests and integration tests separately using MSTest

We use Visual Studio 2010 Ultimate with tests written in MSTest. Both our unit tests and integration tests* are written in MSTest.
**By our definition, an integration test is an MSTest TestMethod that takes a while to run and/or calls out to external components such as a database or web services.*
I'm looking for a way of easily filtering out the integration tests so that only unit tests run without all the integration tests running too.
My ideas so far:
Mark integration tests with the [Ignore] attribute. This works but is a real pain when you do want to run the integration tests.
Assign a [TestCategory] attribute to the different test types. This allows them to be run separately but only through the Test View panel. You can't use CTRL+R, A (Run All Tests in Solution) or other similar shortcuts/hotkeys.
The integration tests are in a separate project, is there something that could be done to stop them running at the project level? As long as it's easy to toggle.
Write the integration tests in a different test framework, e.g. NUnit. This would keep them totally separate from a tooling point of view.
Does anyone have any other suggestions? Are there any plug-ins that can help with this?
I recommend having a different project (or projects) for integration tests because depending on your runner the only real way to run or not run tests across all runners is to include or not include a test class library.
But, I also recommend, if you're using MSTest, to use the TestCategoryAttribute to tag non-unit tests. You can then "filter" tests to be run in Test View with MSTest.
Runners like Resharper and apparently TestDriven.net (http://bit.ly/tmtYC2) allow you to then filter-out those tests from general unit-test executions.
If your unit test project is in a separate namespace, you could use the keyboard shortcut CTRL+R, T to run all tests in the current context (i.e. namespace MyApp.Tests.Unit). To do this place the cursor just after the opening curly brace in the namespace clause of any unit test class.
I have a suggestion but you won't like it.
Abandon MSTest entirely, while other unit test frameworks have been evolving MSTest as almost stopped in time. Yes, it has a major benefit of integrating directly with VS, but if I'm not mistaken that will change in VS 2011 which will provide native support for custom unit test runners integration.
(Note: The stopped in time part may be not true because I confess not paying to much attention to MSTest since I used it sparingly with VS 2008)
I use NUnit and separate my unit tests from the integration tests by using a different class library project. Then I automate the running of the tests using Gallio command line runner allowing me to configure separate scripts for running unit and integration tests.
Finally, personal opinions aside, I'm not sure but the TestDriven.net plugin may have support for running tests with a specific category only, so you could check that.

How to setup iOS UI tests as build dependency, like OCUnit?

I'd like to add UI tests to an iOS project, in the same manner as OCUnit tests.
I know there is the Instruments + UIAutomation JavaScript approach, but I don't see how that fits into an automated build workflow. Can you setup Instruments + UIAutomation scripts as build dependency for example?
Secondly, I'd rather write the UI tests in the same language as the rest of the code...
Are there any alternatives / things I'm missing?
Thanks.
Martijn
You can actually use OCUnit for UI testing.
If you're already familiar with OCUnit, this piece of code is a good start:
How to do UI Testing of iOS Applications Using OCUnit
You can then run these tests automatically with xcodebuild. It's not straightforward, but worth the extra work. I recommend to take a look at this post: Xcode4: Running Application Tests From The Command Line in iOS
UIAutomation can also be automated now with instruments, but the fact that you can now run your UI tests with OCUnit makes it less interesting.
Have a look at FoneMonkey by Gorilla Logic. This might be what you are looking for.

Resources