Skip to content

kyrexi/trafix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trafix - API Testing Framework

Trafix is a modern, efficient API testing framework that simplifies the process of generating, executing, and managing API test cases. Built with a Go backend and Next.js frontend, APILUX delivers high performance, reliability, and an intuitive user experience.


🚀 Features

  • Dynamic Test Case Generation: Automatically create test cases based on provided API details.
  • Interactive Frontend: A clean and responsive interface for managing test cases and viewing results.
  • Test Case Customization: Edit, delete, or add new test cases seamlessly.
  • Execution and Results Display: Execute test cases and review structured results, including status codes, response bodies, and execution times.

📋 Table of Contents

  1. Frontend Workflow
  2. Backend Workflow
  3. Backend Test Case Generation
  4. Usage
  5. License
  6. Future-Enhancements
  7. Contributing

🔄 Frontend Workflow

1. User Interaction

  1. API Information Form:

    • Input fields for:
      • Endpoint URL
      • HTTP Method (GET, POST, PUT, DELETE)
      • Headers (optional)
      • Payload/Body (for POST/PUT requests)
  2. Generated Test Cases Display:

    • View autogenerated test cases, such as boundary tests and response validation tests.
  3. Edit Test Cases:

    • Modify, delete, or add new test cases.
  4. Execute Test Cases:

    • Click a button to execute all test cases.
  5. View Results:

    • Results displayed in a table format with:
      • Test case name
      • Status code
      • Response body
      • Execution time

🔧 Backend Workflow

1. Test Case Management

  • Receiving API Info: API details are received from the frontend via the Go backend.
  • Generating Test Cases:
    • Predefined logic or AI APIs (e.g., OpenAI) create diverse test cases.
    • Test cases are stored in a MongoDB database.

2. Test Case Execution

  • Execution Trigger: A Kestra workflow is initiated with test case details.
  • Execution and Storage:
    • Test cases are executed, and results are stored in MongoDB.
    • Results include response details like status codes and execution times.

📂 Backend Test Case Generation

  1. Receive API Info:

    • Endpoint: /api/generate-test-cases
    • Input: API details (URL, method, headers, payload)
    • Validation: Ensure required fields are provided.
  2. Generate Test Cases:

    • Happy Path Tests: Valid inputs expected to succeed.
    • Negative Tests: Invalid inputs (e.g., wrong data types, missing fields).
    • Boundary Tests: Edge cases for parameters.
    • Performance Tests: High payload or frequent requests.
  3. Store Test Cases:

    • Save test cases in the test_cases collection in MongoDB.
  4. Execute Test Cases:

    • Endpoint: /api/test-cases/run
    • Trigger Kestra workflows for test execution.

📦 Usage

After setting up the backend and frontend, you can start using APILUX to test APIs. Follow these steps to get started:

  1. Open your browser and navigate to the frontend at http://localhost:3000.
  2. API Information Form: Enter the API details such as:
    • Endpoint URL
    • HTTP Method (GET, POST, PUT, DELETE)
    • Headers (optional)
    • Payload/Body (for POST/PUT requests)
  3. Generate Test Cases: The system will automatically generate test cases based on the provided API details.
  4. Modify Test Cases: You can edit, delete, or add new test cases as needed.
  5. Execute Tests: Click the "Run Tests" button to execute the test cases.
  6. View Results: The test results will be displayed, showing:
    • Test Case Name/Description
    • Status Code
    • Execution Time
    • Pass/Fail status

📄 License

APILUX is licensed under the MIT License.


🎯 Future Enhancements

We have exciting plans to further improve APILUX and provide a more comprehensive API testing experience:

  1. Enhanced Reporting: Add more detailed analytics and insights for test case execution, such as visualized metrics and trends.
  2. Multiple Test Formats: Provide support for importing and exporting test cases in popular formats like Postman collections and Swagger files.
  3. Integration Testing: Extend the framework to include support for integration testing, enabling end-to-end validations.
  4. CI/CD Integration: Seamlessly integrate APILUX with CI/CD pipelines using tools like Jenkins, GitHub Actions, GitLab CI, and others.

🤝 Contributing

APILUX is Open Source 🥳🥳

Feel free to reach out to us if you have any questions or ideas. We welcome contributions to Trafix! If you would like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes and commit them (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a pull request to the main branch.

Please make sure your code follows the existing style and includes proper tests where applicable.

We encourage contributions from the community. Whether it's fixing a bug, adding a new feature, or improving documentation, your input is valuable. For any questions or feedback, feel free to open an issue or reach out to us.