-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to implement a Precision Tolerance feature #176
Comments
Take a look at Cell Operators (https://fitsharp.github.io/Fit/CellOperators.html). You can write a CompareOperator that implements your own logic to compare cell values. See the CompareXxxx classes in source/fitSharp/Fit/Operators for some examples. |
Thank you @jediwhale I also tried adding the operator in code, first in my test constructor but moved it to the Execute method because Processor was null, however in Execute() Processor is also null so I tried this:.
It did not fail to run but it also did not call
Any hint on what the missing link is to get it to use the new |
I don't see anything wrong in what you did. Here's a silly little working example I just wrote. See if you can make this work for you.
Run tests with command (this is on Linux): This makes any integer compare to '42' fail, so result is one pass and one fail |
Thank you @jediwhale , Indeed your example does work. Sample.cs:
sampleTest.txt
I had to do some more stuff to get it working, like running Fitnesse.jar and copying Runner.exe to the output directory. As you can see, 42 is not failing. (I did not change |
I'll try your example and see if I can reproduce your results. |
You are using fitSharp.Slim.Service.Runner in your COMMAND_PATTERN. This uses the Slim test system which does not support cell operators. You need to use the Fit test system with fitnesse.fitserver.FitServer as the runner, via the -r option in COMMAND_PATTERN or Runner node in the suite configuration file. (See https://fitsharp.github.io/FitSharp/SuiteConfigurationFile.html) |
Thank you, that was it! This is the class (hope someone will find it useful):
|
I am trying to add a tolerance feature for a project we have (a large scale rewrite, where the new codebase is tested against the old tests, but are failing because there is a lot less intermediate rounding during calculations).
I tried to override the methods:
DoCell(Parse cell, int column){}
Wrong(Parse cell)
Wrong(Parse cell, string actual)
However these methods are never called! (using ColumnFixture but also tried on DoFixture)
I put a breakpoint inside a method that gets a result and tried to find the comparison in the stack, but either I missed it or the code is first gathering all the values before doing the comparisons...
After spending some hours reverse engineering I thought it would be better to just ask where the compare magic happens?
If I succeed in adding a good working tolerance feature I'll return with a nice and tidy pull request :-)
The text was updated successfully, but these errors were encountered: