AgentSkillsCN

run-tests

指导用户在 SnapLogic 项目中运行 Robot Framework 测试。当用户希望执行测试、需要了解应使用何种 make 命令,或想要深入理解测试标签与执行选项时,可参考本指南。

SKILL.md
--- frontmatter
name: run-tests
description: Guides users on running Robot Framework tests in the SnapLogic project. Use when the user wants to run tests, needs to know which make command to use, or wants to understand test tags and execution options.
user-invocable: true

Robot Framework Test Execution Guide

Claude Instructions

IMPORTANT: When user asks a simple question like "How do I run Oracle tests?", provide a concise answer first with just the command(s), then offer to explain more if needed. Do NOT dump all documentation.

Response format for simple questions:

  1. Give the direct command(s) first
  2. Add a brief note if relevant
  3. Offer "Want me to explain more?" only if appropriate

Quick Command Reference

Test TypeCommand
Oraclemake robot-run-all-tests TAGS="oracle" PROJECT_SPACE_SETUP=True
PostgreSQLmake robot-run-all-tests TAGS="postgres" PROJECT_SPACE_SETUP=True
Snowflakemake robot-run-all-tests TAGS="snowflake" PROJECT_SPACE_SETUP=True
Kafkamake robot-run-all-tests TAGS="kafka" PROJECT_SPACE_SETUP=True
MySQLmake robot-run-all-tests TAGS="mysql" PROJECT_SPACE_SETUP=True
Multiplemake robot-run-all-tests TAGS="oracle OR postgres" PROJECT_SPACE_SETUP=True

Note: Use PROJECT_SPACE_SETUP=True for first run, omit for subsequent runs.


Usage Examples

What You WantExample Prompt
Explain test execution/run-tests Explain how to run robot tests in this project
Run specific tests/run-tests How do I run Oracle tests?
First time setup/run-tests I'm running tests for the first time, what should I do?
Understand tags/run-tests What tags are available for running tests?
Run multiple tests/run-tests How do I run both Snowflake and Kafka tests?
View results/run-tests Where are the test results stored?
Troubleshoot/run-tests My tests are failing, how do I debug?
Quick iteration/run-tests I want to run tests quickly without Groundplex setup

Why Make Commands Instead of Robot Command?

Important: In a standard Robot Framework setup, you would run tests directly using:

bash
robot --include oracle test/suite/

However, this project uses a dockerized environment. This means:

  1. Tests run inside Docker containers - Not on your local machine
  2. Services (databases, Kafka, etc.) run in containers - They communicate via Docker networks
  3. Environment variables are managed - Loaded from .env files into containers
  4. Groundplex runs in a container - For SnapLogic pipeline execution

The make commands handle all this complexity for you:

  • Start the correct Docker containers
  • Set up networking between services
  • Load environment variables
  • Execute Robot Framework inside the tools container
  • Manage Groundplex lifecycle

Quick Start

First Time Setup (Full Workflow)

bash
# Complete workflow: create project space, launch Groundplex, run tests
make robot-run-all-tests TAGS="snowflake_demo" PROJECT_SPACE_SETUP=True

Subsequent Runs (Project Space Exists)

bash
# Run tests using existing project space
make robot-run-all-tests TAGS="snowflake_demo"

Quick Iteration (Groundplex Already Running)

bash
# Run tests without Groundplex management
make robot-run-tests-no-gp TAGS="snowflake_demo"

Understanding the Make Targets

1. robot-run-all-tests - Full Workflow with Groundplex

Use this when: First time setup, CI/CD pipelines, or you need Groundplex managed automatically.

bash
make robot-run-all-tests TAGS="your_tags" PROJECT_SPACE_SETUP=True|False

Execution Flow:

code
Phase 1: Project Space Setup
        ↓
Phase 2: Launch Groundplex
        ↓
Phase 2.1: Set Permissions (Travis CI)
        ↓
Phase 3: Run Tests

Behavior with PROJECT_SPACE_SETUP:

SettingPhase 1 BehaviorPhase 2 Behavior
TrueDeletes existing project space, creates new one with SnaplexLaunches Groundplex container
False (default)Verifies project space exists (fails if missing)Launches Groundplex container

2. robot-run-tests-no-gp - Without Groundplex Launch

Use this when: Groundplex is already running, or tests don't need Groundplex.

bash
make robot-run-tests-no-gp TAGS="your_tags" PROJECT_SPACE_SETUP=True|False

Execution Flow:

code
Phase 1: Project Space Setup
        ↓
Phase 2: SKIPPED (No Groundplex)
        ↓
Phase 2.1: Set Permissions (Travis CI)
        ↓
Phase 3: Run Tests

Behavior with PROJECT_SPACE_SETUP:

SettingPhase 1 BehaviorGroundplex
TrueDeletes existing project space, creates new one (NO Snaplex)Not launched
False (default)Verifies project space existsNot launched

