Your SAS programs, embedded in web apps and elsewhere

Stored Processes unit test in 9.3

Reply
Contributor
Posts: 25

Stored Processes unit test in 9.3

Hi All,

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.

Any thoughts?

Thanks,

Eric

Frequent Contributor
Posts: 119

Re: Stored Processes unit test in 9.3

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?

  • Prompts
  • Execution of SAS code (including dependencies to autocall macros, formats, datasets, ...)
  • ODS Results/ Reports
  • Does the STP run on the STP Server or on a Workspace Server?
  • Is the result of the type stream, package or both?
  • Is the STP executed on the "Stored Process Web Application"

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.

Valued Guide
Posts: 3,208

Re: Stored Processes unit test in 9.3

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. 

---->-- ja karman --<-----
Frequent Contributor
Posts: 119

Re: Stored Processes unit test in 9.3

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, ...)?

Contributor
Posts: 25

Re: Stored Processes unit test in 9.3

Hi Andreas,

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).

Eric

Frequent Contributor
Posts: 119

Re: Stored Processes unit test in 9.3

Hi Eric,

you might want to take a look at my project at https://sourceforge.net/p/cmdlets4sas/wiki/Home/https://sourceforge.net/projects/cmdlets4sas/

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.

Ask a Question
Discussion stats
  • 5 replies
  • 855 views
  • 0 likes
  • 3 in conversation