views:

45

answers:

2

I'd like to know if there is any simple way of running with MSTests a certain category of tests. I currently have some Unit and Integration tests. Generally, I just want to run Unit-Tests.

I know you can tag each test method with a category, but from what I've seen it seems like it is only useful if you want to create different tests lists. That doesn't seem so useful, as for each new test I'd have to update that list.

I've also tried putting Integration tests in one project and Unit tests in another one, but I can see only 3 options for running tests: Solution and Context-Wide and Impacted tests, so I guess this doesn't help a lot.

How do you guys do it?

Thanks

A: 

If you run ("Debug") a whole test project, it will run all the tests in the project. This is useful if you have strict partitions of your tests.

Otherwise, you have to use Test Lists (in the Test menu), which never seems to work well for me. They seem to get overwritten automatically sometimes.

Patrick Szalapski
If I use NUnit instead of MSTest, is it any easier to get this done?
devoured elysium
Maybe; I've never used NUnit. I'd guess NUnit would provide better tools.
Patrick Szalapski
A: 

Under what context are you trying to run the tests? During CI? After building on your dev box? Personally I believe using the categories is the best way to go. You don't have to create a list. On the Test List Editor you can sort by category. Just highlight all of the tests with "UnitTest" category (or whatever) check all and run selected.

Additionally, if you have them in different projects then you can group by project and select all those in the unit test project.

devlife
That wouldn't work. I have very specific GUI tests. It's not like I can just run the unit-tests and those GUI tests together. I need to either run the unit-tests or GUI tests.
devoured elysium
Now that I think of it, no 2 GUI tests should run at the same time. I have the idea that MSTests run in parallel, so maybe I shouldn't use MSTests for this.
devoured elysium
Either way, if you segregate your tests via categories that shouldn't be an issue....
devlife
How isn't that an issue if I can have several tests ocurring at the same time, clicking on different parts of the GUI?
devoured elysium