The VansahNode
class provides a .NET interface to interact with the Vansah API, enabling automated testing workflows and integration with Vansah's test management capabilities. This class allows for the creation, updating, and deletion of test runs and logs, including support for uploading screenshots associated with test steps.
- Set custom API URL and tokens for authentication.
- Add, update, and remove test runs and logs.
- Support for JIRA issue and test folder associations.
- Automated screenshot uploads for test logs.
- .NET compatible development environment.
- Newtonsoft.Json package for JSON handling.
- An active Vansah account with API access.
- Ensure the Newtonsoft.Json package is installed in your project.
- Include the
VansahNode.cs
file in your project directory.
Before sending requests to Vansah API, configure the VansahNode
with your API token and URL (if not using the default).
VansahNode vansahNode = new VansahNode();
vansahNode.SetVansahToken = "Your Token Here";
// Optional: Set a custom API URL
vansahNode.SetVansahURL = "https://custom.vansahnode.app";
You can create a test run associated with a JIRA issue or a test folder.
// For a JIRA issue
vansahNode.AddTestRunFromJiraIssue("JIRA_ISSUE_KEY");
// For a test folder
vansahNode.AddTestRunFromTestFolder("TEST_FOLDER_ID");
// Quick Test
vansahNode.AddQuickTestFromJiraIssue(testCaseKey, result);
vansahNode.AddQuickTestFromTestFolder(testCaseKey, result);
Add a test log to a run, optionally including a screenshot.
// Without screenshot
vansahNode.AddTestLog(result, "Comment about the result", testStepRow);
// With screenshot
vansahNode.AddTestLog(result, "Comment about the result", testStepRow, @"path\to\screenshot.png");
You can update or remove test logs and runs using their respective methods.
// Update a test log
vansahNode.UpdateTestLog(result, "Updated comment");
// Remove a test log
vansahNode.RemoveTestLog();
// Remove a test run
vansahNode.RemoveTestRun();