I am running some tests from teststand and using the systemlink plugin to post the result to the systemlink database. In addition, we also update test results in our 3rd party requirements database and what I would like to do is get a URL or link to the results that we posted to systemlink. Is there a way to get the URL of the results we just sent from teststand to systemlink?
Solved! Go to Solution.
The URL for the results is pretty simple.
What I'm not sure about is how to get the test result ID from the TestStand execution model for the SL results processing plugin.
The result ID is a bit hidden in TestStand, but you can get to it from your sequence.
In the UUTDone callback, you can access RunState.Root.Locals.ModelPluginConfiguration.Plugins[Index].PluginSpecific.RuntimeVariables.PerSocket[socketIndex].CurrentRunId. To get the plugin index, you can loop through the ModelPluginConfiguration.Plugins to find one with Plugins[i].Base.SequenceFileName == "NI_TestMonitorClient.seq".
I will caveat that this is an internal field that isn't designed to be used by end users. It's possible this could change in a future release, although unlikely.
I was able to get the CurrentRunId, however it does not match the url of the result in system link. Have you used this feature before, or any other ideas on how to get the correct ID from the end of the URL. This is what our URL looks like https://<server>/#testmonitor/testresults/testresult/62ce416341289dd2e616e0d9
I mistakenly posted that you can get it in the UUTDone callback, which is incorrect and you can't even access from the test program. I meant to say PostUUT, which you seem to have figured out.
But I realize this approach will not work if the Store and Forward option is enabled in the Test Monitor result processing configuration. And there isn't a good solution for that case. Store and forward caches the messages to the server in a file and forward them onto the server as its available. It creates a temporary ID for the result to correlate the steps and updates to the result with. And the store and forward process later maps those to the real ID. But that real ID never makes it back to TestStand.
You could disable store and forward, but then your test program will error if it cannot communicate with the server and results will be lost.
The only other option would be to query the server for the result using the TestMonitor API. But you would need to write a custom code module for this since there is not a TestStand step for querying. Here is the documentation on the API if you are not familiar. The other issue is that in the latest version of SystemLink, the forwarding service only runs once a minute. So if you have a sequence that is faster than that, it could be stuck waiting for the result to be forwarded to the server.