How to Get MSTest OwnerAttribute into Jenkins Report? -
i'd owner attribute of our mstest based unittests test reports @ jenkins (by mstest publisher). it's easy see @ jenkins test results report, responsible (failing) unittest.
my test cases like:
[testmethod, owner("aaa")] public void isitrealtest() { var result = isitreal(); assert.istrue(result); }
i checked source of jenkins ms test plugin, transforms mstest trx format jenkins readable junit format, don't want change plugin.
another way write test-owner stdout like:
[testmethod, owner("aaa")] public void isitrealtest() { console.writeline("owner: "+ getownerattributeofcurrentmethod()); var result = isitreal(); assert.istrue(result); }
but that's not feasible, since have thousands of test cases. tried using testcontext property, automatically set mstest. have base class tests, can following:
public testcontext testcontext { { return testcontextinstance; } set { testcontextinstance = value; } } [testinitialize] public void init() { console.writeline("owner: "+testcontextinstance.properties["xowner"]"); } //adding custom named property testcontext test cases [testmethod, owner("aaa"), testproperty("xowner", "bbb")] public void isitrealtest() {...}
the problem is, there xowner property available @ testcontextinstance, not ownerattribute , don't want replace ownerattribute custom named one.
another option be, resolve ownerattribute reflection , other information testcontextinstance, that's ugly workaround.
is there better solution, or should stick custom named property solution ?
Comments
Post a Comment