Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mx_testservice.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mx_testservice.sas macro
4
5 Be sure to run <code>%let mcTestAppLoc=/Public/temp/macrocore;</code> when
6 runnin in Studio
7
8 <h4> SAS Macros </h4>
9 @li mp_createwebservice.sas
10 @li mx_testservice.sas
11 @li mp_assert.sas
12
13**/
14
15filename ft15f001 temp;
16parmcards4;
17 %put Initialising sendObj: ;
18 %put _all_;
19 %webout(FETCH)
20 %webout(OPEN)
21 %macro x();
22 %if %symexist(sasjs_tables) %then %do i=1 %to %sysfunc(countw(&sasjs_tables));
23 %let table=%scan(&sasjs_tables,&i);
24 %webout(OBJ,&table,missing=STRING)
25 %end;
26 %else %do i=1 %to &_webin_file_count;
27 %webout(OBJ,&&_webin_name&i,missing=STRING)
28 %end;
29 %mend x; %x()
30 %webout(CLOSE)
31;;;;
32%mx_createwebservice(path=&mcTestAppLoc/services,name=sendObj)
33
34%mp_assert(
35 iftrue=(&syscc=0),
36 desc=No errors after service creation,
37 outds=work.test_results
38)
39
40/**
41 * Test 1 - send a dataset
42 */
43data work.somedata1 work.somedata2;
44 x=1;
45 y=' t"w"o';
46 z=.z;
47 label x='x factor';
48 output;
49run;
50
51%mx_testservice(&mcTestAppLoc/services/sendObj,
52 inputdatasets=work.somedata1 work.somedata2,
53 debug=log,
54 mdebug=1,
55 outlib=testlib1,
56 outref=test1
57)
58%let test1=FAIL;
59data _null_;
60 set testlib1.somedata1;
61 if x=1 and y=' t"w"o' and z="Z" then call symputx('test1','PASS');
62 putlog (_all_)(=);
63run;
64
65%let test2=FAIL;
66data _null_;
67 set testlib1.somedata2;
68 if x=1 and y=' t"w"o' and z="Z" then call symputx('test2','PASS');
69 putlog (_all_)(=);
70run;
71
72
73%mp_assert(
74 iftrue=(&test1=PASS),
75 desc=somedata1 created correctly,
76 outds=work.test_results
77)
78%mp_assert(
79 iftrue=(&test2=PASS),
80 desc=somedata2 created correctly,
81 outds=work.test_results
82)