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 running in Studio
7
8 <h4> SAS Macros </h4>
9 @li mx_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 y2=' two';
48 label x='x factor';
49 output;
50run;
51
52%mx_testservice(&mcTestAppLoc/services/sendObj,
53 inputdatasets=work.somedata1 work.somedata2,
54 debug=log,
55 mdebug=1,
56 outlib=testlib1,
57 outref=test1
58)
59%let test1=FAIL;
60data _null_;
61 set testlib1.somedata1;
62 if x=1 and y=' t"w"o' and z="Z" and y2=' two' then call symputx('test1','PASS');
63 putlog (_all_)(=);
64run;
65
66%let test2=FAIL;
67data _null_;
68 set testlib1.somedata2;
69 if x=1 and y=' t"w"o' and z="Z" and y2=' two' then call symputx('test2','PASS');
70 putlog (_all_)(=);
71run;
72
73
74%mp_assert(
75 iftrue=(&test1=PASS),
76 desc=somedata1 created correctly,
77 outds=work.test_results
78)
79%mp_assert(
80 iftrue=(&test2=PASS),
81 desc=somedata2 created correctly,
82 outds=work.test_results
83)