How to differentiate test description for parameterized data testing with selenium/cucumber? - selenium

How to differentiate test description for parameterized data testing with cucumber? Because for multiple testdata, the description in the scenario outline is showing same when viewing the cucumber report.
Below I am giving an example. On cucumber result, the scenario outline "Verify correct status displaying after filtering" -always visible as same for all the testdata. Is it possible to show three different description for three different testdata? Like "Verify correct verified status displaying after filtering" / "Verify correct pending status displaying after filtering" / "Verify correct rejected status displaying after filtering".
#flights
#flight01
Scenario Outline: TC003_Verify correct status displaying after filtering
Given I am in the xyz application
When I navigate to abcd page
Then Select status "<Status>" from the filter
Then Verify correct "<Status>" should be displayed
Examples:
|Status |
|Verified|
|Pending |
|Rejected|

The way to do that would be to add the parameter to your scenario outline the same way you do for your steps:
eg.
TC003_Verify "<Status>" status displaying after filtering for "<Status>"
This way your scenario results will better convey what you are testing too.
HTH.

The easy way is to just write 3 different scenarios with different titles. There is absolutely no need to use scenario outline when cuking.

When I tested for multiple test data,cucumber report shows the data itself and marked it with pass or fail colors, screenshots below . The description in scenario outline is same but it also copies all the data and it even provides the error. Imo, this eliminates the need to have separate scenario outline with data in it.
and
You have not mention which test runner are you using but the above screen shots are from cucumber 6.9.1 and Junit5 and in junit-platform.properties , you can mention cucumber.plugin = html:target/cucumber.html to have this report generated

Related

How to render Karate.Config values in Scenario outline

I am just wondering if there is a way to make use of karate.config values in Scenario Outline statement. Please have a look at the example below:
Feature: Sample feature
Scenario Outline: Sample scenario for id: <id>
Examples:
| id |
| partnerId |
Here the partnerId is defined in Karate.config file (just say it is '123'). When I run the file I want to see '123' in scenario outline in reports rather than the value holder 'partnerId'
Expected:
You are asking for variables to be able to be substituted into the title. Sorry, that's not supported. You can always print these values so they will show in the HTML report, but yes - not as the title.

Karate API Testing - Access variable value across scenario in a feature file

I am running into this situation (similar to this) when trying to do the following:
Scenario: Create User
Given path 'user'
And request read('user.json');
When method post
Then status 200
And def user_id = response.userId
Scenario: Test A
Given path 'user/' + user_id <- Received javascript error here
...
Scenario: Test B
Given path 'user/' + user_id <- Received javascript error here
...
Scenario: Test A
Given path 'user/' + user_id <- Received javascript error here
...
Basically what i am trying to do is create a user in my database first, then run it through a series of test and use a last scenario to delete this user. Therefore, i need to share the user_id value across multiple scenarios. Background doesn't work for me because that means i have to create a new user for each scenario. I have seen in the demo that a simple way would be to put all test under 1 scenario but i don't feel that it is right to put all tests on 1 scenario
I have reviewed the karate demo but i did not come across any sample code that will help my situation. May i know the right way to do this in Karate? Thanks.
I think you are missing the callonce keyword. Understand it and then look at the demos, for example, this one: callonce.feature.
You will need to move the 'common' code into a separate feature, but that is the right thing to do, because you will typically want it re-usable by multiple feature files as well.

Whats wrong with Neo4j 2.0 Query?

I am trying to understand why the data is not showing up in my query. I was wondering if there is any way to troubleshoot whats going on.
Here is the current issue:
I have populated some data from existing test database to check the performance with a relation like this : (e:Event)-[:FOR_USER]->(u:User) when I get all the users and look at the property, I can see the data, but when I query the users using same data it says 0 records found.
Below image shows the 2 query:
Can some one please help me understand how to debug such issue in neo4j
EDIT
Issue is that the Browser is somehow truncating the multiple spaces in the result. Like in this case "User-May<space>1 2013 1:18AM" was displayed on both webadmin and new browser, but in reality it should have been "User-May<space><space>1 2013<space><space>1:18AM"
So no matter what I do I can't query the value as looks like duplicate space is truncated somewhere.
Tabular data as Micheal suggested is as below
{"id":"75307","labels":["User"],"properties":{"Name":"User-May 1 2013 1:18AM"}}
and what we are seeing is User-May 1 2013 1:18AM
Regards
Kiran
Use the following Cypher syntax in the browser:
MATCH (user:User { Name: "User-May 1 2013 1:18AM" })
RETURN user.Name as Name
As far as the rendering of multiple spaces being trimmed, that is a browser specific functionality. See screenshot below for example:
The text itself is preserved as it is returned from the Neo4j server. As you can see when I analyze the HTML element of the browser using Firebug, the redundant spaces are indeed there.
So again, this doesn't seem to be a bug with Neo4j, it's how the browser you are using renders the text. The browser expects redundant spaces to be encoded as like so: "Testing testing" which is HTML encoded as Testing testing

