c# - Getting table name within mstest unit test with data from Microsoft Test Manager -


i have test methods decorated datasource attribute like:

[datasource(provider_invariant_name, connection_string,  "test case#", dataaccessmethod.sequential),  testmethod] 

with test case number in mtm replacing "test case#". i'm trying number within unit test testcontext.datarow.table.tablename "table1". can tell me how real value?

unless i'm wrong, "testcase#" cannot replaced mtm, propably have manually added in datasource attributes.

this value constant. why don't add constant variable testclass , use on both datasourceattribute , testmethod?


edit
can access datasourceattribute directly:

[testclass] public class testclass {     public datasourceattribute datasource     {                 {             return (datasourceattribute)attribute.getcustomattribute(typeof(testclass).                 getmethod("testmethod"), typeof(datasourceattribute));         }     }      [datasource(provider_invariant_name, connection_string,          "test case#", dataaccessmethod.sequential), testmethod]     public void testmethod()     {         string testcaseid = datasource.tablename;     } } 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -