A CLI that can read JUnit test reports and send them to a Fern Platform instance in a format it understands
If you don't know what Fern is, check it out here!
To install the CLI, use the following command:
go install github.com/guidewire-oss/fern-junit-client@latestcurl -L -X POST http://localhost:8080/api/project \
-H "Content-Type: application/json" \
-d '{
"name": "First Projects",
"team_name": "my team",
"comment": "This is the test project"
}'Sample Response:
{
"uuid": "996ad860-2a9a-504f-8861-aeafd0b2ae29",
"name": "First Projects",
"team_name": "my team",
"comment": "This is the test project"
}To see all available options, use fern-junit-client help
fern-junit-client send -u "http://localhost:8080" -p "77b34e74-5631-5a71-b8ce-97b9d6bab10a" -f "report.xml"fern-junit-client send -u "http://localhost:8080" -p "77b34e74-5631-5a71-b8ce-97b9d6bab10a" -f "tests/*.xml"The fern-junit-client can be configured using environment variables:
| Environment Variable | Description | Default |
|---|---|---|
FERN_API_ENDPOINT_PATH |
Override the API endpoint path | api/v1/test-runs |
Example:
# Use a custom API endpoint path
export FERN_API_ENDPOINT_PATH="api/v2/test-results"
fern-junit-client send -u "http://localhost:8080" -p "77b34e74-5631-5a71-b8ce-97b9d6bab10a" -f "report.xml"The fern-junit-client supports OAuth 2.0 authentication using the client credentials grant type. This allows the client to authenticate with the Fern backend using OAuth tokens.
OAuth authentication is configured via environment variables:
| Environment Variable | Description | Required |
|---|---|---|
AUTH_URL |
The OAuth 2.0 token endpoint URL | Yes (to enable OAuth) |
FERN_AUTH_CLIENT_ID |
The OAuth client ID | Yes (if OAuth enabled) |
FERN_AUTH_CLIENT_SECRET |
The OAuth client secret/password | Yes (if OAuth enabled) |
FERN_CLIENT_SCOPE |
Space-separated list of OAuth scopes to request | No (optional) |
- OAuth Disabled: If
AUTH_URLis not set, the client will operate without authentication (backward compatible behavior). - OAuth Enabled: If
AUTH_URLis set, the client will:- Validate that
FERN_AUTH_CLIENT_IDandFERN_AUTH_CLIENT_SECRETare also provided - Request an access token from the OAuth server using client credentials grant
- Include requested scopes in the token request if
FERN_CLIENT_SCOPEis set - Include the Bearer token in the Authorization header for all API calls to the Fern backend
- Automatically refresh the token when it expires
- Validate that
fern-junit-client send -u "http://localhost:8080" -p "77b34e74-5631-5a71-b8ce-97b9d6bab10a" -f "report.xml"export AUTH_URL="https://oauth.example.com/token"
export FERN_AUTH_CLIENT_ID="your-client-id"
export FERN_AUTH_CLIENT_SECRET="your-client-secret"
fern-junit-client send -u "http://localhost:8080" -p "77b34e74-5631-5a71-b8ce-97b9d6bab10a" -f "report.xml"export AUTH_URL="https://oauth.example.com/token"
export FERN_AUTH_CLIENT_ID="your-client-id"
export FERN_AUTH_CLIENT_SECRET="your-client-secret"
export FERN_CLIENT_SCOPE="read write admin"
fern-junit-client send -u "http://localhost:8080" -p "77b34e74-5631-5a71-b8ce-97b9d6bab10a" -f "report.xml"Use the --verbose flag to see OAuth authentication status:
fern-junit-client send -u "http://localhost:8080" -p "77b34e74-5631-5a71-b8ce-97b9d6bab10a" -f "report.xml" --verboseTo install the CLI locally for testing use the following command:
go build
./fern-junit-client send -u "http://localhost:8080" -p "77b34e74-5631-5a71-b8ce-97b9d6bab10a" -f "report.xml"To execute the tests, run make test
To generate the static files used in the tests, run make test-static-files