Re: MbUnit and VS 2008 Integration. ExpectedException tests missing from Test View window.

15 views
Skip to first unread message
Message has been deleted

Jeff Brown

unread,
Jul 28, 2010, 4:31:36 AM7/28/10
to mbun...@googlegroups.com
The VS integration may be encountering some kind of exception while performing reflection over the ExpectedException attribute.  Specifically, it might have to do with the "Type" parameter.

Not sure off-hand but it would be interesting to see whether VS is internally throwing exceptions while enumerating these tests.

Jeff.

On Fri, Jun 18, 2010 at 8:10 AM, Krispy <kevinb...@gmail.com> wrote:
I’ve updated my Visual Studio solution file to include
ProjectTypeGuids that integrate my MbUnit v3 tests into Visual Studio
2008.

<PropertyGroup>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>

This works great, however when I decorate a Test with an
ExpectedException attribute, the test appears to be removed from the
Test View window.  If I open the Gallio UI, the test appears as
expected.

Does anyone know why tests that are decorated with the
ExpectedException attribute are not visible in the Visual Studio Test
View window?

Thanks in advance,

--
You received this message because you are subscribed to the Google Groups "MbUnit.Dev" group.
To post to this group, send email to mbun...@googlegroups.com.
To unsubscribe from this group, send email to mbunitdev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mbunitdev?hl=en.


Krispy

unread,
Jul 28, 2010, 12:43:03 PM7/28/10
to MbUnit.Dev
Hi Jeff – I think you may be on to something.

I had not noticed that the following text was being sent to the ‘Test
Output’ window when Visual Studio was rendering the tests.

[error] An exception was thrown while exploring tests.
Location: D:\<MyDir>\MyClass.cs(238)
Details: System.FormatException: Input string was not in a correct
format.
at System.Number.StringToNumber(String str, NumberStyles options,
NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style,
NumberFormatInfo info)
at System.Byte.Parse(String s, NumberStyles style, NumberFormatInfo
info)
at Mono.Cecil.AssemblyNameReference.Parse(String fullName)
at Mono.Cecil.Signatures.SignatureReader.CreateTypeReference(String
typeName, String asmName, Boolean isValueType)
at Mono.Cecil.Signatures.SignatureReader.CreateTypeReference(String
typeName, Boolean isValueType)
at Mono.Cecil.Signatures.SignatureReader.ReadSimpleValue(Byte[]
data, BinaryReader br, TypeReference type, Boolean& read, Boolean
resolve)
at Mono.Cecil.Signatures.SignatureReader.ReadElem(Byte[] data,
BinaryReader br, TypeReference elemType, Boolean& read, Boolean
resolve)
at
Mono.Cecil.Signatures.SignatureReader.ReadCustomAttrib(BinaryReader
br, Byte[] data, MethodReference ctor, Boolean resolve)
at Mono.Cecil.Signatures.SignatureReader.GetCustomAttrib(Byte[]
data, MethodReference ctor, Boolean resolve)
at Mono.Cecil.ReflectionReader.GetCustomAttribute(MethodReference
ctor, Byte[] data, Boolean resolve)
at Mono.Cecil.CustomAttribute.Resolve()
at
Gallio.Common.Reflection.Impl.CecilReflectionPolicy.<EnumerateAttributes>d__31.MoveNext()
in c:\RelEng\Projects\MbUnit v3.1\Work\src\Gallio\Gallio\Common
\Reflection\Impl\CecilReflectionPolicy.cs:line 286
at
Gallio.Common.Reflection.Impl.StaticCodeElementWrapper.<GetAllCustomAttributes>b__13()
in c:\RelEng\Projects\MbUnit v3.1\Work\src\Gallio\Gallio\Common
\Reflection\Impl\StaticCodeElementWrapper.cs:line 259
at Gallio.Common.Memoizer`1.Memoize(Func`1 populator) in c:\RelEng
\Projects\MbUnit v3.1\Work\src\Gallio\Gallio\Common\Memoizer.cs:line
67
at
Gallio.Common.Reflection.Impl.StaticCodeElementWrapper.GetAllCustomAttributes()
in c:\RelEng\Projects\MbUnit v3.1\Work\src\Gallio\Gallio\Common
\Reflection\Impl\StaticCodeElementWrapper.cs:line 255
at
Gallio.Common.Reflection.Impl.StaticCodeElementWrapper.<GetAttributeInfos>d__1.MoveNext()
in c:\RelEng\Projects\MbUnit v3.1\Work\src\Gallio\Gallio\Common
\Reflection\Impl\StaticCodeElementWrapper.cs:line 55
at
Gallio.Common.Reflection.AttributeUtils.<ResolveAttributes>d__c.MoveNext()
in c:\RelEng\Projects\MbUnit v3.1\Work\src\Gallio\Gallio\Common
\Reflection\AttributeUtils.cs:line 127
at
Gallio.Common.Reflection.AttributeUtils.<GetAttributes>d__0`1.MoveNext()
in c:\RelEng\Projects\MbUnit v3.1\Work\src\Gallio\Gallio\Common
\Reflection\AttributeUtils.cs:line 50
at
Gallio.Framework.Pattern.DeclarativePatternResolver.<GetPatterns>d__0.MoveNext()
in c:\RelEng\Projects\MbUnit v3.1\Work\src\Gallio\Gallio\Framework
\Pattern\DeclarativePatternResolver.cs:line 43
at
Gallio.Framework.Pattern.DefaultPatternEvaluator.GetPrimaryPattern(ICodeElementInfo
codeElement) in c:\RelEng\Projects\MbUnit v3.1\Work\src\Gallio\Gallio
\Framework\Pattern\DefaultPatternEvaluator.cs:line 203
at
Gallio.Framework.Pattern.DefaultPatternEvaluator.Consume(IPatternScope
containingScope, ICodeElementInfo codeElement, Boolean skipChildren,
IPattern defaultPrimaryPattern) in c:\RelEng\Projects\MbUnit v3.1\Work
\src\Gallio\Gallio\Framework\Pattern\DefaultPatternEvaluator.cs:line
147


For info, my ExpectedException attributes look like this, and they are
being successfully rendered through the Gallio front-end.

[Test]
[ExpectedException(typeof(FaultException<SystemFault>),
"Expected Exception message here...")]
public void MyTest()
{
}

[Test]
[Row(null, null, ExpectedException =
typeof(FaultException<SystemFault>), ExpectedExceptionMessage =
"Expected Exception message here...")]
public void MyTest2(int[] x, int[] y)
{
}

I am using Gallio bundle 3.1.397. Let me know if you need any more
info.

Kevin
> > mbunitdev+...@googlegroups.com<mbunitdev%2Bunsubscribe@googlegroups .com>
> > .

Graham Hay

unread,
Jul 30, 2010, 3:54:55 AM7/30/10
to mbun...@googlegroups.com
We've had a few bugs related to the, rather antiquated, version of Mono.Cecil we're using. It's on the list of things to fix (and pushing it's way to the front!). Could you raise an issue here please and, ideally, attach a sample that reproduces the error? Thanks.

To unsubscribe from this group, send email to mbunitdev+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages