Collect Command
The qf collect command parses test result files and uploads them to Qualflare. It supports 23 different test frameworks across six categories: Generic (JUnit-compatible), Unit Testing, BDD, UI/E2E/Mobile Testing, API Testing, and Security Testing.
Basic Syntax
qf <identifier> collect [files...] [flags]<identifier> is a project alias you saved with qf login. See Configuration for setup.
Arguments
| Argument | Description |
|---|---|
files... | One or more test result files to collect. Supports glob patterns like *.xml or **/*.json |
Examples
# Collect a single JUnit XML file
qf myapp collect results.xml --format junit
# Auto-detect format from file
qf myapp collect playwright-results.json
# Collect multiple files with glob pattern
qf myapp collect test-results/*.xml --format junit
# Specify environment and git metadata
qf myapp collect results.xml --environment production --branch main --commit abc123
# Dry run - parse without uploading
qf myapp collect results.xml --dry-run
# Output parsed results as JSON (use with dry-run)
qf myapp collect results.xml --dry-run --output jsonFlags
All flags can be provided as command-line options or set via environment variables (see CI/CD Integration).
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--format | -f | string | "" (auto-detect) | Test framework format. Use qf list-formats to see all supported formats. |
--environment | -e | string | staging | Environment name (e.g., staging, production, dev) |
--lang | string | en-US | Language/culture code for test result labels. BCP 47 format (e.g., en-US, de-DE, ja-JP). | |
--branch | string | "" | Git branch name (e.g., main, develop, feature/login) | |
--commit | string | "" | Git commit hash for tracking which code version was tested | |
--timeout | duration | 30s | Request timeout. Valid units: s (seconds), m (minutes). Example: --timeout 2m | |
--dry-run | bool | false | Parse files without uploading to Qualflare. Useful for validation and debugging. | |
--output | -o | string | "" | Output format for dry-run mode. Currently supports json. |
Flag Descriptions
--format / -f
Specifies the test framework format. If not provided, the CLI attempts to auto-detect the format based on file content and extension.
qf myapp collect results.xml --format junit
qf myapp collect results.json --format playwright--environment / -e
Labels the test run with an environment name. Useful for filtering results by deployment environment. Defaults to staging.
qf myapp collect results.xml --environment production
qf myapp collect results.xml --environment dev--lang
Sets the language/culture code used for test result labels. Accepts any BCP 47 language tag.
qf myapp collect results.xml --lang de-DE
qf myapp collect results.xml --lang ja-JP--branch and --commit
Git metadata for tracking which code version was tested. Enables integration with Git workflows.
qf myapp collect results.xml --branch main --commit a1b2c3dIn CI/CD, these are often auto-populated from common environment variables (see CI/CD Integration):
# GitHub Actions
qf myapp collect results.xml --branch ${GITHUB_REF_NAME} --commit ${GITHUB_SHA}
# GitLab CI
qf myapp collect results.xml --branch ${CI_COMMIT_REF_NAME} --commit ${CI_COMMIT_SHA}--timeout
Sets the HTTP request timeout for uploading to Qualflare. Default is 30 seconds.
qf myapp collect results.xml --timeout 2m # 2 minutes--dry-run
Parse and validate test files without uploading. Useful for:
- Validating file format
- Debugging parsing issues
- Previewing what will be collected
qf myapp collect results.xml --dry-run
# Output: OK Test results parsed successfully (dry run)--output / -o
Used with --dry-run to output parsed results as JSON. Useful for debugging and integration.
qf myapp collect results.xml --dry-run --output jsonGlobal Flags
These flags are available on all commands:
| Flag | Short | Description |
|---|---|---|
--verbose | -v | Enable detailed debug output |
--quiet | -q | Suppress all non-error output |
Exit Codes
| Code | Meaning |
|---|---|
0 | Success - test results collected or validated successfully |
1 | Error - file not found, parse error, collect failed, or invalid configuration |
2 | Usage error - invalid arguments or flags |
Error Handling
The CLI provides clear error messages for common issues:
File Not Found
$ qf myapp collect missing.xml
Error: file does not exist: missing.xmlInvalid Format
$ qf myapp collect results.xml --format unsupported
Error: unsupported format: unsupported. Use 'qf list-formats' to see supported formatsParse Error
$ qf myapp collect invalid.xml
Error: failed to parse test results: invalid XML formatNot Logged In
$ qf myapp collect results.xml
Error: no identifier "myapp" configured. Run 'qf login myapp <token>' to add it. (See 'qf projects' for the list.)Network Error
$ qf myapp collect results.xml
Error: failed to process test results: connection refusedSupported Frameworks
The qf collect command supports 23 test frameworks across six categories. Use the --format flag to specify your framework, or let the CLI auto-detect it.
JUnit-compatible Formats
JUnit, TestNG, Maestro, XCTest, and Espresso all emit standard JUnit XML, as do NUnit, MSTest, xUnit.net, and Robot Framework. Pass --format <name> or use a recognizable filename to tell qf which framework generated the file:
qf myapp collect results.xml --format testng
qf myapp collect maestro-results.xml # filename hint is enoughRetry and Flaky Test Tracking
The Playwright, Cypress, Mocha, and all JUnit-XML parsers (JUnit, TestNG, Maestro, XCTest, Espresso) automatically capture retry counts and flaky test status. No additional flags are required — this data appears in Qualflare alongside your test results.
Generic (JUnit-compatible) Examples
# JUnit (Java, Android, and any JUnit-XML emitter)
qf myapp collect build/test-results/test/*.xml --format junitUnit Test Examples
# pytest
qf myapp collect pytest-report.xml --format python
# Go tests
qf myapp collect go-test.json --format golang
# Jest
qf myapp collect jest-results.json --format jest
# Mocha
qf myapp collect mocha-report.json --format mocha
# RSpec
qf myapp collect rspec-report.json --format rspec
# PHPUnit
qf myapp collect phpunit-report.xml --format phpunit
# TestNG
qf myapp collect testng-results.xml --format testngBDD Examples
# Cucumber
qf myapp collect cucumber-report.json --format cucumber
# Karate
qf myapp collect karate-report.json --format karateUI / E2E / Mobile Examples
# Playwright
qf myapp collect playwright-results.json --format playwright
# Cypress
qf myapp collect cypress-results.json --format cypress
# Selenium
qf myapp collect selenium-results.json --format selenium
# TestCafe
qf myapp collect testcafe-report.json --format testcafe
# Maestro
qf myapp collect maestro-results.xml --format maestro
# XCTest
qf myapp collect xctest-results.xml --format xctest
# Espresso
qf myapp collect espresso-results.xml --format espressoAPI Testing Examples
# Newman (Postman)
qf myapp collect newman-report.json --format newman
# k6
qf myapp collect k6-summary.json --format k6Security Testing Examples
# OWASP ZAP
qf myapp collect zap-report.json --format zap
# Trivy
qf myapp collect trivy-results.json --format trivy
# Snyk
qf myapp collect snyk-test.json --format snyk
# SonarQube
qf myapp collect sonarqube-report.json --format sonarqubeAuto-Detection
If you don't specify --format, the CLI will attempt to auto-detect the format based on:
- File extension (
.xml,.json) - File content patterns
- Common framework-specific markers
For reliable results, explicitly specify the format when dealing with ambiguous files.
# Auto-detection
qf myapp collect results.json
# Explicit format (recommended)
qf myapp collect results.json --format playwrightUsage Examples
CI/CD Integration
Collect test results as part of your CI/CD pipeline (see CI/CD Integration for full platform examples):
# GitHub Actions
- name: Collect test results to Qualflare
run: |
qf login ci "$QF_TOKEN" --force
qf ci collect test-results/*.xml
env:
QF_TOKEN: ${{ secrets.QF_TOKEN }}
QF_BRANCH: ${{ github.ref_name }}
QF_COMMIT: ${{ github.sha }}Multiple Test Suites
Collect results from multiple test types:
# Unit tests
qf myapp collect unit-results.xml --format junit --environment testing
# E2E tests
qf myapp collect e2e-results.json --format playwright --environment testing
# Security scan
qf myapp collect security-report.json --format trivy --environment testingDry Run Validation
Validate your test results before collecting:
# Validate file can be parsed
qf myapp collect results.xml --format junit --dry-run
# Preview what will be sent
qf myapp collect results.xml --format junit --dry-run --output jsonVerbose Debugging
Enable verbose output for debugging:
qf myapp collect results.xml --verbose
# Output includes:
# - Processing 1 test result file(s)...
# - Detected format: junit
# - Parsing file...
# - Uploading to Qualflare...
# - OK Test results collected successfullySee Also
- Installation — Install the Qualflare CLI
- Configuration — Authentication, environment variables, and global flags
- CI/CD Integration — Set up automated test result reporting
- Other Commands — Learn about
validate,version, andlist-formats