The test tool requires the ability to upload and compare a WITSML object for dataset-based tests (tests 26-54).
The tool or a new method should be created to handle:
1) Adding a new object from a predefined dataset into a server (handling size issues)
2) Comparing the newly added object with the original data source (GetFromStore) comparing based on criteria in spreadsheet.
I have implemented comparison tool for Log objects. I did not directly integrated into certification suite, but i wrote it as separate module (modules) i prefix this utility with name "wtools_*" (WITSML tools). I though that it will be good idea, to keep this kind of specialized tools separated from certification tool itself, as distinguishing between certification framework, and tools library, but it is up to team decide how to organize code.
The way it works it implement following operations for log objects :
-LoadObjectFromDisk
-UploadObjectToStore
-LoadObjectFromStore
-SaveObjectToDisk
-isEncapsulates
So normaly to check is server does persist object correctly:
User direcly in cerfication script run
objLogDisk = LoadObjectFromDisk(...)
objLogDisk.UploadObjectToStore(...)
objLogStore = LoadObjectFromStore(...);
if objLogStore.isEncapsulates( objLogDisk ):
#good - all good object persisted correctly
else:
#bad - did not worked (see console output)
How does comparison works ? :
The way comparison is implemented, is straight forward, appliucation, 'normalizes' XML means it put curves in same order, removes nodes that does not act in comparison like 'uid', uses same "NULL" value for curves, normalizes timestamps (serialize back and forth to loose timezone), and rounds double values to 3 decimal places in order to get away with string comparison, on number. After all of it done comparison is basically ends up in checking that each node from original object exists in nodes in object that we got from store (it might have more nodes like you might did not specify min/max index for each curves, but store will return it, this is not a problem), as long as all neccessary curves are in returned object, as long as all text matches, and each attribute is in place for each node, we say XML encapsulate original XML, means success, if not then not success, and error, along with line number will be printed.
I think the best way code will describe how it works.
this is example how to use it from testcase :
import wtools_witsml_api
import wtools_schemas_witsml1410
import wtools_witsml1410_log
....
Please give it a try and let me know how does it works for ya'll
Im sure that there is places for improvement, and it need to be more documented, and better testcased.
Wtools is now moved to package WITSMLTools example how to use can be found under example folder inside archive.
repackaged again to put in same manner as we have SchemaValidation.
initial implementation of dataset comparison based on schema
Re-uploaded ZIP file
Re archived reuploaded zip file