3. robot-run-tests - Base Target (Direct Execution)

Use this when: You need fine-grained control without any environment setup.

bash
make robot-run-tests TAGS="your_tags" PROJECT_SPACE_SETUP=True|False

Note: This is the base target that the other two call internally. It only executes tests without project space or Groundplex management.


Comparison Table

Featurerobot-run-all-testsrobot-run-tests-no-gp
Creates Project SpaceYes (when PROJECT_SPACE_SETUP=True)Yes (when PROJECT_SPACE_SETUP=True)
Creates Snaplex/PlexYes (when PROJECT_SPACE_SETUP=True)No - Never
Launches GroundplexYes - AlwaysNo - Never
Auto-retry on Active NodesYes (stops GP, waits 60s, retries)No (only logs warning)
Verifies Project SpaceYes (when PROJECT_SPACE_SETUP=False)Yes (when PROJECT_SPACE_SETUP=False)
Execution TimeLonger (includes GP startup)Shorter (skips GP)

When to Use Which Target

ScenarioRecommended Command
First time setup / Fresh environmentmake robot-run-all-tests TAGS="..." PROJECT_SPACE_SETUP=True
CI/CD pipeline - full workflowmake robot-run-all-tests TAGS="..." PROJECT_SPACE_SETUP=True
Running tests after initial setupmake robot-run-all-tests TAGS="..."
Groundplex already running externallymake robot-run-tests-no-gp TAGS="..."
Tests don't need Groundplexmake robot-run-tests-no-gp TAGS="..."
Quick test iteration (GP already up)make robot-run-tests-no-gp TAGS="..."
Create project space only (no plex)make robot-run-tests-no-gp TAGS="..." PROJECT_SPACE_SETUP=True
Reset project space with new plexmake robot-run-all-tests TAGS="..." PROJECT_SPACE_SETUP=True

Understanding Robot Framework Tags

Tags are labels attached to test cases that allow you to selectively run tests.

How Tags Work

robotframework
*** Test Cases ***
Create Triggered Task
    [Documentation]    Creates a triggered task for pipeline execution
    [Tags]    snowflake_demo    task_creation    smoke
    [Template]    Create Triggered Task From Template
    ${unique_id}    ${PIPELINES_LOCATION_PATH}    ${pipeline_name}    ${task_name}

Using Tags with Make Commands

bash
# Run only tests with 'snowflake_demo' tag
make robot-run-all-tests TAGS="snowflake_demo"

# Run tests with 'smoke' tag
make robot-run-all-tests TAGS="smoke"

# Run tests with multiple tags (OR logic - runs if ANY tag matches)
make robot-run-all-tests TAGS="snowflake_demo OR postgres_demo"

# Run tests with multiple tags (AND logic - runs only if ALL tags match)
make robot-run-all-tests TAGS="snowflake_demo AND task_creation"

# Exclude tests with specific tag
make robot-run-all-tests TAGS="NOT cleanup"

Common Tag Categories

Tag TypeExamplesPurpose
Feature Tagssnowflake_demo, postgres_demo, oracleTests for specific features/databases
Action Tagstask_creation, task_execution, accountCategorize by operation type
Priority Tagssmoke, regression, criticalTest importance/frequency
Setup Tagssetup, cleanup, teardown, createplexSetup and cleanup tests
Verification Tagsverify_project_space_existsEnvironment state verification

Special Framework Tags

TagUsed ByPurpose
createplexrobot-run-all-testsCreates project space and Snaplex when PROJECT_SPACE_SETUP=True
verify_project_space_existsBoth targetsVerifies or creates project space

Available Test Tags by System

TagDescriptionRequired Service
oracleOracle database testsmake oracle-start
postgresPostgreSQL testsmake postgres-start
mysqlMySQL testsmake mysql-start
sqlserverSQL Server testsmake sqlserver-start
snowflakeSnowflake testsmake snowflake-mock-start
db2DB2 testsmake db2-start
teradataTeradata testsmake teradata-start
kafkaKafka messaging testsmake kafka-start
jmsActiveMQ/JMS testsmake activemq-start
salesforceSalesforce mock testsmake salesforce-mock-start
s3 / minioS3/MinIO testsmake minio-start
emailEmail testsmake maildev-start

Step-by-Step Examples

Example 1: Running Snowflake Tests (First Time)

bash
# 1. Start required services
make start-services

# 2. Run tests with full setup
make robot-run-all-tests TAGS="snowflake_demo" PROJECT_SPACE_SETUP=True

# 3. View results
open test/robot_output/report-*.html

Example 2: Running Oracle Tests

bash
# 1. Start Oracle database
make oracle-start

# 2. Wait for Oracle to be ready (check logs)
make oracle-logs

# 3. Load test data (if needed)
make oracle-load-data

