I want to execute single test case from a scenario outline using protractor.For example in the below Scenario Outline if I want to execute the test case TCID0002 alone, how I can run the test case TCID0002 using protractor?
#shopping
Scenario Outline: Test
Given the user navigates to xxx.com
When the user searches for <product>
Then the current page is shopping cart page
Examples:
|TCID | product|
|TCID0001|soap |
|TCID0002|watch |
|TCID0003|lipstick |
To run all the test case now I use
protractor Config.js --cucumberOpts.tags="#shopping"
Is there any command to execute single test case in the scenario outline ?
You can use tags on the examples table and splitting it into two tables. Then provide the #runone tag to tags option of cucumberOpts in config file.
#runall
Examples:
|TCID | product|
|TCID0001|soap |
|TCID0002|watch |
|TCID0003|lipstick |
#runone
Examples:
|TCID | product|
|TCID0002|watch |
Found solution to execute single test case in cucumber with a help of my team member.
To run single test case follow the below 2 steps
Step 1
Keep TCID in the scenario title as shown below
Scenario Outline: <TCID> test case to validate search
Given the user navigates to xxx.com
When the user searches for <product>
Then the current page is search result page
Examples:
|TCID | product|
|TCID0001|soap |
|TCID0002|watch |
|TCID0003|lipstick |
Step 2
Use cucumberOpts.name in your command. 'cucumberOpts.name' will filter the scenarios which contain the given string in the scenario title.
--cucumberOpts.name="WAGCAR0002" will filter the WAGCAR0002 scenario alone.
Command
The below command will execute the test case 'WAGCAR0002'
protractor Config/wagConfig.js --cucumberOpts.name="WAGCAR0002"
Related
I'm trying to aggregate the API logs based on the different endpoints I have. There are a total of 4 endpoints:
1: /v1/vehicle_locations
2: /v1/vehicle_locations/id
3: /v1/driver_locations
4: /v1/driver_locations/id
The way I'm currently doing this is:
_sourceCategory=production | keyvalue auto | where (path matches "/v1/driver_locations" OR path matches "/v1/driver_locations/*" or path matches "/v1/vehicle_locations" or path matches "/v1/vehicle_locations/*") | count by path
The problem with this is that while I get the correct aggregate for /v1/vehicle_locations and /v1/driver_locations, I get individual results for /v1/driver_locations/id and /v1/vehicle_locations/id since the id is a wildcard. Is there a way I can aggregate these wildcards as well?
There are several ways to achieve what you ask. I think the most straightforward one and suggested is to use | parse operator so that you can treat the top-most element of your path as a field, e.g.
_sourceCategory=production
| keyvalue auto
| parse field=path "*/*" as topmost, rest
| where (topmost = "vehicle_locations" or topmost = "driver_locations")
| count by topmost
Note that by default | parse operator works on the raw message (e.g. the original log line), but you can make it parse a field - using the field= syntax and this is what it's used above.
You might want to tweak the parse expression or use a regex depending on the actual paths you encounter.
(Disclaimer: I am currently employed by Sumo Logic)
Incredibly new to Selenium IDE / Automating tests and currently I am trying to store part of a text, which is a variable to use in later in another web page.
I haven't actually tried much but have been reading quite a few threads but I'm just not grasping the concepts I guess
<tr align=center> <td><font size='+1' color='white'><b>Authorization Request - Confirmation Number: 219927</b> </font></td></tr>
In this example, I need to be able to store 219927 to use later on another site
The below has passed all of the tests but I seem to not be able to echo the output back on another site:
store | xpath=//b[contains(.,'Authorization Request - Confirmation Number: 135085')] | string
store | 1 | delimiter store | javascript{storedVars['string'].split('- ')[storedVars['delimiter']]} | test
store | 0 | delimiter1
store | javascript{storedVars['test'].split(',')[storedVars['delimiter1']]} | output
echo | ${output}
I'm working with Selenium Ide 2.9.1.
The problem is to check if, beginning the automatic process, the user has already logged in.
So, on the first page of www.pageexample.com I need to check if id=welcome is JOHN SMITH.
If yes, the user has already logged in and then it's possible to go on with the following instruction (clickandwait | id=button10).
If not (I mean id=welcome is not present in the page), the login is needed (and in this case I've already built the instuctions).
I've installed Selenium IDE: flow control.
Taking a cue from the suggestion, I've elaborate the following code that seems to work:
storeElementPresent | id=loginbutton | x
storeElementPresent | id=sitename | y
gotoIf | x=y | z
....... operations of log in .......
label | z |
loginbutton is present only if the users has not logged in, sitename is always present (therefore always true): so, comparing the two values, in case of correspondence Selenium proceeds with the operation of log in, otherwise jumps to label z.
I know, it's an escamotage that can surely be improuved.
We are using Serenity with JBehave. We are facing issues when we have multiple scenario outlines with examples table in a single .feature file.
We have something like this in our Feature file:
Scenario Outline: title 1
Given
When
Then
Examples:
|data|
Scenario Outline: title 2
Given 2
When 2
Then 2
Examples:
|Data|
In this case after executing Examples of Scenario 1, it is considering Scenario outline 2 also as an input to scenario 1 example table, instead of treating it as a new scenario.
This is how the output looks like:
Scenario Outline: title 1
Given
When
Then
Examples:
|data|
|Scenario Outline: title 2|
|Given 2|
|When 2|
|Then 2|
|Examples:|
|Data|
Here are the versions of plugins:
jbehave.core.version - 3.9.5;
serenity.version - 1.0.47;
serenity.jbehave.version - 1.0.21
Can someone please help resolve this?
Note: I have seen posts where people had same issues when using scenario with examples table rather than using scenario outline with examples. Here I am using scenario outline only, but still have the same issue.
Is it possible to use a DbFit variable in another fixture? For example, if I create a query in dbfit with a variable <<firstname as follows:
SELECT * FROM System.Columns Where ColumnName= 'FirstName' | <<firstname |
Is it possible to include a reference to that page in another suite of tests that use a column fixture or RestFixture and call the variable name to check against the database?
In the RestFixture, I'm checking a database column name against a node so can I do something like:
| GET | /resources/6 | | //${firstname} |
Where I'm checking if an xml node named FirstName exists in the database.
With fitSharp (.NET), it is. With Java, I'm not sure.
I was struggling with the same issue, imo it's hard to find any good documentation. I stumbled upon the answer skimming some arbitrary tests somewhere.
You can access the symbol in RESTFixture using %variablename%.
RestFixture
| GET | /resources/6 | | //%firstname% |