I am currently working on unit testings of a large amount of stored processes (hundreds of...) in SAS 9.3 environment, just wondering if there is any tools or unit testing frameworks out there can help with the test automation. I found SCLUnit in the sasCommunity but it only support up to the 9.1 version.
That's an interesting topic. I'm also interested in the topic of testing STPs.
The downside of STPs is that a STP consists of many different aspects and that makes automated testing difficult.
Which aspects do you want to test?
Can you specify a typical unit test for the testing scenarios you have in mind?
Maybe you can achieve some of these points with PROC STP.
The approach of Andreas achieving some with Proc Stp . SAS(R) 9.3 Stored Processes: Developer's Guide looks good.
The other mentioned options should be elminiated with reasons why. So you could focus on the SP procedures themself
What you need is a testing framework arround this as decribed for the advanced level at moving to expert-one http://istqb.org/
The logic of some testing framework could be the same as I did in the 90's with a Mainframe approach. This approach could be translated to any environment.
The basic are:
- define a standard way of running code. Make it dtap independant and give options for time-travelling
- have this way of running code get automated in approach of "testplans". Take care, to leave scheduling out of that at d,t.
- With all additions like saving/restoring (test-)data input and results and comparisons
- get it connected to your releasemangement so you can do regression tests.
(tester, programmer are able to use the production versions of code and they are having no access to production data. Very confusing (iso27k cobit).
Do not get confused by people mixing up version-management and relese-management as those are having different topics
I have seen Thotwave once being busy with this. Do not know whether you could used that. FUTS - Framework for Unit Testing SAS :: ThotWave
SCLunit is Build on SAS/AF that environment has been killed by SAS in favor of the SP approach.
Futs is build on java. adding another way calling basis SAS programs.
The major issue is getting an SAS environment - installation - that is suited for the more professional approach with this advanced type of testing.
This something often missing at the architectural concepts. As you did not find much about it at SAS it also an indication SAS institute is missing some vision on these normal IT aspects.
It looks like FUTS has not been updated for a long time (and perl does not seem to be a state of the art programming language any more).
More recent is SasUnit (http://sourceforge.net/projects/sasunit/), but support for STPs is not implemented yet (although intended, see SASUnit / Tickets / #45 Allow for testing of Stored Processes ).
This leads back to the question what Eric intends to test about the STPs which is not covered by testing the SAS code?
The STP may consist of a single call of a utility macro. This macro could be unit tested with any mentioned unittesting framework.
Or do you need regression tests to make sure that the tested SAS code inside the STP still works when it is run on the STP Server (different machine, executed as a technical user with different privileges, dependencies on OS capabilities, autocall macros or formats may not be available, ...)?
Thank you for getting back to me.
The final purpose of my unit testing is to make sure all the STPs can be run (with appropriate input options) with out any error despite of whether the results are correct or even if there is a result.
The ideal automation process is to run all the STPs and then capture the error messages if there is any.
Trick part is the input options (the prompts).
There are some PowerShell commands available to connect to a STP server, execute SAS code and check the log.
Prompts just generate and fill macro variables. You can simulate prompt values by setting macro variables at the beginning of your SAS code.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.