{"id":50771481,"url":"https://github.com/jasonlyle88/sqlcl-unit-testing","last_synced_at":"2026-06-11T19:01:43.171Z","repository":{"id":200845853,"uuid":"706372579","full_name":"jasonlyle88/sqlcl-unit-testing","owner":"jasonlyle88","description":"A bash script for unit testing SQLcl and SQLcl Liquibase features","archived":false,"fork":false,"pushed_at":"2025-05-22T19:08:35.000Z","size":94,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-22T20:19:50.385Z","etag":null,"topics":["oracle","sqlcl"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasonlyle88.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-17T20:21:06.000Z","updated_at":"2025-05-22T19:07:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c3edde6-67cd-4562-ac81-d37b6e1b016f","html_url":"https://github.com/jasonlyle88/sqlcl-unit-testing","commit_stats":null,"previous_names":["jasonlyle88/sqlcl-unit-testing"],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/jasonlyle88/sqlcl-unit-testing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlyle88%2Fsqlcl-unit-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlyle88%2Fsqlcl-unit-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlyle88%2Fsqlcl-unit-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlyle88%2Fsqlcl-unit-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonlyle88","download_url":"https://codeload.github.com/jasonlyle88/sqlcl-unit-testing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlyle88%2Fsqlcl-unit-testing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34213179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["oracle","sqlcl"],"created_at":"2026-06-11T19:01:42.559Z","updated_at":"2026-06-11T19:01:43.162Z","avatar_url":"https://github.com/jasonlyle88.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqlcl-unit-testing\n\n## Description\n\nA bash script for unit testing SQLcl and SQLcl Liquibase features.\n\nThis script runs three different kinds of tests:\n1. SQLcl (direct)\n    - This test type invokes SQLcl and provides the connection information on command line, sets up the session for testing, and then calls the unit test SQL script.\n2. SQLcl (wrapped)\n    - This test type invokes SQLcl with `nolog` then issues a connect command from inside SQLcl, sets up the session for testing, and then calls the unit test SQL script.\n3. SQLcl Liquibase\n    - This test type ivokes SQLcl and provies the connection information on the command line, sets up the session for testing, and then calls liquibase update on the provided unit test changelog (using a unique changelog table name).\n\nAll tests are run in parallel to improve execution time. However, that means if you have 5 tests, 5 instances of SQLcl will run.\n\nFor execution specifics, you can run the command with the `-h` parameter.\n\n## Writing Unit Tests\n\nUnit tests are determined to be passing or failing based on the exit code of SQLcl. Because of this, it is the responsibility of the test writer to ensure that an error is thrown when a test does not meet expectations. The SQLcl session is set up for the user to already have `whenever sqlerror exit failure` set. See the `lb_unit_tests`, `sqlcl_direct_unit_tests`, and `sqlcl_wrapped_unit_tests` directories for examples of unit tests.\n\n## Results\n\nWhen the unit test script finishes executing, it will output a table summary of the results showing the test type, test name, and test result. There will also be a directory created at the location from which you executed the unit tests called `sqlclUnitTestResults_[YYYYMMDD_HH24MISS]` where the bracketed section is replaced with the timestamp of when the unit test was run. This folder will have a directory for each type of tests, and each of those folders will have a log file per test that contains all the output from SQLcl for that test.\n\n## Example\n```shell\n\u003e ./source/sqlclUnitTest.sh -u 'user' -c 'localhost' -b /opt/sqlcl/23.3.0.270.1251/bin/sql\n--------------------------------------------------------------------------------\n--------------------------------------------------------------------------------\n-- SQLcl Liquibase Unit Testing\n--------------------------------------------------------------------------------\n--------------------------------------------------------------------------------\n\n--------------------------------------------------------------------------------\n-- Check database connection\n--------------------------------------------------------------------------------\n-- Username          : \"user\"\n-- Connect Identifier: \"localhost\"\n--------------------------------------------------------------------------------\nNo password was provided. Prompting for password...\nDatabase password:\nDatabase connection test successful!\n\n--------------------------------------------------------------------------------\n-- Run unit tests\n--------------------------------------------------------------------------------\n\n------------------------------------------------------------\n-- SQLcl (direct) unit tests\n------------------------------------------------------------\n/Users/jlyle/Library/CloudStorage/Dropbox/personal/development/sqlcl-unit-testing/source/sqlcl_direct_unit_tests\n\nExecuting test in background: \"sqlcl-liquibase-do-not-prompt-password\"\n\n------------------------------------------------------------\n-- SQLcl (wrapped) unit tests\n------------------------------------------------------------\n/Users/jlyle/Library/CloudStorage/Dropbox/personal/development/sqlcl-unit-testing/source/sqlcl_wrapped_unit_tests\n\nExecuting test in background: \"sqlcl-builtin-variable-set-for-wrapped-connect\"\n\n------------------------------------------------------------\n-- SQLcl Liquibase unit tests\n------------------------------------------------------------\n/Users/jlyle/Library/CloudStorage/Dropbox/personal/development/sqlcl-unit-testing/source/lb_unit_tests\n\nExecuting test in background: \"context-filtering-include\"\nExecuting test in background: \"context-filtering-includeAll\"\nExecuting test in background: \"context-filtering-property\"\nExecuting test in background: \"property-cannot-be-reset\"\nExecuting test in background: \"relative-to-changelog-works-for-runApexScript\"\nExecuting test in background: \"relative-to-changelog-works-for-runOracleScript\"\nExecuting test in background: \"sqlclversion-property-exists\"\n\n--------------------------------------------------------------------------------\n-- Wait for unit test execution to finish\n--------------------------------------------------------------------------------\nUnit tests finished running.\n\n--------------------------------------------------------------------------------\n-- Gather unit test results\n--------------------------------------------------------------------------------\nFinished gathering unit test results.\n\n--------------------------------------------------------------------------------\n-- Unit test results\n--------------------------------------------------------------------------------\n\n----------------------------------------------------------------------------------\n| Test Type       | Test Name                                       | Test Result\n----------------------------------------------------------------------------------\n| SQLcl (direct)  | sqlcl-liquibase-do-not-prompt-password          | Failed (2)\n| SQLcl (wrapped) | sqlcl-builtin-variable-set-for-wrapped-connect  | Succeeded\n| SQLcl Liquibase | context-filtering-include                       | Succeeded\n| SQLcl Liquibase | context-filtering-includeAll                    | Succeeded\n| SQLcl Liquibase | context-filtering-property                      | Failed (2)\n| SQLcl Liquibase | property-cannot-be-reset                        | Succeeded\n| SQLcl Liquibase | relative-to-changelog-works-for-runApexScript   | Failed (2)\n| SQLcl Liquibase | relative-to-changelog-works-for-runOracleScript | Failed (2)\n| SQLcl Liquibase | sqlclversion-property-exists                    | Succeeded\n----------------------------------------------------------------------------------\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonlyle88%2Fsqlcl-unit-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonlyle88%2Fsqlcl-unit-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonlyle88%2Fsqlcl-unit-testing/lists"}