Comments (6)
I'd say that the interface of the "commands" tests could certainly have some improvements.
The there are two core functions that (unluckily) are not public:
Lines 77 to 84 in a9418a5
Lines 41 to 53 in a9418a5
Especially the latter should contain everything to create a regression test from a given sequence of commands.
Would it be helpful to make this a public function?
Or maybe all you need is just to make the "action" struct public.
from gopter.
Thanks for the quick response!
I think the actions
is pretty close to the process I'm trying to hook into. Although, it would probably be best to just expose a simple method like the following:
func Replay(commands.State,
commands.SystemUnderTest,
...commands.Command) *gopter.PropResult {...}
All that's really necessary is a nice wrapper around the lifecycle of how commands are applied. Think of it like this -- I'm looking for something almost identical to a normal Gopter test, but I want to be able to specify precisely the commands that are generated and I only want to run 1 test case.
from gopter.
Sorry, I was really busy last week and overlooked this.
I created a "devel" branch containing a "command.Replay" function that probably fits your needs (https://github.com/leanovate/gopter/blob/devel/commands/replay.go).
If that is working for you I'll merge it to master
from gopter.
I think what you have there is a working solution, and is very close to what I've been doing myself to solve this problem. I'd be much happier to lean on this feature from the library than my own codebase.
One improvement I could see is a tighter coupling to the workflow run by commands.Prop
so that the two cannot diverge in the future. As a consequence of the loose coupling of your current implementation, I don't think shrinking will be applied to regression tests. That's not a major problem, but I'd think it's sub-optimal to not apply shrinking.
I'm also beginning to familiarize myself more with the codebase, and would be happy to start making some contributions of my own on this front soon.
from gopter.
Yes, I see your point.
I did a bit of refactoring. Can you give https://github.com/leanovate/gopter/blob/devel/commands/replay.go
a try.
And yes, for a regression test a shrinker would actually be counter-productive. Its main purpose is trying to find the minimal sequence of commands to fail the system
from gopter.
I merged this version and will close this issue for now.
from gopter.
Related Issues (20)
- cut a new release HOT 1
- How to generate a slice with a range as length? HOT 1
- []Struct with SuchThat clause within a Struct triggers index out of bounds exception on master HOT 2
- properties.Run doesn't stop HOT 7
- Problem Shrinking *time.Time HOT 2
- Not able to generate slice of pointers HOT 1
- GenCommand: Generating Commands Based On The Current State HOT 1
- Is it dangerous to share references between states? HOT 1
- Initial state of slices are not held for reporting HOT 7
- Generating unique values HOT 2
- Cannot reproduce tests with seed when restarting tests HOT 8
- Stateful testing: Clarification around InititalStateGen and PostConditions HOT 4
- gen.StructStrict, which errors if gens contains keys the target struct does not contain? HOT 3
- Tests failing on master branch HOT 7
- Generating values which depend on each other fails HOT 4
- Getting values outside of range when using gen.IntRange (probably during shrink) HOT 7
- Check paniced when using OneGenOf HOT 1
- Support for generics?
- Arbitraries.GenForType does not support arrays HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gopter.