* Main execution function
()
| 695 | * Main execution function |
| 696 | */ |
| 697 | async function main () { |
| 698 | console.log("🔥 Tenso Framework Load Testing Suite"); |
| 699 | console.log("=".repeat(50)); |
| 700 | console.log("This will run comprehensive load tests using autocannon"); |
| 701 | console.log("Tests include various load levels, request types, and stress scenarios\n"); |
| 702 | |
| 703 | // Create and start the main test server |
| 704 | const server = createTestServer(); |
| 705 | const startedServer = await startServer(server); |
| 706 | |
| 707 | console.log(`Test server started on port ${startedServer.server.address().port}`); |
| 708 | |
| 709 | const allResults = []; |
| 710 | |
| 711 | try { |
| 712 | // Run all test suites |
| 713 | const basicResults = await basicLoadTests(startedServer); |
| 714 | allResults.push({ name: "Basic Tests", results: basicResults }); |
| 715 | |
| 716 | const postResults = await postLoadTests(startedServer); |
| 717 | allResults.push({ name: "POST Tests", results: postResults }); |
| 718 | |
| 719 | const formatResults = await formatLoadTests(startedServer); |
| 720 | allResults.push({ name: "Format Tests", results: formatResults }); |
| 721 | |
| 722 | const rateLimitResults = await rateLimitLoadTests(); |
| 723 | allResults.push({ name: "Rate Limit", results: rateLimitResults }); |
| 724 | |
| 725 | const paramResults = await parameterizedTests(startedServer); |
| 726 | allResults.push({ name: "Parameterized", results: paramResults }); |
| 727 | |
| 728 | const mixedResults = await mixedWorkloadTests(startedServer); |
| 729 | allResults.push({ name: "Mixed Load", results: mixedResults }); |
| 730 | |
| 731 | const hypermediaEnabledResults = await hypermediaEnabledTests(); |
| 732 | allResults.push({ name: "Hypermedia Enabled", results: hypermediaEnabledResults }); |
| 733 | |
| 734 | const hypermediaDisabledResults = await hypermediaDisabledTests(); |
| 735 | allResults.push({ name: "Hypermedia Disabled", results: hypermediaDisabledResults }); |
| 736 | |
| 737 | // Ask before running stress tests |
| 738 | console.log("\n⚠️ Stress tests can be resource intensive."); |
| 739 | console.log("Running stress tests automatically...\n"); |
| 740 | |
| 741 | const stressResults = await stressTests(startedServer); |
| 742 | allResults.push({ name: "Stress Tests", results: stressResults }); |
| 743 | |
| 744 | // Generate summary report |
| 745 | generateSummaryReport(allResults); |
| 746 | |
| 747 | console.log("\n✅ All load tests completed successfully!"); |
| 748 | |
| 749 | } catch (error) { |
| 750 | console.error("\n❌ Load test failed:", error); |
| 751 | process.exit(1); |
| 752 | } finally { |
| 753 | // Clean up |
| 754 | startedServer.stop(); |
no test coverage detected