Re: TestSuite.Add() question
"Charlie Poole" <[email protected]> Tue, 29 Jul 2008 16:45:02 -0700
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <000101c8f1d5$1febbc10$6401a8c0@ferrari> |
What shows up depends on what you put in the test and the test result. We would need to see how your test method is defined and whether you are doing anything special to the test result. Charlie > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On > Behalf Of Sujin Han > Sent: Tuesday, July 29, 2008 4:04 PM > To: [email protected] > Subject: [nunit-developer] TestSuite.Add() question > > I have created an extension from ITestCaseBuilder. In > BuildFrom method, I instantiate TestSuite and call Add method > to dynamically add a bunch of test cases. > > In my test module I use a custom attribute to "trigger" the > creation of these test cases, which all show correctly when > loaded in NUnit. > > The problem is that in testresult.xml, all dynamically added > methods have the same name! Somehow the names shown in NUnit > GUI are ignored when the xml is generated. Is this an > expected behavior? Could someone suggest a workaround? > > Here's some code snippets: > > public NUnit.Core.Test BuildFrom(System.Reflection.MethodInfo > method) { > string parentName = method.DeclaringType.ToString(); > TestSuite suite = new TestSuite(parentName, method.Name); > > // BUGBUG: nunit test result xml shows identical names > // for all tests that are dynamically added > int counter = 0; > foreach (string atd_filename in this.definitionFiles) > { > object[] args = new object[4]; > args[0] = (object)this.workingDir; > args[1] = (object)atd_filename; > args[2] = (object)this.a; > args[3] = (object)this.d; > > // Add test cases > suite.Add(new AvtTestMethod(method, > string.Format("Test({0}) {1}", ++counter, > Path.GetFileNameWithoutExtension(atd_filename)), > args)); > } > return suite; > } > > > > > > -------------------------------------------------------------- > ----------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge Build the coolest Linux based > applications with Moblin SDK & win great prizes Grand prize > is a trip for two to an Open Source event anywhere in the > world http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > nunit-developer mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nunit-developer > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/