I am very new to Cucumber.
I know (and I use it a lot) that cucumber steps may have parameters in double quotes, like the one below:
And Choose "Ice Cream" from list to add to Order
# or
And User fills in "'<'Name'>'" and "'<'Surname'>'" in the form
Examples: TestData
| Name | Surname |
| Michael | Good |
However,
I noticed that there can be steps with a parameters in a single quotes like:
And User click 'Create Order' button
# or
And 'Brush Type' displayed on 'View Order' page
I looked into steps, test definitions, page object definitions for the steps described and I can not understand what is the purpose of single quotes.
There would be no difference should it be like:
And Brush Type displayed on View Order page
Could somebody give me a brief answer, please.
Or send me a link where I can read, please.
I tried single 'quotes' tried it with Cucumber Expression and it does work:
And User fills in Values '11013', 'Insurance12345670890', '10 hours'
#And ("User fills in Values {string}, {string}, {string}")
public void user_fills_nvaluess(String Value1, String Value2, String Value3)
just for an experiment I tried to use single quotes with regular expression, it did not work.
Related
I want to pass cypress environment variables from cucumber feature file. But while running scripts in cypress runner getting 404 NOT FOUND error.
Any Ideas please?
Versions used:
"cypress": "^9.5.4",
"cypress-cucumber-preprocessor": "^4.3.1"
Below, I show you how to use any variable within a feature file. You only have to replace the variable in the example (which is assetName) by your environment variable.
Feature: Business critical scenarios
Verify the proper operation of most critial scearnios
Scenario Outline: Add a asset successfully
Given I go to the Add Asset tab
When Validate page title and url
And I type the valid name <assetName> in the asset input box
Then I press send button
And Validate the asset <assetName> is added successfully
Examples:
| assetName |
| "ABCD0000000026" |
Notes:
In my example the variable within the section Examples and below the field assetName, it's in quotes because the expected variable in my test file and linked with those steps, it's a string. If you are using int you must skip the quotes.
If you add more values below ABCD0000000026, your test will run as many times as values you add, like a loop
In my cucumber feature file, Ihave some thing like this:
Scenario Outline: Hi Hello
Given I open
When I fill details <name> <Age> <DON> <Place>
Then Click enter
Then I verify
Examples:
|Name|Age|BOB |Place|
|JOHN|20 |2000| OH |
Above Examples values are used in When step , I'm trying to verify all details in Last step "Then I verify" , where actually i'm not passing any value to that step .
Question : Do we have any way to read Examples details from Last Then method(Step)
Is there a way to read Examples Key value from Step "Then I verify"
Can't you do this:
Scenario Outline: Hi Hello
Given I open
When I fill details <name> <Age> <DON> <Place>
Then Click enter
Then I verify <name> <Age> <DON> <Place>
Examples:
|Name|Age|BOB |Place|
|JOHN|20 |2000| OH |
The whole point of using variables in angular brackets is that we can use the same value of the variable at multiple places.
Github API allows us to search users by different parameters, and one of those parameters is location. Running the following query will give all the users living in Pakistan:
curl https://api.github.com/search/users?q=location:pakistan
Now, I would like to get all the users that either live in Pakistan or in India, but it seems that Github doesn't define a way for having an or between Pakistan & India.
I have tried the following queries, but these aren't working:
curl https://api.github.com/search/users?q=location:pakistan&location:india
curl https://api.github.com/search/users?q=location:(pakistan|india)
Your first attempt is close, but doesn't work because location isn't its own HTTP GET argument. The entire string location:pakistan is the value to the q parameter.
When you do ?q=location:pakistan&location:india you are actually submitting something like
q has the value location:pakistan
location:india is a key, but has no value
Instead, join multiple location keys with + or %20:
curl https://api.github.com/search/users?q=location:pakistan+location:india
Now the entire location:pakistan+location:india string is passed as the value to the q key.
A literal space can work too, but then you have to escape it or wrap the arguments in quotes.
Unfortunately we have a special folder named "_archive" in our repository everywhere.
This folder has its purpose. But: When searching for content/documents we want to exclude it and every content beneath "_archive".
So, what i want is to exclude the path and its member from all user searches. Syntax is easy with fts:
your_query AND -PATH:"//cm:_archive//*"
to test:
https://www.docdroid.net/RmKj9gB/search-test.pdf.html
take the pdf, put it into your repo twice:
/some_random_path/search-test.pdf
/some_random_path/_archive/search-test.pdf
In node-browser everything works as expected:
TEXT:"HODOR" AND -PATH:"//cm:_archive//*"
= 1 result
TEXT:"HODOR"
= 2 results
So, my idea was to edit search.get.config.xml and add the exclusion to the list of properties:
<search>
<default-operator>AND</default-operator>
<default-query-template>%(cm:name cm:title cm:description ia:whatEvent
ia:descriptionEvent lnk:title lnk:description TEXT TAG) AND -PATH:"//cm:_archive//*"
</default-query-template>
</search>
But it does not work as intended! As soon as i am using 'text:' or 'name:' in the search field, the exclusion seems to be ignored.
What other option do i have? Basically just want to add the exclusion to the base query after the default query template is used.
Version is Alfresco Community 5.0.d
thanks!
I guess you're mistaken what query templates are meant for. Take a look at the Wiki.
So what you're basically doing is programmatically saying I've got a keyword and I want to match the keywords to the following metadata fields.
Default it will match cm:name cm:title cm:description etc. This can be changed to a custom field or in other cases to ALL.
So putting an extra AND or here of whatever won't work, cause this isn't the actual query which will be built. I can go on more about the query templates, but that won't do you any good.
In your case you'll need to modify the search.get webscript of Alfresco and the method called function getSearchResults(params) in search.lib.js (which get's imported).
Somewhere in at the end of the method it will do the following:
ftsQuery = '(' + ftsQuery + ') AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating" AND -TYPE:"st:site"' + ' AND -ASPECT:"st:siteContainer" AND -ASPECT:"sys:hidden" AND -cm:creator:system AND -QNAME:comment\\-*';
Just add your path to query to it and that will do.
In TestLink you will get a ghost string for various items such as test case, test suite etc. ghost string (like [ghost]"TestCase":"TC001-2","Version":"3"[/ghost]) will appear after clicking on the red ghost icon present on say test case name.
What is this ghost string and what's its purpose?
Ghost strings allow you to reuse text descriptions in different places. When you copy a [ghost] string and paste it in some other place you essentially create a reference to the source text (the source text will be shown to the user instead of the tag). If you change the source text, the ghost string will immediately update in all places where you've used it.
For example:
Create a test case TC001-2 with step 1: Test something
Create a test case TC001-3 with step 1: [ghost]"Step":1,"TestCase":"TC001-2"[/ghost]
Now TC001-3 step 1 description is: Test something
Change TC001-2 step 1 to: Test something different
Now step 1 of both TC001-2 and TC001-3 are: Test something different