Positive test cases and negative test cases

What are positive test cases and negative test cases?
Upon Googling about it I have found answers that are very confusing.
Can anyone explain with example?
A positive test case tests that a system does what it is supposed to. Example: will allow you to login when valid credentials are supplied.
A negative test case tests that a system does not do things it shouldn't. Example: should not allow you to login when invalid credentials are supplied.
Positive case is a case where the system validated against the valid input data
For example, consider a scenario where you want to test a application which contains a search field and requirements say that you should not enter special characters.
ID: 1
Name/Idea: Verifying that search field works with valid input
Precondition steps: "Search" screen should be opened
Steps to reproduce:
Fill search field with valid information
Tap on "Search" button
Expected result: The screen with results of search should be displayed
Positive/Negative: 1
Negative case is case where the system validated against the invalid input data. A negative test checks if a application behaves as expected with its negative inputs
For example, consider the same example which should accept only letters. So here provide the characters like “#,#,/” in the search field and check the behavior of application, either it should show a validation error message for all invalid inputs or system should not allow to enter special characters.
ID: 1
Name/Idea: Verifying that search field works with invalid input
Precondition steps: "Search" screen should be opened
Steps to reproduce:
Fill search field with invalid information (e.g. #,#,/)
Tap on "Search" button
Expected result: Pop-up with error message should appear
Positive/Negative: 0
I dont know but I was somewhat dissatisfied with above answers. So here are my views upon this topic:
Positive testing is the testing for something that should happen, does happen.
Negative testing is the testing for something that should not happen, does not happen.
Lets have a scenario where we have two requirements:
Requirements:
A text box to enter some characters.
A button to submit entered text to the server.
A message to be displayed when number of characters is less than 5. "Less than 5 characters".
A message to be displayed when server accepts text submitted. "Text accepted".
Now, a positive scenario would be:
Enter "abcdef" in the text box.
Click on submit button.
"Text Accepted" must be displayed.
On the other hand, a negative scenario would be:
Enter "abcd" in the text box.
Click on submit button.
"Text Accepted" must not be displayed.
A positive test case is when the test is designed to return what is
expected according to the requirement.
A negative test case is when the test is designed to determine the
response of the product outside of what is defined.
You don't determine the type of test by the results, but by the
expected result based on the input.
Hope it makes sense, here's a good example http://osdir.com/ml/programming.software-qa/2004-12/msg00060.html
positive or negative is meaningless unless you put the requirement in the content. Let's say, one requirement is "the log in should fail if the user ID is not correct". I know it's bit counter-intuitive, a positive test is the type of test that will generate a failure in logging in, while the negative test will generate the result of successful log in.
Positive test cases we are using for checking some scenario like whatever scenario
we are using for our code.
Negative test cases we are checking some specific scenario in negative way.
By the help of both we can increase code coverage.

using Selenium: how to use output from one test as input to another test

I'm a Selenium n00b... it's clear how easy it is to run a test and verify a particular response, but how can I take a value from one response and use it in the next test?
an example might be a contact creation form...
type in name/email and click submit
response arrives with new ContactID
grab the ContactID that was returned and put it into "get" textbox and click "submit"
response arrives with contact details
verfy the name/email match the first set
how might I go about doing this in Selenium?
And now something completely different:
Now I understand when you say "test", you mean a single assertion within one test case. So you want to use a value returned from a request as input for another request in the same test case.
Assuming you use selenium ide: To do this, use one of the "store..." commands in selenium ide and store the value into a variable. The contactID can be found using a matching selector with the storeText command. For example:
command: storeText
target: selector for element containing contactId
value: contactId
Then, use variable substitution and the type command to insert that text somewhere else.
command: type
target: selector for target input box
value: ${contactId}
Hope this helps :)
(This answer is still correct I think if you interpret "test" as "test case". For another, totally different answer see below.)
You don't do this. Each test should be independent from all other tests. For your second test, just repeat the steps in the first test. This way, you can reproduce test success and failures in a reliable way.
If you have many tests which all start from a certain application state which requires many steps to reach, just write a private helper method to reach that state.
The alternative: All steps you describe can be put into a single test. There is no reason not to have several asserts in one test.