You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to get a handle on how WithLabel could help decoding inputs in the event of test failure. For the simple example shown on https://godoc.org/github.com/leanovate/gopter with two simple inputs, it seems fine. But here is what I have after I have put WithLabel on most everything in my test generators:
First, it seems to have shown the labels only for the topmost items.
Second, it put all the labels first, not intermixed with their values.
Here is how those labels match the inputs:
Just to give some feel for how my generators are organized, here it is in pseudo-code:
createProjectAndRuleGen =>
CombineGens(projectReqGen, gen.SliceOf(ruleReqGen)
projectReqGen => (id, name)
ruleReqGen => CombineGens(gen.Bool(), ruleReqGenEvent, ruleReqGenNode)
ruleReqGenEvent => (id, name, conditions1, and some other properties...)
ruleReqGenNode => (id, name, conditions2, and some other properties...)
conditions1 => gen.SliceOf(conditionsGenEvent)
conditions2 => gen.SliceOf(conditionsGenNode)
conditionsGenEvent => (type, value)
conditionsGenNode => (type, value)
Looking for tips on how to make the input blob be less indecipherable.
The text was updated successfully, but these errors were encountered:
msorens
changed the title
Decoding complex inputs
Decoding complex inputs upon test failure
Jun 30, 2019
The "problem" here is the CombineGens. Unluckily go does not have something like tuples, therefor CombineGens is a somewhat feeble attempt to emulate those.
Simply put: When you have a generator with label "Im A" and a generator with label "Im B" then CombineGens will create a generate with label "Im A, Im B", which leads to the output shown.
To mitigate this the best idea I can up with is probable to write a specific parameter struct for you testcase (containing the three values "Project_Name", "Project_Id" and "Rules") an combine the generators with gen.Struct or gen.StructPtr. IThe you can implement a String() method for that parameter struct to beautify the output in case of an error.
Trying to get a handle on how
WithLabel
could help decoding inputs in the event of test failure. For the simple example shown on https://godoc.org/github.com/leanovate/gopter with two simple inputs, it seems fine. But here is what I have after I have putWithLabel
on most everything in my test generators:First, it seems to have shown the labels only for the topmost items.
Second, it put all the labels first, not intermixed with their values.
Here is how those labels match the inputs:
Just to give some feel for how my generators are organized, here it is in pseudo-code:
Looking for tips on how to make the input blob be less indecipherable.
The text was updated successfully, but these errors were encountered: