1 = Testing = 2 3 Before attempting to integrate imip-agent with other system components, 4 it can be useful to check whether the different programs function as 5 expected by themselves. Should errors or faults occur, these would need 6 to be remedied first before attempting to get the software working with 7 the [[../MailIntegration|mail]] and [[../WebServerIntegration|Web]] 8 system components. 9 10 <<TableOfContents(2,2)>> 11 12 == How the Software Works == 13 14 To see how the software operates, you can run one of the agent programs 15 provided in the distribution. For example: 16 17 {{{ 18 ./imip_resource.py -S xxx/store -P xxx/static -p xxx/prefs -d \ 19 < tests/templates/event-request.txt 20 }}} 21 22 This uses one of the test files, sending it to the agent program for 23 resource entities, producing output resembling the following: 24 25 {{{ 26 Outgoing parts for paul.boddie@example.com... 27 From nobody Wed Oct 28 00:24:41 2015 28 MIME-Version: 1.0 29 Content-Transfer-Encoding: base64 30 Content-Type: text/calendar; charset="utf-8"; method="REPLY" 31 From: calendar@example.com 32 To: paul.boddie@example.com 33 Subject: Calendar system message 34 35 QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVQTFkNClZFUlNJT046Mi4wDQpCRUdJTjpWRlJFRUJV 36 U1kNCk9SR0FOSVpFUjptYWlsdG86cGF1bC5ib2RkaWVAZXhhbXBsZS5jb20NCkFUVEVOREVFO1NF 37 TlQtQlk9Im1haWx0bzpjYWxlbmRhckBleGFtcGxlLmNvbSI6bWFpbHRvOnJlc291cmNlLXJvb20t 38 Y29uZnJvb20NCiBAZXhhbXBsZS5jb20NClVJRDpmYjFAZXhhbXBsZS5jb20NCkVORDpWRlJFRUJV 39 U1kNCkVORDpWQ0FMRU5EQVINCg== 40 }}} 41 42 The rather opaque encoding can be inspected using the `tools/showmail.py` 43 program, and thus the result of the script can be seen by piping the output 44 through that program as follows: 45 46 {{{ 47 ./imip_resource.py -S xxx/store/ -P xxx/static/ -p xxx/prefs/ -d \ 48 < tests/templates/event-request.txt \ 49 | tools/showmail.py 50 }}} 51 52 The result should resemble the following: 53 54 {{{ 55 Outgoing parts for paul.boddie@example.com... 56 MIME-Version: 1.0 57 Content-Type: text/calendar; charset="utf-8"; method="REPLY" 58 From: calendar@example.com 59 To: paul.boddie@example.com 60 Subject: Calendar system message 61 62 BEGIN:VCALENDAR 63 METHOD:REPLY 64 VERSION:2.0 65 BEGIN:VEVENT 66 DTSTAMP:20151027T232738Z 67 UID:event1@example.com 68 ATTENDEE;PARTSTAT=ACCEPTED;SENT-BY="mailto:calendar@example.com":mailto:reso 69 urce-room-confroom@example.com 70 SUMMARY:Meeting at 4pm 71 ORGANIZER:mailto:paul.boddie@example.com 72 DTSTART;TZID=Europe/Oslo:20141126T160000 73 DTEND;TZID=Europe/Oslo:20141126T170000 74 END:VEVENT 75 END:VCALENDAR 76 }}} 77 78 What has happened here is the presentation of a request to the resource 79 program in the form of an e-mail message containing an iCalendar event 80 employing a scheduling method. The program interprets the request, 81 consults its own records, makes a decision about scheduling the event, 82 and indicates the kind of response it would like to send back to the 83 requester. 84 85 == The Test Suite == 86 87 A script called `test_all.sh` is provided that runs a test suite (found 88 in the `tests` directory within the source code distribution), initialising 89 new and separate data store instances for each test, running programs that 90 are presented with message content, and testing for the desired effects of 91 running those programs with such content. 92 93 {{{ 94 ./test_all.sh 95 }}} 96 97 To run all tests against a different data store, such as a 98 [[../DatabaseStore|database store]] instead of the [[../FileStore|file store]], 99 the `STORE_TYPE` environment variable can be specified as in the following 100 example: 101 102 {{{ 103 STORE_TYPE=postgresql ./test_all.sh 104 }}} 105 106 Individual tests may also be run directly from the topmost level of the 107 source code distribution. For example: 108 109 {{{ 110 tests/test_resource_invitation.sh 111 }}} 112 113 Should everything be functioning correctly, `Success` should be reported 114 repeatedly as opposed to `Failed`. If the latter occurs, the output of the 115 tests should be inspected: a number of files whose names end with `.tmp` 116 will have been saved in the current directory, and these will contain the 117 output from various commands from the last test script invocation; the 118 `err.tmp` will contain tracebacks indicating serious error conditions, 119 should any have occurred. 120 121 == Testing in the Deployment Environment == 122 123 Although the above testing may indicate that the software is functional, 124 it does not demonstrate that the software has been successfully integrated 125 into the deployment environment. One elementary test involves sending mail 126 to an address that should be configured to handle incoming calendar messages. 127 128 A basic script is provided that replicates a subset of the functionality in 129 the traditional `mail` command for sending messages. It is invoked by 130 specifying the sender and recipients of a message and by passing the message 131 itself to the script's standard input. For example: 132 133 {{{ 134 tools/sendmail.py paul.boddie@example.com resource-room-confroom@example.com \ 135 < tests/templates/event-request.txt 136 }}} 137 138 Here, the sender (`paul.boddie@example.com`) and recipient 139 (`resource-room-confroom@example.com`) must match the identities specified 140 within the supplied file (`tests/templates/event-request.txt`), and for a 141 specific deployment environment these identities will need to be changed. 142 The following lines from the supplied file would be involved: 143 144 {{{ 145 From: paul.boddie@example.com 146 To: resource-room-confroom@example.com 147 ORGANIZER:mailto:paul.boddie@example.com 148 ATTENDEE;ROLE=CHAIR:mailto:paul.boddie@example.com 149 ATTENDEE;RSVP=TRUE:mailto:resource-room-confroom@example.com 150 }}} 151 152 It makes most sense to choose a recipient acting as a resource so that an 153 automated response may be generated with the sender receiving this response. 154 However, other kinds of recipients may also be tested in this way. 155 156 The result of this invocation will become known via the following sources of 157 information: 158 159 * The sender's mailbox (if the recipient sends an automated response) 160 * The sender's data store 161 * The recipient's mailbox (if the recipient is configured to store mail) 162 * The recipient's data store 163 * Mail system logs (particularly in case of errors) 164 165 See the [[../MailIntegration|mail integration guide]] for more information 166 about configuring and troubleshooting mail systems.