Discussion:
Invalid SetUp method signature
Kelly Anderson
2008-08-06 18:13:34 UTC
Permalink
Hi folks, I'm using the 2.5 alpha, and got this message running my test case.

Reason: Invalid SetUp method signature

Here's my code:

using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using Sonic.IC5;

namespace IC5Test
{
[TestFixture]
public class ProfileConfigTests
{
private IDataMap _map;

[SetUp]
public void setup()
{
FileState fileState = FileState.GetFileState();
MockDirectory.SetTestRoot("TestRoot4");
IBytes bytes = new RandomAccessMemory( Constants.EEPROM_SIZE );
_map = E2MapBuilder.CreateMap( fileState.MapVersion, bytes, Side.Right );
}

[TestCase(1)] // Theory, what goes in comes out.
public void ProfileConfigSavesAndRetrievesDefaultDaiIndex(int value)
{
ProfileConfig config = new ProfileConfig(_map);
config.DefaultDaiIndex = value;
Assert.That(config.DefaultDaiIndex, Is.EqualTo(value));
Assert.That( _map.GetInt( MapConstants.REC_PROFILE_CONFIG,
"DefaultDaiIndex" ), Is.EqualTo( value ) );
}
}
}

Now everything worked fine when this was just a Test, so it has
something to do with converting Test to TestCase(1)... any thoughts?
Why would adding a parameter change the structural requirements of my
SetUp function?

-Kelly

-------------------------------------------------------------------------
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=/
Charlie Poole
2008-08-06 20:22:11 UTC
Permalink
I can't see why this would be at first glance, so please
file a bug. It would be useful to know if this only happens
when there is a single TestCase as opposed to more.

Charlie
-----Original Message-----
Behalf Of Kelly Anderson
Sent: Wednesday, August 06, 2008 11:14 AM
Subject: [nunit-developer] Invalid SetUp method signature
Hi folks, I'm using the 2.5 alpha, and got this message
running my test case.
Reason: Invalid SetUp method signature
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using Sonic.IC5;
namespace IC5Test
{
[TestFixture]
public class ProfileConfigTests
{
private IDataMap _map;
[SetUp]
public void setup()
{
FileState fileState = FileState.GetFileState();
MockDirectory.SetTestRoot("TestRoot4");
IBytes bytes = new RandomAccessMemory( Constants.EEPROM_SIZE );
_map = E2MapBuilder.CreateMap( fileState.MapVersion,
bytes, Side.Right );
}
[TestCase(1)] // Theory, what goes in comes out.
public void
ProfileConfigSavesAndRetrievesDefaultDaiIndex(int value)
{
ProfileConfig config = new ProfileConfig(_map);
config.DefaultDaiIndex = value;
Assert.That(config.DefaultDaiIndex, Is.EqualTo(value));
Assert.That( _map.GetInt(
MapConstants.REC_PROFILE_CONFIG, "DefaultDaiIndex" ),
Is.EqualTo( value ) );
}
}
}
Now everything worked fine when this was just a Test, so it
has something to do with converting Test to TestCase(1)...
any thoughts?
Why would adding a parameter change the structural
requirements of my SetUp function?
-Kelly
--------------------------------------------------------------
-----------
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
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=/
Kelly Anderson
2008-08-06 21:50:59 UTC
Permalink
Ok everyone, I was trying to reproduce the issue in a smaller project
to report the "bug"... and it seems to be a different issue than what
I initially thought. Here is the smallest code that causes a problem.
It would seem that SetUpFixture is doing validation that wasn't done
in 2.4.6... and because it's internal and the setup function is
private, it's failing. But I am pretty sure this worked in 2.4.6,
although I'm not 100% sure of that... weirdness.

Anyway, if I had to turn this into a request it would be for a more
meaningful message... something like "[SetUpFixture] Setup's
RunBeforeAnyTests function must be public" would be nice..." :-) The
current message is just a little to generic to be terribly helpful in
this situation.

using NUnit.Framework;
using NUnit.Framework.Syntax.CSharp;

namespace TestCaseBug
{
[TestFixture]
public class Tests
{
[SetUp]
public void setup()
{

}
[Test]
public void itWorks()
{
Assert.That(true, Is.True);
}
}

/// <summary>
/// This sets up the global environment for running tests.
/// </summary>
[SetUpFixture]
internal class Setup
{
[SetUp]
private void RunBeforeAnyTests()
{
}

[TearDown]
private void RunAfterAnyTests()
{
}
}
}


-Kelly

