vscode-objectscript
vscode-objectscript copied to clipboard
Support userparams argument of RunTest() and DebugRunTestCase() (from %UnitTest.Manager) when invoking tests from VS Code
RunTest(), DebugRunTestCase(), and some other methods of %UnitTest.Manager support a ByRef userparams array argument. It allows you to pass custom arguments into the testing methods (including OnBefore* and OnAfter* methods). Obscure but useful feature I think.
For example, If you set the array fred("logging") = 1, and fred("check") = "abcd1234" and pass .fred into RunTest(), then your testing methods can access those values using ..Manager.UserFields.GetAt("logging") and GetAt("check").
Do you think it's possible for an invocation of a test to 1) prompt for these name/value pairs, 2) stuff them into an array, and 3) pass that array by reference into the methods that are called when the tests are invoked from VS Code?
This would require a server-side change. The VS Code API doesn't have a great way to prompt for a list of key/value pairs, and I wouldn't want to prompt the user for these rarely used parameters every time they want to run a test. I suppose they could be put in a VS Code setting, but users would then need to change that setting often. I'll leave this open for a while to get user feedback but I'm thinking that the best action to take will be documenting this as a limitation and moving on.
@isc-solon consider promoting this idea here: https://community.intersystems.com/post/3rd-intersystems-ideas-contest
There's not enough interest to warrant spending time on this