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