Fitnesse Slim: How to concatenate symbol - concatenation

How would one concatenate a symbol with text on either side?
For example:
Prefix: "GAR_"
Variable: $todayDate
Suffix: "_1"
GAR_$todayDate_1
Which would evaluate to:
GAR_07202012_1
When running the test in fitnesse, it seems as though the concatenation is working (GAR_$todayDate->[07202012]_1). However, I am passing this value as a parameter to visual studio and I instead end up with the following text: GAR_$todayDate_1.
When I remove the suffix or put a space between $todayDate and "_1", everything works as expected.
Any help would be appreciated.
Things I have tried:
GAR_!-$todayDate-!_1
GAR_$todayDate!-_1-!
GAR_$todayDate${SUFFIX} - static variable defined
Thanks,
Mike

I am stuck with the same problem currently.
The only way I found was to:
create a StringSupport class with a String concatenate(String s1, String s2) method
import the package of that class in your FitNesse test
put StringSupport in the available libraries in your FitNesse test with the Library table
in your Script, you can now do: |$result=|concatenate;|$s1|$s2|
To fit your exact use case, you just have to do the same concatenate() with 3 strings instead of just one.

Related

LogicApp Split and Replace having problems with \n

I have been trying to split a string into an array of each line \n
As this doesn't work I tried replacing replace(outputs('Compose_6'),'\r\n','#') with a view to then splitting on #.
I have searched the internet and tried various things but nothing seems to work.
Can someone explain how to do this?
Thanks in advance
Using split(variables('string var'),'\n') expression, you can split string into array. By default logic app will add an extra black slash to original back slash. So suggesting you to change expression in code view as mentioned above.
I have created logic app as shown below,
In first initialize variable action, taken a string variable with text as shown below
Hello
Test split functionality
Using logic apps
Next initialize variable action, using a array variable and assigning value using expression as split(variables('string var'),'\n'). Make sure you dont have double back slash added in code view. Only one back slash should be there when you see it in code view.
Code view:
The output of logic app can be shown below,
Refer this SO thread.

Confusion about translate() function while using it for xpath case insensitivity

I am automating a page using selenium with java and trying to use a case insensitive xpath with the help of translate function as follows.
driver.findElement(By.xpath("//a[contains(translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),'tools')]")).click();
'tools' text exists on the page as 'Tools'. [T as caps]
Now my question is,
What does '.,' means in the above code?
Using 'tools' in place of '.,' gives all the //a links. Reason?
Whenever I use 'Tools' instead of 'tools' in the above code, it does not work.
Someone help me here.
image 1
image 2
Now my question is,
What does '.,' means in the above code?
Using 'tools' in place of '.,' gives all the //a links. Reason?
Whenever I use 'Tools' instead of 'tools' in the above code, it does not work.
The dot step is an abbreviated syntax, from the specs:
. selects the context node
Because it's used as parameter for a function that expects a string, will be casted by the means of string() function.
The string 'tools' always contains the string 'tools', thus you are not filtering any selected a element when you used instead of .
In the other hand, any lowercase string will never contain the string 'Tools', so you won't be able to select anything.

Angular NgTagsInputs - RegEx - Allow all values expect Strings

I'm using ngTagsInput where I want to allow all tags expect a few strings.
In their documentation it appears I can specify allowed tags through a regex but I can seem to work it out - been trying http://regexr.com/ for last hour with no luck.
So for example the strings I dont want to be accepted are:
story and global.
How do i go about to say everything is allowed expect those 2?
So for example storyBreaking is allowed but story is not.
Thanks.
try something like that:
(?<![\w\d])abc(?![\w\d]) where abc is your string to match!

User Script replacing all instances of a string instead of specific instances

I've been learning about user scripts and I've been messing around with Joe Simmon's Script when I came across a problem. Say for example that I have a webpage that says 'I want to go to a park.' If I want to replace 'a' with 'the', it would produce 'I wthent to go to the ptherk.' instead of 'I want to go to the park.' Is there any way to change to code so that it would replace the instances of 'a' where it is a word by itself instead of every instance of a in every string. And can you explain what you are doing so that I may learn. Thanks.
That code has an example: '/\\bD\\b/g' : '[D]', the symbol \\b denotes a word boundary.
You'll need '/\\ba\\b/g' : 'the' and '/\\bA\\b/g' : 'The'.

Unterminated string literal error while storing lesson_location

I have this error that doesnt give any indication as to what is the problem:
I'm trying to store this string in lesson_location field:
B^$eNrT0srLywNiLRANpiAsMAknoMKognlwdUi6ERrQuDARmCwmE2EMslOQ9aFaguw6dKyllQxhJcNp TFBTk1iSWhBvYBhvYGAKABXXVRI&#3d;
but it throws SyntaxError: unterminated string literal
when I've modified the way the reload stores the data in ReloadAPIAdaptor.js
from using eval on entire string:
eval("this.cmi.core.lesson_location.cmivalue =\"B^$eNrT0srLywNiLRANpiAsMAknoMKognlwdUi6ERrQuDARmCwmE2EMslOQ9aFaguw6dAzXnJwMozFB TU1ual4pAMimU3Q&#3d;\";");
to evaluate object first:
var o = eval("this." + element);
console.log("o",o);
if(o) o.cmivalue = value;
then it stores data without error,
now I can't modify the code in any lms so this was only to identify if the string can't be stored but it can. Just evil doesnt work so the question is what is in the given string that eval doesnt like and how to fix it.
There is nothing wrong with your string if you're doing the following:
API.SetValue("cmi.core.lesson_location", "B^$eNrT0srLywNiLRANpiAsMAknoMKognlwdUi6ERrQuDARmCwmE2EMslOQ9aFaguw6dKyllQxhJcNp TFBTk1iSWhBvYBhvYGAKABXXVRI&#3d;");
(where API is a reference to the window's API object)
The string is valid as far as SCORM is concerned, and the length falls within the acceptable character limit.
If you're encountering an issue, it might be a bug within the Reload wrapper. Frankly, the code in the Reload wrapper (as found on SourceForge) is TEN years old. It uses eval() and other JavaScript techniques that have been identified as problematic, and are highly discouraged by leading JavaScript developers. Your bug might very well be related to the wrapper's use of eval().
I'd try using a different wrapper and see if it makes a difference.

Resources