We’re pleased to announce that we’ve uploaded a new version of Conical to Docker for general consumption.
This version contains a few minor fixes and updates
To get started, go to our Docker page and follow the instructions.
We’re pleased to announce that we’ve uploaded a new version of Conical to Docker for general consumption.
This version contains a few minor fixes and updates
To get started, go to our Docker page and follow the instructions.
In conversation with a prospect recently, they mentioned that they had a use-case where they were using XML as their communication mechanism but the comparison of the relevant documents wasn’t a simple case of checking each node-attribute etc.
Instead, there was a well defined way to interpret certain nodes (think that a unit of comparison was defined not just a node, but was addressed by the node and several attributes on that node and the value was from another attribute):
Node 1.
<fxvega ccyPair="GBPUSD" ccy="USD" expiry="23-08-2022" value="234.6" />
Node 2.
<fxvega ccyPair="GBPUSD" ccy="USD" expiry="23-07-2022" value="157.1" />
Additionally:
To that end, the standard XML flattening plugin that we have wasn’t suitable for their use case. Instead, there was a requirement to write a custom plugin to do this data normalisation and then the rest of the comparison stack could be used as per usual.
Using this hybrid approach, we are able to compare their use-case and create output payloads which are suitable for uploading to Conical and which can be easily consumed by humans.
In their specific example, they wanted to be able to see not just the differences between their items, but also all of the surrounding information so they could import their requests into their existing analysis tools. This meant that the example payload contains quite a bit more information than just the differences.
This could be thought of as then making it more complicated to subsequently see just the differences within Conical, however, by taking advantage of Conical’s ability to have XSLT transforms defined on a per product basis, they’re able to supply different XSLTs to allow them to have custom, interactive, views within the tool.
Specifically, they can have multiple XSLTs defined for their product, one of which, outputting HTML, renders a table of differences on a per trade basis with the ability, using embedded javascript, to have an button to show the surrounding information for ease of importing into their tools.
The full code for this use case is available on GitHub. The sample output looks something like:
Matching items - 2 Additional items - 1 Item: - id = Vanilla-Put-EURGBP-6M-ATM Missing items - 0 Differences - 1 Item: - id = Vanilla-Put-EURGBP-1M-ATM Diffs: - risks.fxdelta-EUR: 1342.2 vs. 1342.3 - risks.fxvega-EURGBP-2022-06-19-GBP: 234 vs. 234.2
We’re pleased to announce that we’ve extended the object flattener framework (which feeds into the comparison framework) to handle:
This functionality is available in the BorsukSoftware.ObjectFlattener.SystemData Nuget package and is completely free for all use-cases.
Using this new library, it’s possible to form a flattened representation of the above structures, included nested, so that they can be easily compared.
As usual, if you have any questions, queries or suggestions then please do get in touch and we’ll see what we can do for you.
Happy testing!
We recently had a request from a client as to how they could improve their testing of a web service. Prior to each release, they would run a series of tests against the candidate service which were structured as unit tests for ease of running.
The web service would return a Json document representing a simple unordered array of complex objects (each with their own schema) and the expected behaviour was to check that the values hadn’t changed. The only commonality in schema was a key property which should be used for choosing what to compare against what.
Initially, they were doing this via checking the raw text which was returned. When they were different, they had some interesting times understanding where the differences were.
Within the testing framework, we have a method for comparing sets of objects; and within the object flattening framework, we have support for processing Json objects (note that they were already using Json.net so the example uses the same for consistency in their code base).
These can be combined together to perform their comparisons and to get full visibility of all of the differences between the objects.
The interesting part of the code is the following.
// expected = IEnumerable of expected values
// actual = IEnumerable of actual values
var results = setComparer.CompareObjectSets<Newtonsoft.Json.Linq.JToken>((idx, jobject) =>
{
// We define the keys for comparison as extracting the proeprty on the underlying Json object called 'key'
var keys = new Dictionary<string, object>();
if (jobject is Newtonsoft.Json.Linq.JObject jo)
keys["key"] = jo.Property("key").Value;
return keys;
},
expected,
actual);
The full code can be seen on GitHub here.
Note that in this specific example, the returned Json was a simple array of the objects and therefore the deserialization could be done as a JArray. If the objects to be compared were nested in the schema, then a custom object (using object[] for the objects to be compared) could be used for the deserialization.
This simple snippet allowed them to simplify their investigations in the case of any differences, thus saving them time on each release.
We’re pleased to announce that version 1 of Conical has now been released for general consumption. For instructions on how to get started with the tool, please click here.
Version 1 contains all of the features necessary to be able to use the tool to improve your release processes. We are continuing to work hard to develop the next version with additional features for release management and we hope to release this shortly.
In the meantime, if you have any suggestions or requests on features then please do get in touch with us via email or see the product roadmap page to see what features are currently in the works.
Happy testing!