Support for [SuiteBuilder] attributes in Resharper 2.0?

We've got some unit tests that are generated via the
attribute to make some of our unit testing easier. This attribute
indicates a class that is queried for each public class in the assembly
under test using the ISuiteBuilder attribute.

Will Resharper 2.0 be able to support this dynamic addition of tests?
Note that these dynamic tests will only have source types, but no source
methods.

Thanks,
Matt.

3 comments
Comment actions Permalink

What the SuiteBuilderAttribute is?
I haven't found any mentions to it in NUnit.....

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Matthew Mastracci" <matt@aclaro.com> wrote in message
news:dq6i6q$h3j$1@is.intellij.net...

We've got some unit tests that are generated via the
attribute to make some of our unit testing easier. This attribute
indicates a class that is queried for each public class in the assembly
under test using the ISuiteBuilder attribute.

>

Will Resharper 2.0 be able to support this dynamic addition of tests? Note
that these dynamic tests will only have source types, but no source
methods.

>

Thanks,
Matt.



0
Comment actions Permalink

Eugene Pasynkov (JetBrains) wrote:

What the SuiteBuilderAttribute is?
I haven't found any mentions to it in NUnit.....


It's an attribute that defines a dynamic test suite builder in a given
test attribute.

I haven't been able to find much NUnit documentation about it, though.

Usually, you use it to tag custom test suites types with it that you
build your own test suites from. It's useful for autogenerating a large
number of tests programatically or from external sources.

What you do is make a class derived from ISuiteBuilder with it:


public class MySuiteBuilder : ISuiteBuilder
{
public bool CanBuildFrom( Type type )
{
MyFixtureAttribute[] affa = ( MyFixtureAttribute[]
)type.GetCustomAttributes( typeof( MyFixtureAttribute), false );
if ( affa.Length == 0 )
return false;

return true;
}

public TestSuite BuildFrom( Type type, int assemblyKey )
{
MyFixtureAttribute[] affa = ( MyFixtureAttribute[]
)type.GetCustomAttributes( typeof( MyFixtureAttribute), false );
return new MySuite( type, affa[ 0 ].RootFixture, assemblyKey );
}
}

public class MySuite : TestSuite
{
public MySuite ( Type tp, string strRootFixture, int assemblyKey )
: base( tp, assemblyKey )
{
this.Add( new MyTest( tp ) );
}
}

public class MyTest : TestCase
{
private Type _tp;
public MyTest( Type tp )
{
_tp = tp;
}

public override void Run( TestCaseResult result )
{
result.Success();
}
}

0
Comment actions Permalink

I think wi'll support it, but not in 2.0 release. This support will be
included in one of the maintenance releases

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Matthew Mastracci" <matt@aclaro.com> wrote in message
news:43C7CC9F.6000607@aclaro.com...

Eugene Pasynkov (JetBrains) wrote:

>
>> What the SuiteBuilderAttribute is?
>> I haven't found any mentions to it in NUnit.....
>

It's an attribute that defines a dynamic test suite builder in a given
test attribute.

>

I haven't been able to find much NUnit documentation about it, though.

>

Usually, you use it to tag custom test suites types with it that you build
your own test suites from. It's useful for autogenerating a large number
of tests programatically or from external sources.

>

What you do is make a class derived from ISuiteBuilder with it:

>


public class MySuiteBuilder : ISuiteBuilder
{
public bool CanBuildFrom( Type type )
{
MyFixtureAttribute[] affa = (
MyFixtureAttribute[] )type.GetCustomAttributes( typeof(
MyFixtureAttribute), false );
if ( affa.Length == 0 )
return false;

>

return true;
}

>

public TestSuite BuildFrom( Type type, int assemblyKey )
{
MyFixtureAttribute[] affa = (
MyFixtureAttribute[] )type.GetCustomAttributes( typeof(
MyFixtureAttribute), false );
return new MySuite( type, affa[ 0 ].RootFixture, assemblyKey );
}
}

>

public class MySuite : TestSuite
{
public MySuite ( Type tp, string strRootFixture, int assemblyKey )
: base( tp, assemblyKey )
{
this.Add( new MyTest( tp ) );
}
}

>

public class MyTest : TestCase
{
private Type _tp;
public MyTest( Type tp )
{
_tp = tp;
}

>

public override void Run( TestCaseResult result )
{
result.Success();
}
}



0

Please sign in to leave a comment.