Skip to content

See about Mocking Databases for Testing #64

Open

Description

@pjkaufman

Look into mocking the basic functionalities that are used by the application.
This includes:

  1. MySQL
  2. SQLite
  3. MongoDB
  4. Couchbase

Activity

  1. pjkaufman commented on Aug 8, 2020

    @pjkaufman
    OwnerAuthor

    For the SQL databases, it seems like it would be better to just do integration tests using predefined sql files as resources for the structure of the databases to create. That will allow for better overall application testing. I am not too sure how to get that testing to work for both MonogDB and Couchbase.

    Mocking the database using Mockito might be an option as well.

  2. self-assigned this
    on Aug 8, 2020
  3. pjkaufman commented on Aug 13, 2020

    @pjkaufman
    OwnerAuthor

    Checklist for MySQL Tests that need to be done in order to make sure it is working correctly in a full comparison:

    • View
      • Create
      • Drop
      • Nested Views (to be added)
    • Table
      • Create
      • Drop
      • Ignore
      • Modify
        • Charset
          • Simple
          • Complex
        • Auto Increment (added back since it was not being created again if it was being dropped)
          • Simple
          • Complex
        • Collation (to be added back)
          • Simple
          • Complex
        • Engine (TBD)
          • Simple
          • Complex
      • Column
        • Column Ignore
        • Column Add
        • Column Drop
        • Column Modify
        • Column Order (TBD - probably not due to the use of maps instead of lists)
      • Index
        • Index Ignore
        • Index Add
        • Index Drop
        • Index Modify
          • Regular
          • Composite
        • Foreign Keys
          • Add
          • Drop
          • Modify
          • Ignore
          • Composite
        • Primary Keys
          • Add
          • Drop
          • Modify
          • Ignore
          • Composite
    • Clean up SQL files
  4. pjkaufman commented on Aug 14, 2020

    @pjkaufman
    OwnerAuthor

    If you were to use Mockito for unit tests, I would use it to mock DbConn subclasses since that would keep from having to actually go to the database itself while still allowing partial tests for the subclass' functionality since you can use the real methods. It would require that ResultSet be mocked as well just to make sure that as few things change as possible. Other things may need to be mocked as well.

  5. pjkaufman commented on Sep 7, 2020

    @pjkaufman
    OwnerAuthor

    Some cleanup has been done to the SQL files that are used for the integration tests. They are smaller, but some more changes need to occur in order to make sure everything works as expected. There is a table called rds that needs to have more indexes added, be renamed, and have only a few more columns than those that are used by the indexes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions