In Jasmine when your test set contains a test called with iit() it will only run this/these test/s. This saves you the hassle of creating a dedicated test set if you are only focusing on a small subset of tests during development.
Is there a similar shortcut like this in Qunit? (I'm using Karma as my test runner)
Related
After over a year of development we have a huge test suite for our CAD application and it's starting to impact development time running tests. Many of the tests are numeric calculations and testing many variations of the algorithms takes up significant time. It's 10min+ to run all the tests now and it cuts into dev time waiting for tests to complete impacting our productivity.
Is there any possibility with visual studio to farm out the test suite to a cluster. It would be nice to build a compute rack just for burning through all the tests quickly. Are there any off the shelf solutions for this?
We currently use XUnit and the resharper test runner.
Are you able to manually group tests - perhaps they're in different projects and you have enough projects that parallelization by project would give you the speedup you desire? Or can you think of a way to automatically group tests, perhaps by the class name, or namespace name, that, if run in parallel, would give you the speedup you desire?
If so,
Consider modifying the xunit resharper (or visual studio) test runner so that it would consider as valid tests only those that matched your condition on a given build/test machine. For example, you'd have an environment variable that was a list of namespace names separated by commas, that list would be different on each build/test machine but would cover all tests, then the test runner would check that the test class was in one of the listed namespaces before considering that test valid.
Or, if you want/need to classify your test classes manually you could look at an attribute you'd place on test classes or assemblies - that would be the parallelization groups that you'd set up - and then also look at some environment variable or msbuild/devenv command line parameter you could set up on your individual build servers - and then it would only run tests, on a given build machine, where the attribute value matched the environment variable.
I got the idea from Fixie - "conventional testing for .NET" - where "conventional" means that it is a testing framework that let's you decide the "convention" by which tests are identified. You want all classes ending in the letters "Test" to be test classes and methods ending in "Test" to be test methods? OK. Or, you want all methods decorated with a certain attribute to be test methods? OK to that too. In fact it gives you hooks where you supply code that identifies test classes, test methods, fixture behavior, etc. etc. In Fixie my suggestion above would be quite easy to do. But I imagine it would be just a small change to xunit's resharper runner.
On a quick look, you'd modify IsUnitTestContainer in PsiUnitTestIdentifer which is called by IsValidTestClass in XunitPsiFileExplorer.cs to check your condition, whether it is the name of the test class or an attribute on it or on the assembly, against your environment variable (but that's just a guess).
When create a new test project using visual studio these 2 files are created, what's the purpose of these files? If to run the tests using Visual Studio, these files apparently is not needed.
Local.testsetting mainly used to define your test attributes. Lets assume you have set of test cases that you want to execute using a remote controller machine that you can configure in 'Host' section in this setting file. Also there are multiple other test attributes like 'TestTimeout: to set specific timeout for all your test cases, 'Setup & Cleanup Script': if you wish to run some script before running any test and after all your test cases executes. You can take this file as a Global setting file for your all test cases within this test project.
There will be another file with extension .VSMDI. This file contains list of test cases within this test project. And you can group test cases using this. For example, lets assume you have set of test cases that you want to integrate in your automatic build system and you have some other test cases (Like something opening a browser and check for some element) that you don't want to integrate with your build system. So can do all this grouping using this .vsmdi.
-Thx
Is there a way to "Test" current file in Xcode4?
That is if you are writting your 10th unit test, but rather than going TEST and having all unit tests run, you want to only trigger running those testing in the unit test file you are current in?
Pretty old post, but Xcode evolved since.
In Xcode6, got to Product > Perform Action
You'll see some other Test options, like Testing the current function.
The shortcut is Cmd-alt-ctrl-U. Pretty difficult with a single hand if you're not a pianist.
It looks like Xcode 4 is heading that way, but it doesn't work well:
Edit scheme
Go to Test section
Expand to show checkboxes.
Unfortunately, you have to click individual checkboxes; there is no way to select the entire group, or even individual suites, and turn them off with a single click. Ideally, it would be nice to turn off everything, then reenable only the tests you want.
As a workaround, you can set up a test target containing the infrastructure to run any test, but not containing any tests. Call it something like "Ad-hoc Tests". Then take the test suite you want and temporarily add it to the target. Use the technique described above to turn off all tests in your main test target.
I have data files used as input to my unit tests. These files are quite big and I don't want to copy them each time unit tests are executed. Tests are executed without deployment. So I can just put them into folder under my solution, and... how to obtain path to my solution (or test project source code) when unit test is executing?
Because you can run a test project in different ways (TD.NET, Visual Studio, R# etc.), the path used to reference the tests can change.
For this reason, I embed test needed files in my test assembly and draw them out from there.
You can use:
Assembly.GetExecutingAssembly().Location
in your tests to get the path of the assembly containing the unit tests.
Simple, make the location of the files configurable (and testable).
Then either, set it in the unit testing code or set it thru some config file.
I need some advice as to how I easily can separate test runs for unit tests and integration test in Visual Studio. Often, or always, I structure the solution as presented in the above picture: separate projects for unit tests and integration tests. The unit tests is run very frequently while the integration tests naturally is run when the context is correctly aligned.
My goal is to somehow be able configure which tests (or test folders) to run when I use a keyboard shortcut. The tests should preferably be run by a graphical test runner (ReSharpers). So for example
Alt+1 runs the tests in project BLL.Test,
Alt+2 runs the tests in project DAL.Tests,
Alt+3 runs them both (i.e. all the tests in the [Tests] folder, and
Alt+4 runs the tests in folder [Tests.Integration].
TestDriven.net have an option of running just the test in the selected folder or project by right-clicking it and select Run Test(s). Being able to do this, but via a keyboard command and with a graphical test runner would be awesome.
Currently I use VS2008, ReSharper 4 and nUnit. But advice for a setup in the general is of course also appreciated.
I actually found kind of a solution for this on my own by using keyboard command bound to a macro. The macro was recorded from the menu Tools>Macros>Record TemporaryMacro. While recording I selected my [Tests] folder and ran ReSharpers UnitTest.ContextRun. This resulted in the following macro,
Sub TemporaryMacro()
DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate
DTE.ActiveWindow.Object.GetItem("TestUnitTest\Tests").Select(vsUISelectionType.vsUISelectionTypeSelect)
DTE.ExecuteCommand("ReSharper.UnitTest_ContextRun")
End Sub
which was then bound to it's own keyboard command in Tools>Options>Environment>Keyboard.
However, what would be even more awesome is a more general solution where I can configure exactly which projects/folders/classes to run and when. For example by the means of an xml file. This could then easily be checked in to version control and distributed to everyone who works with the project.
This is a bit of fiddly solution, but you could configure some external tools for each of group of tests you want to run. I'm not sure if you'll be able to launch the ReSharper test runner this way, but you can run the console version of nunit. Once you have of those tools setup, you can assigned keyboard shortcuts to the commands "Tools.ExternalCommand1", "Tools.ExternalCommand2", etc.
This wont really scale very well, and it's awkward to change - but it will give you keyboard shortcuts for running your tests. It does feel like there should be a much simpler way of doing this.
You can use a VS macro to parse the XML file and then call nunit.exe with the /fixture command line argument to specify which classes to run or generate a selection save file and run nunit using that.
I have never used this but maybe it could help....
http://www.codeplex.com/VS2008UnitTestGUI
"Project Description
This project is about running all unit test inside multiple .NET Unit tests assembly coded with Visual Studio 2008."