Cucumber version - 6.9.1 - Couldn't pass blank string in Scenario Outline "Examples" - cucumber-jvm

After upgraded cucumber version to 6.9.1, blank (empty string) couldn't be passed in Examples.
Passing empty strings used to be possible before
Scenario Outline : Testing datatable with empty string
When passing "<first>" and "second>" as String parameter
Then exception should be thrown
Examples:
| first | second |
| simple | |

I am able to use this in cucumber-java version 6.9.1 . Just tested it
Scenario Outline: example
Given I log <TestString>
Examples:
|TestString|
|" " |
#Given("I log {string}")
public void logSomething(String teststr ) {
System.out.println("sample text:"+ teststr+"somethingtoIdentifySpace");
}
Prints this
sample text: somethingtoIdentifySpace

Related

Selenium IDE Chrome - Regex

I am trying to get Selenium IDE to check some text and make sure it is Numbers Only, I have created the below (using Google) and it seems to fail each time.
Error :
assertText on css=tbody > tr:nth-child(1) > td:nth-child(1) with value regexpi:^[0-9]+$ Failed:
09:44:54
Actual value "10640355" did not match "regexpi:^[0-9]+$"
enter image description here
Can anyone tell me what I need to change, or have a step by step guide on how to add this check properly
https://www.selenium.dev/selenium-ide/docs/en/api/commands#assert-text
Regex is not supported for assert text:
https://github.com/SeleniumHQ/selenium-ide/issues/141 for details.
Workaround:
screenshot
code:
store text | css=tbody > tr:nth-child(1) > td:nth-child(1) | actualText
execute script | return RegExp('^[0-9]+$','g').test(${actualText}) | isNumber
assert | isNumber | true

Chrome Selenium IDE 3.4.5 extension "execute script" command not storing as variable

I am trying to create a random number generator:
Command | Tgt | Val |
store | tom | tester
store | dominic | envr
execute script | Math.floor(Math.random()*11111); | number
type | id=XXX | ${tester}.${dominic}.${number}
Expected result:
tom.dominic.0 <-- random number
Instead I get this:
tom.dominic.${number}
I looked thru all the resources and it seems the recent selenium update/version has changed the approach and I cannot find a solution.
I realize this question is 2 years old, but it's a fairly common one, so I'll answer it and see if there are other answers that address it.
If you want to assign the result of a script run by the "execute script" in Selenium IDE to a Selenium variable, you have to return the value from JavaScript. So instead of
execute script | Math.floor(Math.random()*11111); | number
you need
execute script | return Math.floor(Math.random()*11111); | number
Also, in your final assignment that puts the 3 pieces together, you needed ${envr} instead of ${dominic}.

"-" character is converted to ? in console for gherkin language used in cucumber feature file

I am using cucumber feature file to execute or write my test cases. Issue is that I am using data table as :
| abc | 1234567890 |
| defg | New Activation – Monthly (Credit in store) |
Now issue is this that console is throwing an error that :
Cannot locate element with text: New Activation ? Monthly (Credit in store).
I am not able to understand why ? is being displayed instead of "–" .

assertText a message that has line break in Selenium IDE

I am new in Selenium IDE and need to assertText a value that has line break. Example:
Actual Message to assertText:
Hello
World
store | Hello <br/> World | txtValue
assertText | id=label | ${txtValue}
Please help.
Pass your id=label into a variable, remove the line breaks, then run an assertion against the variable.
Store expected text:
store | Hello World | txtValue
Store page text:
storeText | xpath=(//*[#id=label]) | labelValue
Remove line breaks from page text:
echo | javascript{storedVars.labelValue = storedVars.labelValue.replace(/(\r\n|\n|\r)/gm,"")} |
Assert your expected text = your page text:
assertExpression | javascript{storedVars.txtValue==storedVars.labelValue} | true
Following pattern matching worked for me on Selenium IDE 2.5.0
regexp:Hello\s+World

Selenium IDE regex gives error "Threw an exception: missing ) after argument list"

In my test case I am trying to capture the dynamic state id from the url of current web page.
My Selenium IDE code is:
storeLocation | myLocation
echo | ${myLocation}
myLocation returns https://stage.abcx.com/ui/States/ManageTitle.ddx? action=view&stateid=76702
storeEval | re=/^sid/;re.exec(${myLocation}) | new
echo | ${new}
The error I keep getting is
[error] Threw an exception: missing ) after argument list
I have searched the net to find what's wrong with my code but could not figure out the issue.
Am new to Selenium and regex would appreciate any help.
Thanks!
You can try to replace
storeEval | re=/^sid/;re.exec(${myLocation}) | new
with:
storeEval | /\\d*$/.exec(storedVars['myLocation']) | new
new will contain all last digits from myLocation. Some info about the difference between ${x} and storedVars['x'] can be found here.