jediwhale / fitsharp

Functional testing tools for .NET
http://fitsharp.github.io
Other
152 stars 73 forks source link

Unable to use symbol for full fixture name #116

Closed reprive closed 8 years ago

reprive commented 11 years ago

I am trying to setup the fixtures chaining scenario as described in http://tech.groups.yahoo.com/group/fitnesse/message/15578 using FitSharp 2.2 (.Net 4.0) instead of Java,with FitNesse v20130530. I created the necessary fixtures (EchoFixture, TestSlim, TestQuery) in C#, but get an exception when executing the tests in FitNesse, which I suspect is a bug in FitSharp.

Here is the FitNesse test page:

!path "TestSlim.dll" !|import| |fitnesse.slim.test|

!|script|echo fixture| |$TEST_SLIM=|echo|Test Slim|

!|script| $TEST_SLIM| |ensure|echo boolean|true|

!|script|echo fixture| |$QUERY=|echo|Query|

!|Query:Test$QUERY|1| |n|2n| |1|2|

Here is the output:

image

When I change the symbol definition to |$TEST_SLIM=|echo|est Slim| and the script to !|script| T$TEST_SLIM| then it works fine:

image

It seems that it is not possible to use symbols for the full name of a fixture (that is where the exception occurs, and apparently the fixture name is resolved to System.String instead of to TestSlim), but it is possible to use a symbol for part of a fixture name (the TestQuery fixture is correctly identified and executed).

jediwhale commented 11 years ago

This seems to be as specified, although it does seem a little odd. From http://fitnesse.org/FitNesse.UserGuide.SliM.SlimProtocol

[0.2] Fixture Chaining: Symbols can be used in the Make command to represent a class name. If the argument of the Make command contains '$' characters, then Slim should replace any symbols that have been created by previous callAndAssign commands. This allows FitNesse to compose fixture names from symbols set by fixtures, and therefore enables fixture chaining.

[0.3] Symbol Copy: If consists entirely of a single symbol name prefixed with $, then the item from the dictionary of symbol values with the symbol name is added to the dictionary of created objects with the name . The strings are ignored and no constructor is called.

In version 0.2, fixture chaining was specified, as shown in the sample that you found. In version 0.3, it was modified with the addition of symbol copying to the behavior that you now see.

I'm not a Slim guru, so I may be interpreting this incorrectly or have missed a later spec version. I suggest posting on the fitnesse yahoo group to see what the expected slim behavior is.

reprive commented 9 years ago

It's been a while, but I didn't get any responses on the FitNesse Yahoo group. However there is an acceptance test case in the FitNesse test suite at http://www.fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteSlimTests.ChainTest that shows the behavior that I expected. I ran it locally on FitNesse 20140901:

chaintest

I think that the symbol copy specification that you refer to is intended to allow the "get fixture" function to work (which currently works fine in FitSharp, I tested that with a simple function):

fixture chain 2

But the acceptance test above suggests that this should only be done for fixture types, and that for string type symbols, the content of the string should be taken instead.

reprive commented 9 years ago

Mike,

I revived the thread on Yahoo (see https://groups.yahoo.com/neo/groups/fitnesse/conversations/messages/21278) and the verdict is that the Java implementation is the right one (a comment was "the description for Symbol copy is misguiding"). Would this be easy to fix in FitSharp?

jediwhale commented 9 years ago

Yes, I'll make the change

On 2015-05-19 00:31, reprive wrote:

Mike,

I revived the thread on Yahoo (see https://groups.yahoo.com/neo/groups/fitnesse/conversations/messages/21278) and the verdict is that the Java implementation is the right one (a comment was "the description for Symbol copy is misguiding"). Would this be easy to fix in FitSharp?

— Reply to this email directly or view it on GitHub https://github.com/jediwhale/fitsharp/issues/116#issuecomment-103362952.

Cheers, Mike Stockdale

/fit/Sharp http://fitsharp.github.com Syterra Software Inc. http://www.syterra.com