On Wed, Aug 6, 2008 at 2:22 PM, Charlie Poole
Post by Charlie Poole
I can't see why this would be at first glance, so please
file a bug. It would be useful to know if this only happens
when there is a single TestCase as opposed to more.
Charlie
-----Original Message-----
Behalf Of Kelly Anderson
Sent: Wednesday, August 06, 2008 11:14 AM
Subject: [nunit-developer] Invalid SetUp method signature
Hi folks, I'm using the 2.5 alpha, and got this message
running my test case.
Reason: Invalid SetUp method signature
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using Sonic.IC5;
namespace IC5Test
{
[TestFixture]
public class ProfileConfigTests
{
private IDataMap _map;
[SetUp]
public void setup()
{
FileState fileState = FileState.GetFileState();
MockDirectory.SetTestRoot("TestRoot4");
IBytes bytes = new RandomAccessMemory( Constants.EEPROM_SIZE );
_map = E2MapBuilder.CreateMap( fileState.MapVersion,
bytes, Side.Right );
}
[TestCase(1)] // Theory, what goes in comes out.
public void
ProfileConfigSavesAndRetrievesDefaultDaiIndex(int value)
{
ProfileConfig config = new ProfileConfig(_map);
config.DefaultDaiIndex = value;
Assert.That(config.DefaultDaiIndex, Is.EqualTo(value));
Assert.That( _map.GetInt(
MapConstants.REC_PROFILE_CONFIG, "DefaultDaiIndex" ),
Is.EqualTo( value ) );
}
}
}
Now everything worked fine when this was just a Test, so it
has something to do with converting Test to TestCase(1)...
any thoughts?
Why would adding a parameter change the structural
requirements of my SetUp function?
-Kelly
--------------------------------------------------------------
-----------
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
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=/
Charlie Poole
2008-08-07 00:26:20 UTC
Permalink
SetUp in SetUpFixture was always intended to have the same
validation as in a TestFixture - it could be we were failing
to check it earlier - I unified the checking recently.

The methods are checked for being non-abstract public methods
with no args, returning void. Maybe the message should just
say that.

Charlie
-----Original Message-----
Behalf Of Kelly Anderson
Sent: Wednesday, August 06, 2008 2:51 PM
Subject: Re: [nunit-developer] Invalid SetUp method signature
Ok everyone, I was trying to reproduce the issue in a smaller
project to report the "bug"... and it seems to be a different
issue than what I initially thought. Here is the smallest
code that causes a problem.
It would seem that SetUpFixture is doing validation that
wasn't done in 2.4.6... and because it's internal and the
setup function is private, it's failing. But I am pretty sure
this worked in 2.4.6, although I'm not 100% sure of that... weirdness.
Anyway, if I had to turn this into a request it would be for
a more meaningful message... something like "[SetUpFixture]
Setup's RunBeforeAnyTests function must be public" would be
nice..." :-) The current message is just a little to generic
to be terribly helpful in this situation.
using NUnit.Framework;
using NUnit.Framework.Syntax.CSharp;
namespace TestCaseBug
{
[TestFixture]
public class Tests
{
[SetUp]
public void setup()
{
}
[Test]
public void itWorks()
{
Assert.That(true, Is.True);
}
}
/// <summary>
/// This sets up the global environment for running tests.
/// </summary>
[SetUpFixture]
internal class Setup
{
[SetUp]
private void RunBeforeAnyTests()
{
}
[TearDown]
private void RunAfterAnyTests()
{
}
}
}
-Kelly
On Wed, Aug 6, 2008 at 2:22 PM, Charlie Poole
Post by Charlie Poole
I can't see why this would be at first glance, so please
file a bug.
Post by Charlie Poole
It would be useful to know if this only happens when there
is a single
Post by Charlie Poole
TestCase as opposed to more.
Charlie
-----Original Message-----
Behalf Of
Post by Charlie Poole
Kelly Anderson
Sent: Wednesday, August 06, 2008 11:14 AM
Subject: [nunit-developer] Invalid SetUp method signature
Hi folks, I'm using the 2.5 alpha, and got this message running my
test case.
Reason: Invalid SetUp method signature
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using Sonic.IC5;
namespace IC5Test
{
[TestFixture]
public class ProfileConfigTests
{
private IDataMap _map;
[SetUp]
public void setup()
{
FileState fileState = FileState.GetFileState();
MockDirectory.SetTestRoot("TestRoot4");
IBytes bytes = new RandomAccessMemory(
Constants.EEPROM_SIZE );
Post by Charlie Poole
_map = E2MapBuilder.CreateMap( fileState.MapVersion, bytes,
Side.Right );
}
[TestCase(1)] // Theory, what goes in comes out.
public void
ProfileConfigSavesAndRetrievesDefaultDaiIndex(int value)
{
ProfileConfig config = new ProfileConfig(_map);
config.DefaultDaiIndex = value;
Assert.That(config.DefaultDaiIndex, Is.EqualTo(value));
Assert.That( _map.GetInt(
MapConstants.REC_PROFILE_CONFIG, "DefaultDaiIndex" ), Is.EqualTo(
value ) );
}
}
}
Now everything worked fine when this was just a Test, so it has
something to do with converting Test to TestCase(1)...
any thoughts?
Why would adding a parameter change the structural
requirements of my
Post by Charlie Poole
SetUp function?
-Kelly
--------------------------------------------------------------
-----------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge Build the coolest Linux based applications with
Moblin SDK
Post by Charlie Poole
& 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
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=/
_______________________________________________
nunit-developer mailing list
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=/

Continue reading on narkive:
Loading...