Fix removeTestLog and step-log lifecycle; add test plan iteration; align README with v2 API#29
Open
ShubhamMour wants to merge 5 commits into
Open
Fix removeTestLog and step-log lifecycle; add test plan iteration; align README with v2 API#29ShubhamMour wants to merge 5 commits into
ShubhamMour wants to merge 5 commits into
Conversation
- removeTestLog() now calls /api/v2/logs/{id} instead of /api/v2/run/{id};
it was deleting via the run endpoint with a log identifier, which failed
with "Test Run not found". Verified against the live v2 API.
- Add optional request-payload logging gated by VANSAH_DEBUG env var (or
setDebug(true)) to aid diagnosing integration issues; attachments are
logged after the payload so base64 does not flood the output.
- Warning messages for an invalid/empty project key now say "Space Key"
to match Vansah's terminology.
- Fix non-existent setter: setTESTFOLDER_PATH -> setFOLDERPATH (the documented example did not compile). - Fix swapped ATP/STP keys in the setter example (ATP KAN-P17, STP KAN-P18). - Document setProjectKey (Space Key), required for API v2 scoping. - Document setDebug / VANSAH_DEBUG payload logging. - Use "Space Key" terminology to match the binding and Vansah UI. - Correct addTestLog result values (NA/FAILED/PASSED/UNTESTED, not N/A) and clarify quick-test result is an int (0-3). - Tag the dependencies snippet as xml, and reformat the API-token notice.
- All four addTestRun* methods (JIRA issue, test folder, ATP, STP) now send
result id 3 (UNTESTED) on creation, so Vansah pre-creates one test log per
step of the test case.
- Capture the per-step logs from the add-test-run response (data.run.logs) into
a step-number -> log-identifier map (storeStepLogs).
- addTestLog now updates the pre-created step log via PUT /logs/{id} instead of
posting a new one, which avoids the "A Test Log already exists for provided
Step" error. Falls back to creating a log when no pre-created log exists for
the step (e.g. a case with no steps), preserving prior behaviour.
Verified against the live Vansah v2 API; existing test suite passes (18/18).
After removeTestLog deletes a step's log, recreate an empty UNTESTED log for that step and refresh the step -> log map, so a later addTestLog updates the correct log and the map never holds a stale (deleted) identifier. - Add stepForLog(id): reverse lookup of the step for a given log identifier. - Add recreateUntestedStepLog(step): posts a fresh UNTESTED log for the step and stores its new identifier. - Keep the step -> log map in sync after every addTestLog (update and fallback-create paths). Verified against the live Vansah v2 API; existing test suite passes (18/18).
Add setTestPlanIteration(int) so Standard/Advanced Test Plan runs can target an iteration other than the hardcoded 1. Runs default to iteration 1 when the setter is not called, so existing callers are unaffected. Valid range is 1-5; out-of-range values are ignored with a warning. Document the setter and its default in the README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This update fixes a broken "remove test log" action and changes how test results are recorded so that deleting or updating a step no longer causes errors. It also lets you target a specific test plan iteration. The README has also been cleaned up so the examples actually work and match how Vansah works today. Everything was checked against the live Vansah environment.
What changed
Removing a test log now works
Previously, trying to remove a test log failed with a "Test Run not found" error because it was pointing at the wrong place. This has been corrected so removal works reliably.
Recording results no longer causes duplicate errors
Adding a result now updates the step's existing log instead of creating a new one, which avoids the "A Test Log already exists for this Step" error. If a test case has no steps, it still creates a log as before.
Steps stay clean after a log is removed
When you remove a step's log, a fresh empty one is put back in its place, so adding a new result later goes to the right spot.
Choose which test plan iteration to record against
Standard and Advanced Test Plan runs now let you pick an iteration. If you do nothing, runs go to iteration 1 exactly as before — so existing setups are unaffected. To target a different iteration, call
setTestPlanIteration(n)(wherenis 1–5) before creating the run. Values outside 1–5 are ignored with a warning.Optional debug logging
You can now turn on request logging (via a
VANSAH_DEBUGsetting) to help troubleshoot issues. Attachments are logged separately so they don't clutter the output.Clearer "Space Key" wording
Warning messages now say "Space Key" to match the wording used in Vansah.
README improvements