First point under b)
- I gave it second(fifth...) thought and it seems to be possible to
avoid need for such timers. If some part of the functions need to be
tested on duration inside one NUnit test user can use windows methods
for measuring time and at the end write them to Assert.Pass as
argument e.g:
Assert.Pass ("123.45ms");
The problem here is that I can not find where string passed as
argument to Assert.Pass is written ? I can not find it in
TestResult.xml file ?
Point under a)
the idea was that some new attribute which has the name "[SetUpLocal]"
would act as [SetUp] just at the level of every unit test method.
Proposed workaround with try-finally block could do the workaround, if
not "I'll be back" on this thread :)
Br,
Milan.
> >http://groups.google.com/group/nunit-discuss?hl=en.- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
First point under b)
- I gave it second(fifth...) thought and it seems to be possible to
avoid need for such timers. If some part of the functions need to be
tested on duration inside one NUnit test user can use windows methods
for measuring time and at the end write them to Assert.Pass as
argument e.g:
Assert.Pass ("123.45ms");
The problem here is that I can not find where string passed as
argument to Assert.Pass is written ? I can not find it in
TestResult.xml file ?
Point under a)
the idea was that some new attribute which has the name "[SetUpLocal]"
would act as [SetUp] just at the level of every unit test method.
Proposed workaround with try-finally block could do the workaround, if
not "I'll be back" on this thread :)
Br,
Milan.
On 16 Dez., 18:16, "Charlie Poole" <char...@nunit.com> wrote:
> First point under b)
> - I gave it second(fifth...) thought and it seems to be
> possible to avoid need for such timers. If some part of the
> functions need to be tested on duration inside one NUnit test
> user can use windows methods for measuring time and at the
> end write them to Assert.Pass as argument e.g:
> Assert.Pass ("123.45ms");
Yes, or write it to console if that's good enough for your needs.
> The problem here is that I can not find where string passed
> as argument to Assert.Pass is written ? I can not find it in
> TestResult.xml file ?
That's been requested but is not available yet. Currently, the
only place you can see the message is in the Test Properties
dialog of the Gui.
> Point under a)
> the idea was that some new attribute which has the name "[SetUpLocal]"
> would act as [SetUp] just at the level of every unit test method.
> Proposed workaround with try-finally block could do the
> workaround, if not "I'll be back" on this thread :)
Yes, that's the part I already understood. :-)
But an attribute has to appear be placed on something, so I'm asking
for an example showing a test method with a local setup as you
envision it. I really can't picture how this would work.
Charlie
Point under a):
- I am looking forward of getting reacher TestResult.xml with adequate
support with nunit-result, HTML reporter.
under point b) example could be:
[Test, Description("Test method")]
public void NUniteTestMethod()
{
[SetupLocalStart]
// do some local initializations valid only for this NUnit test
method
// ...
[SetupLocalEnd]
// do some test
// ...
Assert.Pass/Fail();
[TearDownLocalStart]
// do some clean up, related to only this NUnit method
// ...
[TearDownLocalEnd]
}
I am not expert in .NET programming so I am not sure that one can
simple write new Attribute(e.g. SetupLocalStart) somwhere in the
middle of code but if possible above pseudo code could do the job.
Br,
Milan.
> Point under a):
> - I am looking forward of getting reacher TestResult.xml with
> adequate support with nunit-result, HTML reporter.
The xml format needs to remain backward compatible for NUnit 2.x.
With 3.0, we'll redefine it although we may need to keep some sort
of /oldxmlformat option.
So, for any additive change that won't mess up folks who use their
own XSL to reformat TestResult.xml, you could file a request against
NUnit 2.5. But for incompatible changes, it should go against
NUnit 3.0.
> under point b) example could be:
>
> [Test, Description("Test method")]
> public void NUniteTestMethod()
> {
>
> [SetupLocalStart]
> // do some local initializations valid only for this
> NUnit test method
> // ...
>
> [SetupLocalEnd]
>
> // do some test
> // ...
>
>
> Assert.Pass/Fail();
>
>
>
> [TearDownLocalStart]
> // do some clean up, related to only this NUnit method
> // ...
>
> [TearDownLocalEnd]
>
> }
>
> I am not expert in .NET programming so I am not sure that one
> can simple write new Attribute(e.g. SetupLocalStart) somwhere
> in the middle of code but if possible above pseudo code could
> do the job.
No, it's not possible, which was the reason for my question.
Attributes have to attach to an element in the file, for example
a method or a class.
Aside from that, your example with multiple setup's and tests
matches the pattern...
Arrange
Act
Assert
Arrange
Act
Assert
which most folks consider an anti-pattern. That is, if your test
needs two stages of setup, then it is apparently testing two
different things and should be split.
Charlie
point under a):
I am not familiar with compatibility issues but if additional
parameters are written to TestResult.xml that should not disturb xml
parser in nunit-result tool right (new items are ignored normally) ?
So writting "message" text passed as argument to Assert.Pass/fail
("message") to xml file should not affect compatibility in any NUnit
version.
In what Bug/Feature is going to be handle this problem ?
point under b):
now I do not understand where do I have mention patern of two times
"Act". I have Initialization/Act/Assert/Deinitialization and that's
it, so no two stages. There is proposed two stages of setup, first
global for the whole class and than local for Unit test.
Workaround with "try-finally" would do the job too so let us
concentrate on point "a)".
Having nice test report is the only thing I can show to the my boss
and in this moment it looks pretty poor :(
Br,
Milan.
> ...
>
> read more »
> point under a):
> I am not familiar with compatibility issues but if additional
> parameters are written to TestResult.xml that should not
> disturb xml parser in nunit-result tool right (new items are
> ignored normally) ?
Yes, this is what I meant by an "additive change"
> So writting "message" text passed as argument to Assert.Pass/fail
> ("message") to xml file should not affect compatibility in
> any NUnit version.
Correct.
> In what Bug/Feature is going to be handle this problem ?
We have a feature request in Sourceforge to do this...
http://sourceforge.net/tracker/?func=detail&aid=2693430&group_id=10749&atid=
360749
Sourceforge feature requests are in the process of being moved
to our Launchpad site, so unfortunately you sometimes have to
look in both places.
I'm guessing you would like this one to be given more priority. :-)
>
> point under b):
> now I do not understand where do I have mention patern of two
> times "Act". I have
> Initialization/Act/Assert/Deinitialization and that's it, so
> no two stages. There is proposed two stages of setup, first
> global for the whole class and than local for Unit test.
> Workaround with "try-finally" would do the job too so let us
> concentrate on point "a)".
Your example appeared to show moving on to a second test in the
same method... I may have misunderstood your intent.
> Having nice test report is the only thing I can show to the
> my boss and in this moment it looks pretty poor :(
Unfortunately, NUnit can do little to help with a boss who puts
priority on the wrong things!
Charlie
> > In what Bug/Feature is going to be handle this problem ?
>
> We have a feature request in Sourceforge to do this...
> http://sourceforge.net/tracker/?func=detail&aid=2693430&group_
> id=10749&atid=360749
>
> Sourceforge feature requests are in the process of being
> moved to our Launchpad site, so unfortunately you sometimes
> have to look in both places.
>
> I'm guessing you would like this one to be given more priority. :-)
See https://bugs.launchpad.net/nunitv2/+bug/498630
Charlie
>Unfortunately, NUnit can do little to help with a boss who puts
>priority on the wrong things!
Hi Charlie,
:-) dont say so ... he will force me to use some other unit tool...and
I do not want that :)
The really point is that having nice overview with comments for pass/
fail/... brings more information to the tester (like proposed that in
Assert.Pass message is written e.g. test duration or something else)
and that is what at the end counts.
Milan.