Open tweidema opened 5 days ago
Thanks for the suggestions! We do have feature requests to implement skipping certain steps (see https://github.com/riok/Kreya/issues/184), which I think belongs into roughly the same feature.
We are currently thinking about how to implement this in the best way
Yes, the skipping could be thought of as if/else construct, which would also be nice to have. I realize these things are not simple to implement, but they would make Kreya an extremely powerful tool. Hope you figure out a way to do it :-)
One way we currently have in mind is to have a place to script "everything", for example (pseudocode):
for (let i = 0; i < 3; i++) {
await kreya.invokeOperation("my-operation.krop");
}
const response = await kreya.invokeOperation("grpc.krop");
if (response.ok) {
// more code here
}
Would you be happy with something like this or would you rather have something with a little more "UI" (think Loop / Conditional blocks inside Collections)
It would be (much) better than nothing and the ultimate in flexibility of course. But that is me, speaking as a developer. Most of the tests will be written by testers, who are not developers themselves, and I think for them the GUI would be nicer. One thing that is important to me is that the loop variable is accessible in the script. With your example I suppose that could be done with something like
for (let i = 0; i < 3; i++) {
kreya.variables.set("scripti", i);
await kreya.invokeOperation("my-operation.krop");
}
Then the loop-variable would be accessible from the script with kreya.variables.get("scripti") I assume?
Is your feature request related to a problem? Please describe. My current use-case is testing a gRPC update method supporting fieldMasks. The backend is backed by a database, and there is some transformation of data, so from the client (Kreya in this case) I want to test updating every possible field on the entity by itself (via gRPC fieldMask) and then fetching the entity and checking that only the field specified by the fieldMask is updated. I have written a support-script to make this easier, but I still need to copy/paste Kreya operations and change the field N times (for number of fields selectable by the fieldMask). Another usecase would be load-testing and concurrency-testing.
Describe the solution you'd like What I would like is a speciel "loop" operation usable in collections. This should allow loops with a specified kreya.variable. So in that operation you specify what should be looped over (a string array og integers 1->10 for instance) and which kreya-variable you would like to assign the loop variable to (for instance kreya.variables.myloop). It should be visible when viewing the collection which operations are part of the loop, for instance by indenting them to the right, and you should be able to drag operation into the loop by dropping them on the loop operation itself. I hope what I mean is clear :-)
Describe alternatives you've considered Copy/pasting operations and changing fields manually.