unclebob / fitnesse

FitNesse -- The Acceptance Test Wiki
fitnesse.org
Other
2.02k stars 713 forks source link

Suggestion : ability to use style or note in tables #69

Closed EricD2 closed 11 years ago

EricD2 commented 12 years ago

Whenever I use some widget to have some markup or to write a note in a table, the comparison fails : the expected value is the rendered one.

It seems, all is needed is another method in ParentWidget along asWikiText and render to provide the value to use for comparison. In ParentWidget, this method would return the same as render(), but subclasses may override it, for instance NoteWidget would return an empty String.

By the way, I'm using SLIM, I don't know if there is the same problem in FIT.

jediwhale commented 12 years ago

I would be concerned about backwards compatibility - there may be tests that rely on the rendered value appearing in the table cells.

EricD2 commented 12 years ago

I understand your concern, but in this case, the result depends on the style applied or the comment written : how could someone think this would be robust ?

In any case, we could offer this enhancement without changing existing widgets : one could add his own, which allow a more simple and more robust comparison.

amolenaar commented 12 years ago

I'm not really clear on this.

Do you mean that, if you have a table

| check | some value | !note a comment |
| check | url | http://fitnesse.org |

SliM compares the output of someValue() with <span class="note">a comment</span> and the output of url() with <a href="http://fitnesse.org">http://fitnesse.org</a>?

EricD2 commented 12 years ago

I don't know what really happens. Maybe Slim compares with "!note a comment" but the results get interpreted after. Here is my Test class :

public class Test {
    public String someValue() {
        return "";
    }
    public String url() {
        return "http://fitnesse.org";
    }
}

and the result I get : http://imageshack.us/photo/my-images/593/testzk.jpg/ using

|script|Test                          |
|check |some value|!note a comment    |
|check |url       |http://fitnesse.org|
amolenaar commented 12 years ago

Hi,

This doesn't look sound to me. What confuses me is that you want to check the output from the someValue() call with a comment.

What you want is the ability to add additional comments to the lines in a script. For that you can also use | note | command in the script table:

|script|Test                          |
|note  |a comment about the next line |
|check |some value|                   |
|check |url       |http://fitnesse.org|

At least, that's how I use it. I tend to make the note content bold ('''text'''), so it is more visible.

EricD2 commented 12 years ago

Hi,

I don't want to compare to the comment, but that's what fitnesse does. Maybe if I put a value it's more understandable ? Suppose someValue() returns "someValue", the cell content would be "someValue !note this a comment explaining the value."

I know I can put additional note in a script table, that's not what I want : I want value comparison to be based on real content, not rendered one : do not take style into account, ignore comments, etc. You didn't mention the url example, don't you think the check url should pass ?

amolenaar commented 12 years ago

The point (problem if you like) is that tests are performed with the rendered wikitext (html). It looked weird to me when I saw that the first time (and the second time..).

I share Mike's concern about backwards compatibility, but yes: I would expect the url to pass.

A solution might be to define another test system (slim2?). With the new parser we have a better grip on how tests are handled.

jediwhale commented 12 years ago

FitNesse has 2 separate components - a wiki that lets you compose web pages (HTML) in a wiki markup language, and a test execution component that lets you execute HTML tables as tests. So, SLIM never sees the wiki markup - it sees the rendered HTML. What you're proposing, while doable, would be a fundamental change to this separation of concerns.

To stop the url from being rendered as a hyperlink, you can write it as a literal !-http://blah.blah-!

EricD2 commented 12 years ago

Thank you for your answers. I guess this is not as easy as I thought, too bad :/. Should I close this issue ?

woodybrood commented 11 years ago

No one got back to you on this. I think we should close this. I'll go ahead and do that. It can always be reopened if someone feels there is a strong case and provides a possible approach.