Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

TestCase attribute messing up NCrunch entirely
anilkamath
#1 Posted : Thursday, October 27, 2011 11:38:27 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/27/2011(UTC)
Posts: 1
Location: India

When i have a test with the TestCase attribute Ncrunch fails to run any of the tests. here is the error that is seen


[17:03:46.1891-TestExecutionTask-13] ERROR (Internal): System.Reflection.CustomAttributeFormatException: 'Result' property specified was not found. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
--- End of inner exception stack trace ---
at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
at System.Reflection.RuntimeMethodInfo.GetCustomAttributes(Boolean inherit)
at NUnit.Core.Reflect.GetAttributes(ICustomAttributeProvider member, Boolean inherit)
at NUnit.Core.Reflect.HasAttribute(ICustomAttributeProvider member, String attrName, Boolean inherit)
at NUnit.Core.Reflect.GetMethodsWithAttribute(Type fixtureType, String attributeName, Boolean inherit)
at NUnit.Core.NUnitTestFixture..ctor(Type fixtureType, Object[] arguments)
at NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildSingleFixture(Type type, Attribute attr)
at NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildFrom(Type type)
at NUnit.Core.Extensibility.SuiteBuilderCollection.BuildFrom(Type type)
at NUnit.Core.TestFixtureBuilder.BuildFrom(Type type)
at NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly, String ns)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
at nCrunch.TestExecution.Frameworks.NUnit.NUnitTestFramework.InitialiseFrameworkForExecution(String solutionDirectory, String testAssemblyPath, Int32 defaultTimeout)
at nCrunch.TestExecution.RemoteTestRunner.#=qn1yXL7OMLYnsnvw4beLiAAeJO1e0Wb0wyJoMYaKZ6Hs=(Type #=qwigHKwK_oJMjwQiNaa0kBGZ1T2uFgas3$$xtOpakwe8=)
at nCrunch.TestExecution.RemoteTestRunner.RunTests(IMasterExecutionMap[] masterExecutionMaps, IList`1 testsToRun)


This is what my test looks like:

[TestCase(2, Description = "SquareOf2", Result = 4)]
[Test]
public int ShouldRoundTaxToNearest05(decimal valueToBeSquared)
{
return obj.Square(valueToBeSquared);
}

From the error it seems its not able to pick up the Result attribute correctly.

FYi if i comment out TestCase line everything works smoothly..

Let me know if you need any more clarifications.


P.S: Awesome tool but please make it a little faster especially on solutions with 20+ projects
Remco
#2 Posted : Thursday, October 27, 2011 1:12:32 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,140

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Thanks for reporting this one. This is a problem caused by the instrumentation messing with named attribute parameters (i.e. the 'Result' named attribute parameter on TestCase), and is on the list of known issues to be fixed in a future version.

If you're having trouble getting NCrunch to run quickly on a large solution, I recommend having a look at the documentation around this area. You'll find that your experience with NCrunch has far more to do with the tests you are running and the chunkiness of your projects as opposed to the number of projects involved. In fact, NCrunch usually works much better on solutions with large numbers of small projects, as it has more opportunities to optimise the build process.
Remco
#3 Posted : Monday, December 19, 2011 8:13:16 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,140

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
The fix for the above problem has now been released as part of 1.36b.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.047 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download