I wanted to share my latest vision of what NJasmine (a test language
I was inspired to write after using Jasmine in javascript) is going.
I could use some input.  I was following Jasmine keywords very
closely, now I am going for given/when/then type keywords.

  Before much ado, here's a sample test with the revised keywords I'm
considering.  Please take a look:
http://github.com/fschwiet/DreamNJasmine/blob/master/NJasmine.Tests/PassingFixtures/GivenWhenThenFixture_supports_the_Basics.cs

  The test descriptiosn passed to given/when/then are fictitious,
normally they'd describe whats actually being run in the test.  For
the sample I'm using them to clarify the test structure/semantics.
GivenWhenThenFixtureis implemented, though the error messaging needs
to be updated to match the new keywords.

  While I have the keywords for "given"/"when"/"then" and "expect",
I'm not sure what to call "arrange" and "cleanup".  arrange
expressions are ran during the test, its used to indicate a resource
needs to be Dispose()d, or that an expression is slow enough it
shouldn't be run during test discovery.  Does anyone have a sense what
the BDD term would be for arrange or cleanup?  Or other feedback on
this sample test?
  Actually rather than 'arrange' I should use 'act' for this example,
since given the Arrange/Act/Assert test viewpoint it is part of the
'act' phase.  'arrange' and 'act' would be synonyms for the same
command, like 'given' and 'when' are really synonyms.

I want to point some things out:
  0. Ignore the 'RunExternal' attribute, thats used for NJasmine's
internal testing.
  1. Every "then" expression results in a separate test.  All test
initialization runs once per test.  You can share state across tests,
but it takes some extra work.  In this example, the variables are
initialized once per test, no values are shared.
  2. Resources returned by an arrange() statement will be properly
Dispose()d.
  3. The allusion to 'test discovery' needs more explanation to use
this test language appropriately.  I put my hope in your intuition for
now :)

  GivenWhenThenFixture is new, but I've been using the underlying
NJasmine implementation quite a bit and I do like it.  Its only runs
within the NUnit console and GUI runners (NUnit 2.5.9), I haven't
tried supporting TD.NET/Resharper/etc.

  The difference between given/when and arrange/act is that given/when
branches the text context.  arrange/act only extend the current
context.  I'm considering a fork command along the same veins, but am
not sure what to call it.  Pseudocode, it would be something like:

  var browser = fork("using brower", {
            "Firefox" => new Watin.Firefox(),
            "Internet Explorer" => new Watin.InternetExplorer()
            });

  This sample would double the remaining tests, creating one version
that runs with browser == new Firefox() and the other running with
browser == new InternetExplorer().

  Sorry for the length post.  :)  This thing occupies quite a few
spare cycles for me.

-- 
You received this message because you are subscribed to the Google Groups 
"Seattle area Alt.Net" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/altnetseattle?hl=en.

Reply via email to