Interpret a variable in a table marked with an exclamation mark - fitnesse

I have a method that take a screenshot (a bmp file), and return it path. The file is stored in a directory name passed as parameter, which is the name of the current test, and I want the file name to be prefixed by the actual date:
!define date {!today (YYYYMMddhhmmss)}
!|script |screenshot |
|$capture=|take screenshot;|${RUNNING_PAGE_NAME}|${date}_{$file_name}|
My problem is the RUNNING_PAGE_NAME variable is interpreted only if I put an exclamation mark before the table (else Fitnesse render a link to the actual page). But, because of the exclamation mark, the date isn't interpreted anymore and I have this result:
!today (YYYYMMddhhmmss)_file_name
What I want instead:
20220704083616_file_name
Is there a solution that allows to tell Fitnesse to interpret some variables but not all ones ?

You can use a ^ instead of an exclamation mark. That way the wiki will parse symbols, but not links/e-mail adresses.
See documentation at: http://fitnesse.org/FitNesse.UserGuide.FitNesseWiki.MarkupLanguageReference.MarkupTable

Related

How to search Graylog with a partial Text match

The wildcards seem to only apply to non-string literals and text.
I want to match the text on a partial match.
Example:
source: org.*.application-* AND "*.pdf"
The wildcard works with the source param but not instead of my literal.
How can I use a wildcard inside a string to get back all that match that contains a log with
"XXXXXXXXXXXX.pdf"
Okay - it turns out you remove the quotes - Anytime you add quotes the whole word must match
so this turns out to be the equivalent of what I was asking for:
source: org.*.application-* AND *.pdf

messages file is not picking single quote

In Play Framework, the messages file is used for localisation. I have added the following key-value in it but the single quote in the value is not getting picked.
error.incorrectTag = The specified tag doesn't exist in the system
When I print the above message using the following code
println(s"${messagesApi("error.incorrectTag")(langs.availables(0))}")
I see The specified tag doesnt exist in the system (single quote is not there)
How can I print the single quote?
You need to escape the single quote ' by using a double single quote '' like this:
error.incorrectTag = The specified tag doesn''t exist in the system

substitute space character in lua

I am creating a template in Wikipedia to link articles to an external website which is a book archive called fadedpage.com. I am generating a url to link to a specific author page. Part of the url is the author's name which contains one or more spaces. For example, the url for the author "Ian Fleming" is: http://fadedpage.com/csearch.php?author=Fleming, Ian. My template call structure is {{FadedPage|id=Fleming, Ian|name=Ian Fleming|author=yes}}.
For my template I am replicating an existing template which uses a script coded in lua to parse the template arguments. I have been able to generate all of the url except for the space character between the last and first name.
I could code the template call as: {{FadedPage|id=Fleming,%20Ian|name=Ian Fleming|author=yes}} which works OK but I would rather have the call format as it looks on the fadedpage website, ie. with the embedded space. So I need a way in lua to find the space character within the string and substitute it for the string "%20". So far I haven't figured out how to do it. Any help would be appreciated.

Fitnesse test against empty string result

I'm using Fitnesse SliM and I want to check if the result of a fixture is the empty string. Leaving the result field in Fitnesse empty just results in an ignored test which is obviously not what I want. I could solve this by extending the fixture code, but I wonder if this can be handled within Fitnesse itself.
It seems that Slim implies an empty string as an ignore, at least for the QueryTable fixture: A cell that is left blank in the table will be filled in from the result and counted as ignored.
Even though this is not considered a good solution, if you really have to you could use a regular expression to test on an empty string by matching on
=~/^$/
Another option is using the null fixture driver, as seen in http://fitnesse.org/FitNesse.SuiteAcceptanceTests.SuiteSlimTests.SlimSymbolsCanBeBlankOrNull
passing the word 'blank' simulates a empty string.
like:
|Check|That the returned string is | blank |
In this case - when you need to check with SLIM usage, whether the result is an empty string, you can use markup variable. Just define it somewhere on your page with test, like:
!define blank {}
And then call it anywhere you want:
|check|SomeFixtureName|${blank}|

what if html_escape would stop escaping '&'?

is there any danger if the rails html_escape function would stop escaping '&'? I tested a few cases and it doesn't seem to create any problems. Can you give me a contrary an example? Thanks.
If you put an unescaped "&" into an HTML attribute, it would make your page invalid. For example:
Link
The page is now invalid as the & indicates an entity. This is true for any usage of an & on a page (for example, view source and hopefully you'll notice that Stack Overflow escapes the & signs in this post!)
The following would make the above example valid:
Link
Additional Note
& characters do need to be escaped in URLs if you want to validate your markup against the W3C validator. Example:
Line 9, Column 38: & did not start a character reference.
(& probably should have been escaped as &.)
Example
change an url with adding some argument

Resources