Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement testing #10

Open
Tracked by #6
aleeusgr opened this issue May 13, 2024 · 1 comment
Open
Tracked by #6

Implement testing #10

aleeusgr opened this issue May 13, 2024 · 1 comment

Comments

@aleeusgr
Copy link
Owner

aleeusgr commented May 13, 2024

Here is a testing plan for the HS Clojure API:

Test Plan: HS Clojure API

Test Scope:

  • The testing scope includes the entire HS Clojure API, including the patient registration, update, and deletion functionality.
  • The testing scope also includes the data validation module.

Test Environment:

  • The testing environment will consist of a local development environment with a PostgreSQL database.
  • The testing environment will be set up with the necessary dependencies, including Leiningen, Clojure, and PostgreSQL.

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:

  • A set of test patients with valid and invalid input data will be created to test the patient registration, update, and deletion functionality.
  • A set of test data will be created to test the data validation module.

Test Schedule:

  • The testing will be performed in two phases:
    • Phase 1: Unit testing of individual components (e.g., patient registration, update, deletion, and data validation).
    • Phase 2: Integration testing of the entire HS Clojure API.

Test Deliverables:

  • A test report detailing the test results, including any defects or issues found.
  • A set of test cases and test data used to test the HS Clojure API.

Test Environment Setup:

  • The testing environment will be set up with the necessary dependencies, including Leiningen, Clojure, and PostgreSQL.
  • The testing environment will be configured to use a local development database.

Test Execution:

  • The testing will be performed manually by a qualified tester.
  • The testing will be performed in accordance with the test plan and test cases.

Defect Reporting:

  • Any defects or issues found during testing will be reported to the development team.
  • The defects or issues will be tracked and resolved in accordance with the project's defect tracking process.

Test Completion Criteria:

  • The testing will be considered complete when all test cases have been executed and the test results have been documented.
  • The testing will be considered complete when all defects or issues have been resolved and the HS Clojure API has been verified to meet the functional requirements.
@aleeusgr aleeusgr mentioned this issue May 13, 2024
9 tasks
@aleeusgr aleeusgr mentioned this issue May 20, 2024
Merged
@aleeusgr
Copy link
Owner Author

aleeusgr commented Jun 4, 2024

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

  • add-patient:
    • Happy path: valid input, patient created successfully
    • Error handling: invalid input (e.g., missing required fields)
  • get-patient-by-id:
    • Happy path: patient found by ID
    • Error handling: patient not found, invalid ID
  • update-patient:
    • Happy path: patient updated successfully
    • Error handling: invalid input, patient not found
  • delete-patient:
    • Happy path: patient deleted successfully
    • Error handling: patient not found, invalid ID

Integration Tests

  • Create a patient and retrieve it by ID
  • Create a patient, update it, and retrieve the updated patient
  • Create a patient, delete it, and verify it's no longer retrievable

Database Tests

  • Verify database schema creation (e.g., create-patients-table)
  • Test data insertion, updating, and deletion using the database functions (e.g., insert-patient, update-patient, delete-patient)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant