From de985449b178b0e80e9d1ed40c1f536bf0e568a4 Mon Sep 17 00:00:00 2001 From: alex-dzeda <120701369+alex-dzeda@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:23:51 -0600 Subject: [PATCH] BCDA-7488: Add single test information (#147) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## đŸŽĢ Ticket https://jira.cms.gov/browse/BCDA-7488 ## 🛠 Changes Added information to the README on running single tests. ## ℹī¸ Context for reviewers N/A ## ✅ Acceptance Validation Confirmed proper formatting for content added via this PR in the README. ## 🔒 Security Implications - [ ] This PR adds a new software dependency or dependencies. - [ ] This PR modifies or invalidates one or more of our security controls. - [ ] This PR stores or transmits data that was not stored or transmitted before. - [ ] This PR requires additional review of its security implications for other reasons. If any security implications apply, add Jason Ashbaugh (GitHub username: StewGoin) as a reviewer and do not merge this PR without his approval. Co-authored-by: Alex Dzeda --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 6fd8805..427e529 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,13 @@ Note that to initialize our docker container, we use migrate-and-start, which co The SSAS can be tested by running `make unit-test`. You can also use the repo-wide command `make test`, which will run tests against the entire repo, including the SSAS code. Some tests are designed to be only run as needed, and are excluded from `make` by a build tag. To include one of these test suites, follow the instructions at the top of the test file. +### **Running Single / Single-file Unit Tests** + +This step assumes that the user has installed VSCode, the Go language extension available [here](https://marketplace.visualstudio.com/items?itemName=golang.Go), and has successfully imported test data to their local database. + +To run tests from within VSCode: +In a FILENAME_test.go file, there will be a green arrow to the left of the method name, and clicking this arrow will run a single test locally. Tests should not be dependent upon other tests, but if a known-good test is failing, the user can run all tests in a given file by going to View -> Command Palette -> Go: Test Package, which will run all tests in a given file. Alternatively, in some instances, the init() method can be commented out to enable testing of single functions. + # Integration Testing To run postman tests locally: