c# - Can you Have multiple unit test files -
i have 2 unit test files in visual studio, example test1.cs
, test2.cs
... when select run tests, runs test test1.cs
. how can make visual studio run tests both test1.cs
, test2.cs
?
additional information: if select test method test2.cs
, output tell me "no tests found run."
(test2.cs == adpreportclasstest.cs)
using microsoft.visualstudio.testtools.unittesting; namespace employeerefreshtest.tests { [testclass] class adpreportclasstest { testcontext testcontext { get; set; } [testmethod] [datasource("system.data.sqlclient", "server=localhost;database=test_employee_refresh;integrated security=yes", "adpreportclass_tuples", dataaccessmethod.sequential)] public void checkconstructor() { string filename = testcontext.datarow["testfilename"].tostring(); assert.areequal(filename, filename); } } }
in order test runner see relevant members used in testing must public
. include test classes, test methods , contexts needed data sources.
update test accordingly
[testclass] public class adpreportclasstest //<-- public { public testcontext testcontext { get; set; } //<-- public [testmethod] [datasource("system.data.sqlclient", "server=localhost;database=test_employee_refresh;integrated security=yes", "adpreportclass_tuples", dataaccessmethod.sequential)] public void checkconstructor() //<-- public { string filename = testcontext.datarow["testfilename"].tostring(); assert.areequal(filename, filename); } }
Comments
Post a Comment