can't print extracted xml content with karate [duplicate] - testing

How to add a print output (response body - JSON or Text) in cucumber reports using Karate DSL ?. Also attaching a file so that that can be viewed in report.
Currently only Docstg is displayed in cucumber report.
Helpfull if any sample is provided. Thanks.

Here is the doc for how to integrate the Cucumber-Reporting plugin that should give you what you need, and there are sample screenshots: https://github.com/intuit/karate/tree/master/karate-demo#example-report
And if you use the print statement, that output also appears in the log, which can be JSON or XML. Note that the print statement can do 'pretty printing'.
In my opinion, there is no need for extra attachments and there is no support for that right now.

Related

Codeception do not truncate debug output

Is there a way to force Codeception to display the full debug output of an acceptance test instead of truncating it?
I have the --debug flag on and I'm seeing output in the console, but it truncates it like this
I wait for element "//*[#id="whole_subpanel_leads_ods_inventory"]//*/ul[#class="clickMenu fancymenu SugarActionMenu"]/li[#class="sugar_action_button"]/span[#class="suitepicon su..."
I want to see what's after su...
It saves the screenshot and the markup to the _output folder, but unfortunately not the full debug output.
Thank you
Output in terminal is truncated to fit into one line.
You can find full step output in HTML report, which is generated when --html parameter is used.
Alternatively you could use codecept_debug function to log parameter that you are passing to waitForElement method.
Evidence that steps aren't truncated in HTML report:

How to configure/capture 'failureMessage' to the result file in Jmeter

I have a jmx script which saves the results to a CSV file.
I need to see the 'failureMessage' field in the CSV especially when the 'success' column says 'false' as in the below example. But the failureMessage column always appear as blank irrespective in the csv
Example -
timeStamp|time|label|responseCode|threadName|dataType|success|failureMessage
02/06/03 08:21:42|1187|Home|200|Thread Group-1|text|true|
02/06/03 08:21:42|47|Login|200|Thread Group-1|text|false|Test Failed: expected to contain: password etc.
I tried looking up the jmeter.properties file to check the below which is set to true. But it still doesn't save the message to failureMessage in the csv.
assertion_results_failure_message only affects CSV output
jmeter.save.saveservice.assertion_results_failure_message=true
I cannot reproduce your issue using:
Latest JMeter 5.2.1
With the default Results File Configuration
Running JMeter in command-line non-GUI mode
Demo:
If you cannot see custom assertion failure messages your setup violates at least one of the above 3 points.
Try adding assertions with your requests and you will find it in your results in case of assertions getting failed.

karate api testing - How to read tag names from command line to feature file

karate api testing - How to read tag names from command line to feature file
My feature file
Feature: validating tag name reading from maven command line
Background:
Given url baseURL
When param validation = I want to read tagname here
Then method get
Then status 200
#com_status #all #I want to read tagname here
Scenario Outline: Testing tag input scenarios
print I want to read tagname here
Command - mvn clean test -Dtest=Runner -DargLine="-Dkarate.env=dev" -Dcucumber.options="--tags #com_status"
Below is the command to execute the tag from the command line in Karate Api automation testing.
mvn test -DargLine="-Dkarate.env=e2e" "-Dkarate.options=--tags #user_management_get_vender_types"
You cannot. Tags are designed to be passed on the command line to filter scenarios to run - and cannot be retrieved within a test. You can retrieve the tag of a Scenario though: https://github.com/intuit/karate#karate-tags
You can try using karate.properties or something similar to retrieve what was passed on the command-line: https://github.com/intuit/karate#dynamic-port-numbers
Command:
mvn clean test -DcustomName=foo
Feature:
* def customName = karate.properties['customName']
Feel free to contribute this feature if you think it is important.
EDIT - update in 1.1.0 onwards, there is a new feature "Exvironment Tags" that may solve what is being asked for here: https://github.com/intuit/karate#environment-tags
Also see: https://stackoverflow.com/a/50693388/143475

How to add variable names to the JMeter CSV output file?

I'm using JMeter for performance testing and generate an CSV file for data analysis.
How should I add JMeter Variable names to the CSV output? It seems that only pre-defined columns can be added (see screenshot).
This is my log-file:
14/03/2014,Login,OK,982
14/03/2014,Search,OK,2182
14/03/2014,Login,OK,3982
I would like to add a column with the ${username} to generate something like:
14/03/2014,Login,OK,982,user1
14/03/2014,Search,OK,2182,user7
14/03/2014,Login,OK,3982,user9
Try to pass sample_variables property, for example as command-line parameter -Jsample_variables=username,some_other_var
Also see FlexibleFileWriter plugin if you need custom formatting http://jmeter-plugins.org/wiki/FlexibleFileWriter/?utm_source=jmeter&utm_medium=helplink&utm_campaign=FlexibleFileWriter

Bamboo with tSQLt - Failed to parse test result file

First of all I should point out I'm new to Atlassian's Bamboo and continuous integration in general. This is the first project where I've used either.
I've created a raft of unit tests using the tSQLt framework. I've also configured Bamboo to:
Get a fresh copy of the repository from BitBucket
Drop & re-create the build DB
Use Red-Gate SQL Compare to deploy the DB objects from source to the build DB
Run the tSQLt tests
Output the results of the tests in XML format to a file called TestResults.xml
I've checked and can confirm that the TestResults.xml file is created.
In Bamboo I then added a JUnit Parser task to consume the contents of this TestResults.xml file. However when that task runs it returns this error:
Failed to parse test result file
At first I thought it might have meant that Bamboo could not find the file. I changed the task that created the results file to output a file called TestResults2.xml. When I did that the JUnit Parser returned this error:
Failing task since test cases were expected but none were found.
So I'm assuming that the first error message means Bamboo is finding the file, it just can't parse the file.
I have no idea where to start working out what exactly is the problem. Has anyone got any ideas?
I had a similar problem, but turned out to be weird behavior from bamboo needing file stamps being modified to have visibility of the JUnit file.
In Windows enviornment you just need to add "script task" before the "JUnit task"
powershell (ls *.xml).LastWriteTime = Get-Date
Reference
https://jira.atlassian.com/browse/BAM-12768
I have had several cases of this and was able to fix it by removing single quotes and greater than / less than characters from test names inside the *.rb file.
Example
test "make sure 'go_to_world' is removed from header and length < 23"
change to remove single quotes and < symbol
test "make sure go_to_world is removed from header and length less than 23"
Very common are contractions: "won't don't shouldn't", or possessives: "the vessel's data".
And also < or > characters.
I think there is a bug in the parser that just doesn't escape those characters in a test title appropriately.