Testes de CI com Robot Framework #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Manual CI - Execução de Testes Automatizados | |
| run-name: Testes de CI com Robot Framework | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| type: string | |
| description: Qual é a TAG do teste que você deseja executar? | |
| required: true | |
| default: "CT01ORCT02" | |
| browser: | |
| type: choice | |
| description: Qual BROWSER executar? | |
| required: true | |
| options: | |
| - "chrome" | |
| - "firefox" | |
| - "webkit" | |
| test_type: | |
| type: choice | |
| description: Qual o tipo de teste a ser executado? | |
| required: true | |
| options: | |
| - "web" | |
| - "api" | |
| - "estruturas" | |
| - "variaveis_escopos_argumentos" | |
| skip_test: | |
| type: string | |
| description: Qual é a TAG do teste que você deseja pular? (opcional) | |
| required: false | |
| default: "CT02" | |
| jobs: | |
| testing: | |
| runs-on: ubuntu-latest | |
| 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 [ "${{ inputs.test_type }}" == "web" ]; then | |
| robot -d ./resultados-testes-CI -v HEADLESS:true -v BROWSER:${{ inputs.browser }} -i ${{ inputs.tag }} testes_web/tests | |
| elif [ "${{ inputs.test_type }}" == "API" ]; then | |
| robot -d ./resultados-testes-CI testes_API/tests | |
| elif [ "${{ inputs.test_type }}" == "estruturas" ]; then | |
| robot -d ./resultados-testes-CI -v HEADLESS:true -v BROWSER:${{ inputs.browser }} trabalhando_estruturas/tests | |
| elif [ "${{ inputs.test_type }}" == "escopos" ]; then | |
| robot -d ./resultados-testes-CI -e ${{ inputs.skip_test }} trabalhando_variaveis_escopos_argumentos/tests | |
| fi | |
| - name: Run RF WEB Tests | |
| run: | | |
| robot -d ./results -v HEADLESS:true \ | |
| -v BROWSER:${{ inputs.browser }} -i ${{ inputs.tag }} tests | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ inputs.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: ${{ inputs.test_type }}_results | |
| path: ./resultados/${{ inputs.test_type }} | |
| - name: Debug - Verificar arquivos baixados | |
| if: always() | |
| run: ls -R ./resultados/${{ inputs.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: **${{ inputs.test_type }}**" >> $GITHUB_STEP_SUMMARY | |
| echo "- Status da execução: **${{ job.status == 'success' && '✅ Sucesso' || '❌ Falha' }}**" >> $GITHUB_STEP_SUMMARY |