Skip to content

Testes de CI com Robot Framework #3

Testes de CI com Robot Framework

Testes de CI com Robot Framework #3

name: CI - Execução de Testes Automatizados
run-name: Testes de CI com Robot Framework
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
testing:
runs-on: ubuntu-latest
strategy:
matrix:
test_type: [API, estruturas, escopos] # Adicione os tipos de teste que você deseja executar aqui
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Python 3.12.0
uses: actions/setup-python@v4
with:
python-version: '3.12.0'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
pip install -U -r requirements.txt
- name: Run tests
run: |
if [ "${{ matrix.test_type }}" == "API" ]; then
robot -d ./resultados-testes-CI testes_API/tests
elif [ "${{ matrix.test_type }}" == "estruturas" ]; then
robot -d ./resultados-testes-CI -v HEADLESS:true -v BROWSER:chrome trabalhando_estruturas/tests
elif [ "${{ matrix.test_type }}" == "escopos" ]; then
robot -d ./resultados-testes-CI -e CT02 trabalhando_variaveis_escopos_argumentos/tests
fi
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.test_type }}_results
path: ./resultados-testes-CI
if-no-files-found: ignore
retention-days: 2
- name: Download results
if: always()
uses: actions/download-artifact@v4
with:
name: ${{ matrix.test_type }}_results
path: ./resultados/${{ matrix.test_type }}
- name: Debug - Verificar arquivos baixados
if: always()
run: ls -R ./resultados/${{ matrix.test_type }} || echo "Nenhum arquivo baixado!"
- name: Publicar Sumário no GitHub Actions
if: always()
run: |
echo "## 📊 Resultados dos Testes Automatizados 🚀" >> $GITHUB_STEP_SUMMARY
echo "- Tipo de teste: **${{ matrix.test_type }}**" >> $GITHUB_STEP_SUMMARY
echo "- Status da execução: **${{ job.status == 'success' && '✅ Sucesso' || '❌ Falha' }}**" >> $GITHUB_STEP_SUMMARY