aleeusgr / hs-clojure

Other
0 stars 0 forks source link

Implement testing #10

Open aleeusgr opened 4 months ago

aleeusgr commented 4 months ago

Here is a testing plan for the HS Clojure API:

Test Plan: HS Clojure API

Test Scope:

Test Environment:

Test Cases:

Patient Registration:

  1. Valid Patient Registration:
    • Test that a patient can be successfully registered with valid input data.
    • Verify that the patient is added to the database.
  2. Invalid Patient Registration:
    • Test that an error is thrown when attempting to register a patient with invalid input data (e.g., invalid name, sex, date of birth, address, or social security number).
    • Verify that the patient is not added to the database.
  3. Duplicate Patient Registration:
    • Test that an error is thrown when attempting to register a patient with a duplicate social security number.
    • Verify that the patient is not added to the database.

Patient Update:

  1. Valid Patient Update:
    • Test that a patient can be successfully updated with valid input data.
    • Verify that the patient's information is updated in the database.
  2. Invalid Patient Update:
    • Test that an error is thrown when attempting to update a patient with invalid input data (e.g., invalid name, sex, date of birth, address, or social security number).
    • Verify that the patient's information is not updated in the database.

Patient Deletion:

  1. Valid Patient Deletion:
    • Test that a patient can be successfully deleted.
    • Verify that the patient is removed from the database.
  2. Invalid Patient Deletion:
    • Test that an error is thrown when attempting to delete a non-existent patient.
    • Verify that the patient is not removed from the database.

Data Validation:

  1. Valid Data Validation:
    • Test that the data validation module correctly validates valid input data.
    • Verify that the data validation module returns no errors for valid input data.
  2. Invalid Data Validation:
    • Test that the data validation module correctly identifies invalid input data (e.g., invalid name, sex, date of birth, address, or social security number).
    • Verify that the data validation module returns an error message for invalid input data.

Test Data:

Test Schedule:

Test Deliverables:

Test Environment Setup:

Test Execution:

Defect Reporting:

Test Completion Criteria:

aleeusgr commented 4 months ago

Here's a suggested testing strategy for your CRUD API:

Testing Framework

Choose a testing framework for Clojure, such as clojure.test or midje. For this example, we'll use clojure.test.

Test Organization

Create a separate namespace for tests, e.g., hs-clojure.patients-test. This will help keep tests organized and separate from the main application code.

Test Categories

Divide tests into categories to ensure comprehensive coverage:

  1. Unit Tests: Focus on individual functions, such as add-patient, get-patient-by-id, etc.
  2. Integration Tests: Test interactions between functions, such as creating a patient and then retrieving it.
  3. Database Tests: Verify database interactions, such as inserting, updating, and deleting patients.

Test Scenarios

For each category, create test scenarios to cover different aspects of the API:

Unit Tests

Integration Tests

Database Tests