[MT10401] An error occurs while trying the checkin SIP test, 08checkin.t: 08checkin.t ........... 4/5 # Failed test 'match leader Checkin: Item not checked out' # at /home/asaurat/workspace/versions/community/C4/SIP/t/SIPtest.pm line 204. # Response '100YNY20130319 142702AOVIL|AB1783B|AQVIL|AJL ANGOISSE DU ROI SALOMON|CS362.6 AJA|AFItem not checked out|AY5AZE097' doesn't match pattern '(?-xism:^100YNN\d{8} {4}\d{6})' We are trying to do a checkin operation on a document which is not checked out. Koha sends a code 100, meaning "Checkin failed". As expected. The three following characters are: - resensitize - magnetic media - alert And we have a difference on the "alert" character. Koha sends Y, and the test expects N. Description of the "alert" field in the SIP2 documentation from 3M: 1-char, fixed-length field: Y or N. A Y in the alert field will generate an audible sound at the SC. The alert will indicate conditions like articles on hold, articles belonging to another library branch, or other alert conditions as determined by the ACS. The alert signal will alert the library staff to special article handling conditions during discharging operations. As we are testing a case where a problem is occuring (how could a patron check in if the item was not checked out?!), I actually think that the "alert" should be expected by the test, leading to a pattern like "^100YNY". But maybe is this "alert" actually outside of the scope of this test, the important result being that the string begins with "100". Thus the checking pattern could be "^100YN[NY]". I'll make a patch with the latest solution, but it's of course open to discussion, as I'm not 100% sure about how this test is supposed to react.
Created attachment 16397 [details] [review] proposed patch #1 TEST PLAN : 1) In "C4/SIP/t", configure the SIPtest.pm file. 2) Configure your SIPconfig.xml if needed. 3) Start your SIP server. 4) In "C4/SIP/t", do a global "make test" or just launch the checkin test (see the README file for more informations) After the patch, the checkin test should run without error.
I'm getting the same results pre and post patch. $ perl -I.. 08checkin.t 1..5 ok 1 - login ok 2 - SC status not ok 3 - match leader Checkin: prep: check out item (502326000005) # Failed test 'match leader Checkin: prep: check out item (502326000005)' # at SIPtest.pm line 204. # Response '120NUN20130320 065359AOCPL|AA23529001000463|AB502326000005|AJ|AH|AFInvalid Item|BLY|AY3AZE7E3' doesn't match pattern '(?-xism:^121NNY\d{8} {4}\d{6})' not ok 4 - match leader Checkin: Item (502326000005) is checked out # Failed test 'match leader Checkin: Item (502326000005) is checked out' # at SIPtest.pm line 204. # Response '100NUY20130320 065359AOCPL|AB502326000005|CV99|AFItem not checked out|AY4AZEA99' doesn't match pattern '(?-xism:^101YNN\d{8} {4}\d{6})' not ok 5 - match leader Checkin: Item not checked out # Failed test 'match leader Checkin: Item not checked out' # at SIPtest.pm line 204. # Response '100NUY20130320 065359AOCPL|AB502326000005|CV99|AFItem not checked out|AY5AZEA98' doesn't match pattern '(?-xism:^100YN[NY]\d{8} {4}\d{6})' # Looks like you failed 3 tests of 5. Any idea as to what I'm doing wrong?
Well, my patch is actually design to correct the test named 'match leader Checkin: Item not checked out', but your run seems to crash before that, on the test named 'match leader Checkin: prep: check out item'. You have a response beginning with "120NUN" and the test expects "121NNY". Two differences then, the main one being 120 instead of 121 (the checkin failed, and the AF field contains this message : Invalid Item. Looks like your barcode is wrong or something like that ?! Other difference, U instead of N for the "magnetic media" field. I never encountered this U, and the unit test does not expect this, I don't know yet why you're getting this response. From the 3M doc, about the "magnetic media" field: 1-char, fixed-length field: Y or N or U. A 'Y' in this field indicates that this article is magnetic media and the SC will then handle the security discharge accordingly. A 'N' in this field indicates that the article is not magnetic media. A 'U' indicates that the ACS does not identify magnetic media articles. ACS vendors are encouraged to store and provide article magnetic media identification. The following test which fails on your side is the direct consequence of the first fail. It's a checkout which can only success if the former checkin attempt succeeded. On the last failing test, we are working on the test modified by my patch. Here, you get : 100NUY The test awaits: 100YN[NY] Two fields make the test field: - resensitize is on N for you (but should this make the test fail? after all, you can configure this in SIPconfig.xml for a reason) - magnetic media, again you have U and I don't know why!! we should check the code for that.
The differences seem to come from different values we have in ILS.pm (with the default file "magnetic media" => 1 but maybe you modified this?) But anyway, it's in fact out of scope when it comes to testing a checkin. A library could use magnetic media or not, choose to desensitize or not, what we are testing here is the ability to checkin, and that is proved by the third character, 0 or 1. I'll thus make a patch allowing different configurations about magnetic madia.
Created attachment 16601 [details] [review] proposed patch #2 New version of the patch. Will correct the tests being too restrictive about magnetic medias. But if you use the same barcode as before, you'll still get errors, it seemed to be an invalid item.
Created attachment 19269 [details] [review] Bug 9845: SIP tests : fixes in 08checkin.t The tests were too restrictive. It should be possible to pass a checkin/checkout test with different values defined for magnetic medias. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 19352 [details] [review] Bug 9845: SIP tests : fixes in 08checkin.t The tests were too restrictive. It should be possible to pass a checkin/checkout test with different values defined for magnetic medias. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Passes koha-qa.pl, works as advertised.
Pushed to master. Thanks, Adrien!