Uploading Test Results from Command Line
Using cURL
The codeBeamer REST API supports uploading .zip archives containing xUnit XML test result files, see Legacy REST API (v1)
This API can be used to upload test results from any CI tool using the cURL command line too:
Bold text should be replaced with the values matching your environment.
Linux
curl -F 'configuration={"testConfigurationId":"", "testCaseTrackerId":"48031", "testCaseId":"", "releaseId":"", "testRunTrackerId":"48018", "buildIdentifier":"Build123", "defaultPackagePrefix":""}' -F 'file=@output.zip' https://server/cb/rest/xunitresults -u username:password
Windows (multi-line for readability)
curl^
-F "configuration={\"testCaseTrackerId\":\"11191153\", \"testRunTrackerId\":\"11155316\", \"buildIdentifier\" : \"Software Smoke Test\", \"releaseId\" : \"2492183\"}"^
-F file=@testresults.zip^
https://saas.codeBeamer.com/rest/xunitresults^
-u user:password
This is a command line tool to import test results from a CSV into codeBeamer.
You can download the source code (with other REST API examples) from here:
workspaceTest.zip
You have to unzip this eclipse work space to C:\Workspaces then open it with Eclipse
You can download the ready for run package of the tool from here:
CommandLineTestResultImporter.zip
Usage of ready to run package:
- Make sure java is installed and is available in PATH
- Unzip CommandLineTestResultImporter.zip into a folder
- Setup config/CommandLineTestResultImporter.properties
- Set codebeamer host and port
- Set user, password
- Set projectKey property to the key of your project to import results to
- Set testCaseTrackerID to the ID of test cases tracker
- Set testCaseTrackerKey to the key of test cases tracker (TESTCASE in a new empty project)
- Set testConfigId to the ID of the test configuration to use
- Set testConfigName to the name of the test configuration to use
- In your build tool ensure that there is a process which creates a CSV file with test results
- The file should be in the input folder of the tool
- The name of the file must be result.csv
- To find out the format, see the example file in input folder
- In your build tool, add a new build step: run command line program
- Set the program to call to the launch.bat in the unzipped tool folder
- Add a command line parameter which is the name of the current test suite in quotes.
- Example: launch.bat "MyOwnTestSuite"
- Optionally add a command line parameter which is the name of the property file to use from config folder (see below)
- Example: launch.bat "MyOwnTestSuite" "MyOwnTestSuite.properties"
Each individual automatic test suite should have a different test suite name in order to distinguish between the test results
The generated results will be placed in the Test Runs tracker, their names will be something like "Automatic test run of My own test suite at 2016-10-12-16-32-07"
If you want to import into different project from different builds, you can provide a second command line parameter which is the name of a property file in the config folder,and which contains the config of your import process (same properties as CommandLineTestResultImporter.properties )