This directory contains shell-based API and integration tests for the AdventureWorks application.
These scripts test the AdventureWorks APIs and Azure Functions directly using curl and jq. They complement the Playwright E2E tests found in the parent tests/ directory.
- Deployed Azure environment (run
azd upfirst) jqinstalled for JSON parsing:sudo apt-get install jq- Environment variables set (automatically configured by
azd env)
- test-ai-and-mcp-complete.sh - Comprehensive test of AI Agent and MCP integration
- test-ai-chat-and-mcp.sh - Tests AI chat functionality with MCP tools
- test-product-comparison.sh - Tests AI-powered product comparison features
- test-search-suggestions.sh - Tests semantic search and AI suggestions
- test-send-email.sh - Basic email sending functionality
- test-email-with-attachment.sh - Email with attachment (receipt PDFs)
- test-receipt-generation.sh - Order receipt PDF generation
- test-password-functions.sh - Password hashing and verification
- test-password-reset-flow.sh - Complete password reset flow (request → validate → reset)
- test-product-reviews.sh - Product review creation and retrieval
- test-telemetry.sh - Application Insights telemetry generation
- test-robots-sitemap.sh - SEO robots.txt and sitemap.xml generation
-
run-tests-on-azure-playwright.sh - Runs Playwright E2E tests against Azure deployment
Note: Ensure Playwright browsers are installed first:
npx playwright install
# From repository root
cd tests/scripts
# Run a specific test
./test-ai-chat-and-mcp.sh
# Run password tests
./test-password-functions.sh
./test-password-reset-flow.sh# Run all test scripts
cd tests/scripts
for script in test-*.sh; do
echo "Running $script..."
./"$script"
doneMost scripts default to Azure-deployed endpoints. To test locally:
- Update
API_FUNCTIONS_URLin each script to point to localhost - Ensure services are running locally (see main QUICKSTART.md)
Scripts automatically use these variables (set by azd env):
API_FUNCTIONS_URL- Azure Functions endpointAPI_URL- DAB GraphQL API endpointVITE_API_URL- Frontend API endpointAPPINSIGHTS_CONNECTIONSTRING- Application Insights
- Tests use predefined customer IDs and product IDs
- Some tests create temporary data (reviews, emails) which is cleaned up
- Check individual script comments for specific test data requirements
Each script:
- ✅ Prints success messages in green
- ❌ Prints errors in red
- Exits with code 0 on success, non-zero on failure
"jq: command not found"
sudo apt-get update && sudo apt-get install -y jq"API_FUNCTIONS_URL not set"
azd env refresh
source <(azd env get-values)"401 Unauthorized"
- Most API tests work without authentication
- Some tests require a valid customer context
- Check that Azure deployment is complete
Azure Functions may need warmup after deployment:
curl "$API_FUNCTIONS_URL/api/health"When adding new test scripts:
- Follow naming convention:
test-<feature>.sh - Include clear comments and usage examples
- Use proper exit codes (0 = success, non-zero = failure)
- Validate required dependencies at script start
- Clean up any test data created