Getno Assist API
Execute Test Cycles automaticamente no seu pipeline e publique resultados JUnit diretamente na sua plataforma de CI/CD.
A integração CI/CD com a Getno Assist segue um fluxo de 4 etapas, executadas automaticamente dentro do pipeline:
POST para criar um Test Cycle (batch run) via API
Polling a cada 15s até o JUnit estar pronto (max 30 min, timeout não quebra o pipeline)
Download do relatório JUnit XML gerado
Publicar resultado e bloquear pipeline se houver falhas
POST /organizations/{orgId}/sites/{siteId}/runs/batch?environmentSlug={environmentSlug}
→ Retorna batchId
→ environmentSlug é opcional; se omitido, usa o ambiente default do site
GET /organizations/{orgId}/runs/batch/{batchId}
→ Polling a cada 15s até junitReportStatus == "ready"
GET /organizations/{orgId}/runs/batch/{batchId}/junit-report
→ Download do XML JUnit
Publish → Resultado de testes nativo da plataforma
→ Pipeline bloqueado se houver falhasAntes de configurar o pipeline, você precisará de 4 informações:
API Key
Gere em Chaves de API no menu lateral. Armazene como secret/variável protegida no CI/CD.
Organization ID
Disponível no menu lateral, na seção da organização.
Site ID
O identificador do site cujas automações serão executadas. Disponível na listagem de sites.
Environment Slug (opcional)
Informe quando quiser executar o pipeline em um ambiente específico. Se omitido, a API executa no ambiente default do site.
GETNO_ENVIRONMENT_SLUG. Se a variável não for enviada, o ciclo roda automaticamente no ambiente default do site.Escolha sua plataforma de CI/CD e copie o YAML pronto. Substitua apenas os valores indicados.
GETNO_API_KEY em Settings → Secrets and variables → ActionsGETNO_ORG_ID em Settings → Secrets and variables → Actions → VariablesGETNO_SITE_ID em Settings → Secrets and variables → Actions → VariablesGETNO_ENVIRONMENT_SLUG para executar em um ambiente específico.github/workflows/getno-test-cycle.ymlname: Getno Assist - Test Cycle
on:
# Executar manualmente ou em push na branch principal
workflow_dispatch:
push:
branches: [main, master]
jobs:
test-cycle:
name: Run Test Cycle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Start Test Cycle
id: start
run: |
echo "Starting Test Cycle..."
ENV_QUERY=""
if [ -n "${{ vars.GETNO_ENVIRONMENT_SLUG }}" ]; then
ENV_QUERY="?environmentSlug=${{ vars.GETNO_ENVIRONMENT_SLUG }}"
echo "Running in environment: ${{ vars.GETNO_ENVIRONMENT_SLUG }}"
else
echo "No environmentSlug provided. Using site's default environment."
fi
RESPONSE=$(curl -s -w "\n%{http_code}" \
-X POST "https://api.getno.com.br/v1/organizations/${{ vars.GETNO_ORG_ID }}/sites/${{ vars.GETNO_SITE_ID }}/runs/batch$ENV_QUERY" \
-H "x-api-key: ${{ secrets.GETNO_API_KEY }}" \
-H "Content-Type: application/json")
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | sed '$ d')
if [ "$HTTP_CODE" -ne 200 ] && [ "$HTTP_CODE" -ne 201 ]; then
echo "Failed to start Test Cycle. HTTP $HTTP_CODE"
echo "$BODY"
exit 1
fi
BATCH_ID=$(echo "$BODY" | grep -o '"id":"[^"]*"' | head -1 | cut -d'"' -f4)
if [ -z "$BATCH_ID" ]; then
echo "Failed to extract batchId from response"
echo "$BODY"
exit 1
fi
echo "Test Cycle started: $BATCH_ID"
echo "batch_id=$BATCH_ID" >> $GITHUB_OUTPUT
- name: Wait for Test Cycle completion
id: wait
run: |
BATCH_ID="${{ steps.start.outputs.batch_id }}"
MAX_ATTEMPTS=120
ATTEMPT=0
echo "Waiting for Test Cycle $BATCH_ID to complete (max 30 min)..."
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
ATTEMPT=$((ATTEMPT + 1))
RESPONSE=$(curl -s \
"https://api.getno.com.br/v1/organizations/${{ vars.GETNO_ORG_ID }}/runs/batch/$BATCH_ID" \
-H "x-api-key: ${{ secrets.GETNO_API_KEY }}")
JUNIT_STATUS=$(echo "$RESPONSE" | grep -o '"junitReportStatus":"[^"]*"' | cut -d'"' -f4)
COMPLETED=$(echo "$RESPONSE" | grep -o '"completedRuns":[0-9]*' | cut -d':' -f2)
TOTAL=$(echo "$RESPONSE" | grep -o '"totalRuns":[0-9]*' | cut -d':' -f2)
echo "Attempt $ATTEMPT/$MAX_ATTEMPTS - Progress: $COMPLETED/$TOTAL - JUnit: $JUNIT_STATUS"
if [ "$JUNIT_STATUS" = "ready" ]; then
echo "Test Cycle completed! JUnit report is ready."
echo "status=ready" >> $GITHUB_OUTPUT
exit 0
fi
sleep 15
done
echo "::warning::Timeout: Test Cycle did not complete within 30 minutes. Pipeline will continue without test results."
echo "status=timeout" >> $GITHUB_OUTPUT
exit 0
- name: Download JUnit Report
if: steps.wait.outputs.status == 'ready'
run: |
BATCH_ID="${{ steps.start.outputs.batch_id }}"
curl -s \
"https://api.getno.com.br/v1/organizations/${{ vars.GETNO_ORG_ID }}/runs/batch/$BATCH_ID/junit-report" \
-H "x-api-key: ${{ secrets.GETNO_API_KEY }}" \
-o junit-report.xml
echo "JUnit report downloaded successfully."
echo "--- Report Preview ---"
head -50 junit-report.xml
- name: Publish Test Results
uses: dorny/test-reporter@v1
if: always() && steps.wait.outputs.status == 'ready'
with:
name: Getno Test Results
path: junit-report.xml
reporter: java-junit
fail-on-error: true
- name: Timeout Warning
if: steps.wait.outputs.status == 'timeout'
run: |
echo "::warning::Test Cycle não concluiu em 30 minutos. Os resultados de testes não foram publicados neste ciclo."
echo "Verifique o painel da Getno Assist para acompanhar o andamento do Test Cycle."
exit 0main / master por padrão. Se o seu fluxo de desenvolvimento utiliza outras branches ou estratégias de deploy (ex: develop, staging, release/*), ajuste a configuração de triggers conforme a necessidade do seu projeto.MAX_ATTEMPTS.curl, grep e sed para máxima compatibilidade com qualquer imagem Docker.environmentSlug, ele roda nesse ambiente; se não informar, roda no ambiente default do site.fail-on-error / failTaskOnFailedTests conforme sua necessidade.| Endpoint | Método | Descrição |
|---|---|---|
/sites/{siteId}/runs/batch?environmentSlug={environmentSlug} | POST | Inicia um novo Test Cycle. environmentSlug é opcional. |
/runs/batch/{batchId} | GET | Consulta status do Test Cycle. O environment é resolvido internamente pelo batch. |
/runs/batch/{batchId}/junit-report | GET | Baixa o relatório JUnit XML. O environment é resolvido internamente pelo batch. |
Todos os endpoints requerem o header x-api-key e o prefixo /organizations/{orgId}.
Quando environmentSlug não é informado na criação do batch, a API usa o ambiente default do site. Os endpoints de consulta e download do JUnit não precisam de environment, pois o batch já sabe a qual ambiente pertence.