# 4. Run Oracle tests
make robot-run-all-tests TAGS="oracle" PROJECT_SPACE_SETUP=True

# 5. View results
open test/robot_output/report-*.html

Example 3: Running Kafka Tests

bash
# 1. Start Kafka cluster
make kafka-start

# 2. Create test topics
make kafka-create-topics

# 3. Run Kafka tests
make robot-run-all-tests TAGS="kafka" PROJECT_SPACE_SETUP=True

Example 4: Running Multiple System Tests

bash
# Start required services
make oracle-start
make postgres-start

# Run tests for both (OR logic)
make robot-run-all-tests TAGS="oracle OR postgres" PROJECT_SPACE_SETUP=True

Example 5: Quick Test Iteration (After Initial Setup)

bash
# Groundplex is already running, just re-run tests
make robot-run-tests-no-gp TAGS="snowflake_demo"

Pre-requisites Checklist

Before running tests, ensure:

1. Environment Configuration

bash
# Verify .env file exists and is configured
make check-env

# Or manually check key variables
cat .env | grep -E "^(URL|ORG_|PROJECT_)"

2. Required Services Running

bash
# Check overall status
make status

# Check specific service
make oracle-status  # or postgres-status, etc.

3. Docker Environment

bash
# Verify Docker is running
docker ps

# Check project containers
make show-running

Test Results

Location

code
test/robot_output/
├── output-YYYYMMDD-HHMMSS.xml   # Raw results (for CI/CD)
├── log-YYYYMMDD-HHMMSS.html     # Detailed execution log
└── report-YYYYMMDD-HHMMSS.html  # Summary report (open this)

Viewing Results

bash
# Open the latest report (macOS)
open test/robot_output/report-*.html

# Find the latest report
ls -lt test/robot_output/report-*.html | head -1

Sharing Results

bash
# Send to Slack
make slack-notify

# Upload to S3
make upload-test-results

Troubleshooting

Common Issues

IssueCauseSolution
"Environment variable not found"Missing .env file or variablesRun make check-env
"Connection refused" to databaseService not runningRun make <db>-start and check make <db>-status
"Groundplex not available"Groundplex not startedUse robot-run-all-tests or start manually with make launch-groundplex
"Project space not found"First run without setupAdd PROJECT_SPACE_SETUP=True
"Active Snaplex nodes" errorOld Groundplex still registeredrobot-run-all-tests auto-retries; for no-gp run make stop-groundplex manually
Tests hang or timeoutService health issuesCheck make status and container logs

Debug Steps

  1. Check Test Logs:

    bash
    open test/robot_output/log-*.html
    
  2. Check Container Logs:

    bash
    make logs-tools        # Test container logs
    make oracle-logs       # Database logs (replace with your system)
    
  3. Verify Environment:

    bash
    make check-env
    make status
    
  4. Re-run with Fresh Setup:

    bash
    make stop-groundplex
    make robot-run-all-tests TAGS="..." PROJECT_SPACE_SETUP=True
    

Quick Reference Commands

bash
# Full setup with new project space and plex
make robot-run-all-tests TAGS="snowflake_demo" PROJECT_SPACE_SETUP=True

# Run tests using existing project space (launch GP)
make robot-run-all-tests TAGS="snowflake_demo"

# Run tests when GP is already running
make robot-run-tests-no-gp TAGS="snowflake_demo"

# Create project space only (no plex, no GP launch)
make robot-run-tests-no-gp TAGS="oracle" PROJECT_SPACE_SETUP=True

# Check environment
make check-env

# View running containers
make status

# Stop Groundplex
make stop-groundplex

# View test results
open test/robot_output/report-*.html

Architecture Overview

code
┌─────────────────────────────────────────────────────────────────────────┐
│                         User Commands                                    │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│   ┌───────────────────────┐       ┌───────────────────────┐            │
│   │  robot-run-all-tests  │       │  robot-run-tests-no-gp │            │
│   │  (Full Workflow)      │       │  (No GP Workflow)      │            │
│   └───────────┬───────────┘       └───────────┬───────────┘            │
│               │                               │                         │
│               │   Phase 1: Project Space      │                         │
│               │   Phase 2: Launch GP          │   Phase 2: SKIPPED      │
│               │   Phase 2.1: Permissions      │   Phase 2.1: Permissions│
│               │   Phase 3: Run Tests          │   Phase 3: Run Tests    │
│               │                               │                         │
│               └───────────────┬───────────────┘                         │
│                               │                                         │
│                               ▼                                         │
│               ┌───────────────────────────────┐                         │
│               │       robot-run-tests         │                         │
│               │       (Base Target)           │                         │
│               │                               │                         │
│               │  - Executes Robot Framework   │                         │
│               │  - Inside Docker container    │                         │
│               │  - With specified TAGS        │                         │
│               └───────────────────────────────┘                         │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