← Back to team overview

nunit-core team mailing list archive

[Bug 490679] Re: Category in TestCaseData clashes with Category on ParameterizedMethodSuite

 

** Branch linked: lp:nunit-3.0

-- 
Category in TestCaseData clashes with Category on ParameterizedMethodSuite
https://bugs.launchpad.net/bugs/490679
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.

Status in NUnit Test Framework: Fix Committed
Status in NUnit V2 Test Framework: Fix Released

Bug description:
NUnit version 2.5.2, Gui Runner

Tried to set some Categories on a parameterized test and the TestCaseData objects defining the test cases (see attached source file)

--> NUnit reports ArgumentException "entry can't be added because key is already present" (see below), and the test assembly can't be loaded.

Apparently, when NUnit tries to
testMethod.Properties.Add(key, parms.Properties[key])
the dictionary already contains the _CATEGORIES key with the category of the parent ParameterizedMethodSuite.

System.ArgumentException...

Server stack trace: 
   at System.Collections.Specialized.ListDictionary.Add(Object key, Object value)
   at NUnit.Core.Builders.NUnitTestCaseBuilder.BuildSingleTestMethod(MethodInfo method, ParameterSet parms) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Builders\NUnitTestCaseBuilder.cs:line 198.
   at NUnit.Core.Builders.NUnitTestCaseBuilder.BuildParameterizedMethodSuite(MethodInfo method, Test parentSuite) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Builders\NUnitTestCaseBuilder.cs:line 145.
   at NUnit.Core.Builders.NUnitTestCaseBuilder.BuildFrom(MethodInfo method, Test parentSuite) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Builders\NUnitTestCaseBuilder.cs:line 84.
   at NUnit.Core.Extensibility.TestCaseBuilderCollection.BuildFrom(MethodInfo method, Test suite) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Extensibility\TestCaseBuilderCollection.cs:line 97.
   at NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildTestCase(MethodInfo method, TestSuite suite) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Builders\NUnitTestFixtureBuilder.cs:line 175.
   at NUnit.Core.Builders.NUnitTestFixtureBuilder.AddTestCases(Type fixtureType) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Builders\NUnitTestFixtureBuilder.cs:line 149.
   at NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildSingleFixture(Type type, Attribute attr) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Builders\NUnitTestFixtureBuilder.cs:line 123.
   at NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildFrom(Type type) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Builders\NUnitTestFixtureBuilder.cs:line 68.
   at NUnit.Core.Extensibility.SuiteBuilderCollection.BuildFrom(Type type) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Extensibility\SuiteBuilderCollection.cs:line 55.
   at NUnit.Core.TestFixtureBuilder.BuildFrom(Type type) in C:\Programme\NUnit-2.5\src\NUnitCore\core\TestFixtureBuilder.cs:line 31.
   at NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly, String ns) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Builders\TestAssemblyBuilder.cs:line 209.
   at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites) in C:\Programme\NUnit-2.5\src\NUnitCore\core\Builders\TestAssemblyBuilder.cs:line 110.
   at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites) in C:\Programme\NUnit0000-2.5\src\NUnitCore\core\Builders\TestAssemblyBuilder.cs:line 77.
   at NUnit.Core.TestSuiteBuilder.Build(TestPackage package) in C:\Programme\NUnit-2.5\src\NUnitCore\core\TestSuiteBuilder.cs:line 86.
   at NUnit.Core.SimpleTestRunner.Load(TestPackage package) in C:\Programme\NUnit-2.5\src\NUnitCore\core\SimpleTestRunner.cs:line 111.
   at NUnit.Core.ProxyTestRunner.Load(TestPackage package) in C:\Programme\NUnit-2.5\src\NUnitCore\core\ProxyTestRunner.cs:line 104.
   at NUnit.Core.ProxyTestRunner.Load(TestPackage package) in C:\Programme\NUnit-2.5\src\NUnitCore\core\ProxyTestRunner.cs:line 104.
   at NUnit.Core.RemoteTestRunner.Load(TestPackage package) in C:\Programme\NUnit-2.5\src\NUnitCore\core\RemoteTestRunner.cs:line 74.
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at NUnit.Core.TestRunner.Load(TestPackage package)
   at NUnit.Util.TestDomain.Load(TestPackage package) in C:\Programme\NUnit-2.5\src\ClientUtilities\util\TestDomain.cs:line 78.
   at NUnit.Util.TestLoader.LoadTest(String testName) in C:\Programme\NUnit-2.5\src\ClientUtilities\util\TestLoader.cs:line 445.