10
Vote

Support Test Explorer Traits

description

Add the ability to consume traits for use in VS2012.
http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/20/part-2-using-traits-with-different-test-frameworks-in-the-unit-test-explorer.aspx

I'm still trying to work out how feasible this is. It may be possible to add trait information at the module and suite levels in QUnit and jasmine respectively:
module('Something', {
    setup: function () {
    },
    traits: {
        category: 'Category'
    }
});
describe('Something', function () {
    this.traits = {
        category: 'Category'
    }

    beforeEach(function () {
    });
});
Or maybe some custom JSON comment format?
/*{
    "category": "Category"
}*/
I'm guessing the chutzpahRunner would need consume that information somehow during discovery.

comments

Qube wrote Mar 19, 2013 at 9:31 PM

Or maybe they could go into chutzpah.json...

mmanela wrote Apr 6, 2013 at 1:40 AM

Adding traits would be nice. One person at work suggested just make the module names/description names as the trait names. Do you think that would be useful?

Qube wrote Apr 6, 2013 at 2:29 PM

That would be a good place to start, yeah.

Traits tend to be name / value pairs, as can be seen here:
http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/20/part-2-using-traits-with-different-test-frameworks-in-the-unit-test-explorer.aspx

So for QUnit, it'd probably best to have a trait named "Module" and then use the provided value. Jasmine would be a little bit trickier due to the nested descriptions... maybe that could come later.