===========================================
REFERENCIA RÁPIDA - AZURE DEVOPS
Framework Hakalab - Integración Automática
===========================================

CONFIGURACIÓN RÁPIDA (3 PASOS)
===============================

1. Instalar dependencia:
   pip install requests

2. Configurar .env:
   AZURE_DEVOPS_ENABLED=true
   AZURE_DEVOPS_ORG=tu-organizacion
   AZURE_DEVOPS_PROJECT=tu-proyecto
   AZURE_DEVOPS_PAT=tu-personal-access-token
   AZURE_DEVOPS_STATUS_FIELD=Custom.TestStatus
   AZURE_DEVOPS_STATUS_PASSED=Passed
   AZURE_DEVOPS_STATUS_FAILED=Failed
   AZURE_DEVOPS_ATTACH_REPORT=true
   AZURE_DEVOPS_REPORT_PATH=reports/report.html

3. Environment.py (NO NECESITAS CAMBIAR NADA):
   from hakalab_framework.behave_plugin import (
       before_all, after_all, before_feature, after_feature,
       before_scenario, after_scenario, before_step, after_step
   )
   from hakalab_framework.steps import *

¡ESO ES TODO! El plugin se activa automáticamente.

USO EN FEATURES
===============

Convención de Tags:
- Primer tag: ID del Test Case (@TC-123)
- Segundo tag: ID de la Task (@TASK-456)

Ejemplo:

@TC-1234 @TASK-5678
Scenario: Login exitoso
  Given navego a "https://example.com/login"
  When ingreso "user@example.com" en el campo "email"
  Then veo el elemento "Dashboard"

Resultado:
✅ Test Case 1234 actualizado con estado "Passed" o "Failed"
✅ Reporte adjuntado a Task 5678

FORMATOS DE TAG SOPORTADOS
===========================

✅ @123 (solo número)
✅ @TC-123 (prefijo + número)
✅ @TASK-456 (prefijo + número)
✅ @US-789 (cualquier prefijo + número)

EJEMPLOS RÁPIDOS
=================

Solo Test Case (sin reporte):
@TC-1235
Scenario: Mi test
  ...

Test Case + Task (con reporte):
@TC-1236 @TASK-5679
Scenario: Mi test
  ...

Sin tags (no actualiza Azure DevOps):
Scenario: Test exploratorio
  ...

Con @no_browser (API testing):
@TC-1237 @TASK-5680 @no_browser
Scenario: Test de API
  ...

CÓMO OBTENER EL PAT
===================

1. Ve a: https://dev.azure.com/{tu-organizacion}
2. Avatar > Personal access tokens > New Token
3. Scopes: Work Items (Read & Write)
4. Copia el token generado

TROUBLESHOOTING RÁPIDO
=======================

Error: "401 Unauthorized"
→ Verifica PAT válido y con permisos

Error: "404 Not Found"
→ Verifica organización, proyecto y work item ID

Error: "Field does not exist"
→ Verifica AZURE_DEVOPS_STATUS_FIELD en Project Settings

Error: "requests not found"
→ pip install requests

Plugin no se activa:
→ Verifica AZURE_DEVOPS_ENABLED=true en .env

VARIABLES DE ENTORNO
====================

Requeridas:
-----------
AZURE_DEVOPS_ENABLED=true
AZURE_DEVOPS_ORG=tu-organizacion
AZURE_DEVOPS_PROJECT=tu-proyecto
AZURE_DEVOPS_PAT=tu-pat

Opcionales:
-----------
AZURE_DEVOPS_STATUS_FIELD=Custom.TestStatus
AZURE_DEVOPS_STATUS_PASSED=Passed
AZURE_DEVOPS_STATUS_FAILED=Failed
AZURE_DEVOPS_ATTACH_REPORT=true
AZURE_DEVOPS_REPORT_PATH=reports/report.html
AZURE_DEVOPS_API_VERSION=7.1

VENTAJAS DEL SISTEMA DE PLUGINS
================================

✅ Cero código adicional en environment.py
✅ Se activa/desactiva con variable de entorno
✅ No interfiere con otros plugins
✅ Configuración por proyecto en .env
✅ Actualización automática de Test Cases
✅ Adjuntar reportes automáticamente

RECURSOS
========

Documentación completa: GUIA_AZURE_DEVOPS_NotebookLM.txt
Ejemplos: hakalab_framework/examples/azure_devops_integration_example.feature
Template .env: hakalab_framework/examples/.env.azure_devops_example
Environment ejemplo: hakalab_framework/examples/environment_simple_with_azure.py

===========================================
FIN DE LA REFERENCIA RÁPIDA
===========================================
