createandfake / createandfake Goto Github PK
View Code? Open in Web Editor NEWA C# class library that handles mocking, test data generation, and validation.
License: Mozilla Public License 2.0
A C# class library that handles mocking, test data generation, and validation.
License: Mozilla Public License 2.0
Using value types work with fluent Arg dynamic matching.
Fails to match.
Equality fails due to object wrap.
Build process uses Cake.
Build process uses batch scripting.
Cake is cross-platform.
Randomizer can be provided a specific size for collection creation directly and via attribute.
Add collection hint interface for hitns.
Give option to access global tool Asserter via fluent behavior.
Used through Tools.Asserter.
Add global object extension .Assert.
Give the people what they want.
Mutator can create objects that have no shared values.
Absent.
Break down an object by value and exclude those values from randomization.
Enables tests to know which data set a value comes from.
Review all xml documentation.
Make use of new support.
Documentation should be use focused and have more user focused discussion and answers. For example, like adding a faq with common questions.
Feature and content focused.
Good example would be a faq, while using docfx (see #53: Add DocFX) to handle much of the content automatically.
Should be done after #52: Enable Static Tools Customization, since that'll drastically change how users would want to extend behavior and functionality, making it a good point for better documentation.
Tests use xUnit.
Tests use MSTest.
Integrating the Randomizer with theories shows potential for cleaner tests.
Tester can use the auto passthrough using only declared methods on the top type.
Tester will always call all methods on the type.
Filter the methods.
For testing subclasses that have big base classes where the base behavior doesn't need to be included (or is problematic).
Randomizer can generate guids.
It can't.
Add it to common system types to create.
Guids are frequently used so supporting them is important.
Extensions that allow mocks to be set up like:
doSomething(x, y).Returns(5);
Must go through .Setup methods with Behavior.
Provide Faker.Mimic.
Mimics go to a different meta provider that utilizes a static call log.
Create extensions that add special notes to the call log to change behavior.
Syntactic sugar, and give the people what they want.
Build generates documentation based upon doc comments, and the site documentation site shows them.
Missing.
Use DocFXTasks in Nuke. Integrating DocFX into the src project itself creates a lot of crud in the src.
Better documentation for free, since doc comments are done.
Randomizer can create objects that match conditions.
User manages it.
Use the Limiter with a supplied action.
Makes it easier to create test data to match wanted test conditions.
Classes can be automatically injected by stubs or mocks by the Faker. Given class T, this would return Injected which would contains a populated T, and a method to X get, X being a type that was injected into T.
Missing.
Just reflect on constructor and Fake classes.
Less coupling.
Handles automatic testing for common behavior.
Absent.
Like the Asserter.
First feature is to ensure a method either runs or throws ArgumentNullException instead of NullReferenceException when every parameter is tested with nulls/random values.
Nuke uses latest version with better versioning scheme.
Old version, manual version updates, and package settings in csproj file.
Default Tools can be customized.
User must create their own custom tools.
Implement a ReaderWriterLockSlim around them, and allow hints to be added to the Tools at large through delegates.
This will make the library easier to use and customize, instead of having users create their own Tools file with their customized Tools.
Add special behavior for strings, delegates (throw), fail, and comparables.
Add custom AssertObjects for them.
Better default error messages instead of just using the Is method.
Randomizer only randomizes instance members.
Randomizer will randomize static members.
Fix scope of member reflection methods.
Fakes can be provided to Asserter to give detailed debugging info.
Details only provided for verify methods.
Use ToString(), and enable multiple detail messages for Asserter.
Reduces need to cache result to verify the mocks before the returned result.
Method is void type, and CallData is internal.
Method returns CallData, and CallData is public.
Design was more relevant before fakes could automatically verify all set up behaviors. Can potentially still save some redundancy in some edge cases, but the additional complexity and forgoing encapsulation of the CallData type is likely not worth the trade-off.
Tools should support Tasks.
Tasks throw errors.
Create hints for task support.
Publish workflow automatically pushes nuget package.
See error on action.
Code coverage uses Coverlet.
Code coverage uses OpenCover.
Coverlet is cross-platform while OpenCover is Windows only.
Tool that can handle creating objects automatically with fakes.
Can only randomize objects.
Big picture is for this tool to handle test attributes to compliment randomization.
Randomizer can create objects with a child member that references it.
InfiniteLoopException thrown.
Keep references with the chainer and utilize them when creating children.
Mutator should be able to modify the state of objects.
Mutator can only create variants.
Create variants of writable members and set them.
Hints will likely be used in the future to control this behavior, but shouldn't be used until deciding how to do #1, since it's possible hints might be used for that as well.
Update version and dependencies, look into github builds. Make sure Linux development works.
Versions are up to date and builds on github.
Versions are old and uses AppVeyor/Travis.
Check for most recent versions and build processes.
User can use [Theory, RandomData] without creating the RandomDataAttribute themselves.
They copy the implementation from the tests or docs.
Just add it, and hide the xUnit dependency.
The attribute is only available for xUnit, but the whole framework must work without having an xUnit dependency forced. Hiding the xUnit dependency is actually possible and still have everything compile without it. Only when a user adds the RandomData does an error pop up if the dependency is not present.
Mocks are used when injecting into testers.
When injecting multiple mocks into Tester behavior, the mocks aren't properly used and instead a random instance is.
Hi,
I have a very rich (broad and deep) object model for which I'm trying to generate test data. CreateAndFake is currently showing the best results with the least effort of any comparable library, but I'm running into an "InfiniteLoopException".
Now the error message provides a good explanation as to why I'm encountering the issue and my object model does have recursive types (a->b->c->a). However, as I don't really care about generating objects after the second generation (a->b) I was wondering whether it is possible to limit the depth of generator or simply ignore the "InfiniteLoopException" such that the generator continues to the next property (of whatever object it's generating) as if generation had completed successfully.
Hope thats clear??
I've tried looking into the Limiter implementation but it doesn't seem to be designed to handle this use case.
Anyway, thanks for the library. Really hope this issue can be resolved/worked around as the CreateAndFake looks very promising.
Cheers,
Ian
The Tester tool can use injection to handle creating objects while still running the full featured tests.
Tester just randomizes for creating objects, thus if injection is needed only part of the test behavior can be done by passing in an instance.
Use the Randomizer injector and allow passing in objects for Tester tests.
Fakes can be randomized to create fakes that return random results from all methods.
Behavior is not modified for fakes when randomized.
Create custom hint for Randomizer, as opposed to previous notion to place it on the Faker.
Part of the plan to enable test attributes to handle more mocking setup as well.
Randiffer is called Mutator.
Randiffer is used.
Change naming.
Mutator defines the intended and future behavior better, which is that it will also be able to mutate existing objects.
Uri and DateTimeOffset objects can be randomized and duplicated.
Not supported.
Define behavior under common system hint.
Requested along with #65.
Ability to test different values inside the fluent chain.
valueA.Assert().Is(x).Also(valueB).Is(y);
Asserts display the seed used for randomization, and seeded random is used as default so test runs can be replicated.
Switch to SeededRandom and drill down seed access to assert exceptions.
Performs just as fast and will allow easier reproduce-ability of intermittent failures.
Workflows work with build, tests, and coverage.
Replace Nuke with Bullseye.
Nuke breaks with non-descriptive errors using current directory.props and is more complicated than necessary anyways.
Parameters marked 'out' or 'ref' can be mocked.
They can't.
Likely needs to be bundled into CallData.
CreateAndFake fakes work when using .netcore 3.0.
throws System.BadImageFormatException : Bad IL format.
Add .netcore 3.0 as a build target.
Possibly .netcore 3.0 picks the .netstandard version, under which the emit library doesn't match.
Randomize strings with common names (such as Name, City, or Cell) to look like actual data.
Strings are currently just composed of random characters.
Create a CreateHint that checks property names, and uses prepared lists or rules for them. Probably with an intermediate "ContactInfo" class for holding more consistent data.
Makes random data easier to debug and more in line with how the data might be used.
When using Fluent assertions, can verify fakes are called before checking equality cases.
Extension methods for the assertion classes that verify called behavior and return the chainer.
Verifying the fakes were called first verifies the code behaved as expected. If equality is checked first, the values can be off but the user won't know if the fake behavior was called properly. Verifying behavior first then value prevents this.
Tests run outside VS without issues.
Occasionally, the test host will crash.
Likely issue on finalizer thread with Tester code.
Similar to earlier issue encountered when mocking finalizers and disposable methods.
Ability to call base implementation is possible.
Absent.
Will likely need to be emitted.
Maybe make the default behavior for stubs.
Injection occurs for top level entities when using the Tester tool.
Only child entities use injection behavior.
Tester should have a special test case on just injecting up a class with stubs, then just calling every method and verifying success.
Missing.
Wait for Injected class support, then just reflect down methods passing in random data.
This tests basic layer classes that just forwards calls.
VS 2019 has a code cleanup feature that can be used to format code automatically.
No set standards, individuals can apply how they wish.
Create the .editorguidelines and run it on the code.
Add document for developers detailing how to setup code cleanup to automatically run on save.
Tester tool can prevent parameter mutation side effects.
Absent.
Similar to guarding null references.
Unintended mutation can create nasty defects that are usually hard to find, since modification happening at one point might not be caught until much later. Tracing it back to the method with side effects can be difficult.
Good performance.
Inheritance type check just from the test project's use runs nearly ten million times, and it's recursive check that can happen multiple times for almost every action. It is the time sink.
Cache type inheritance.
A fix here can drastically improve the performance of the library.
CreateFor returns randomized data for a method, and can easily be customized as well as invoked.
Just returns data to pass into the method call.
Wrap the returned data as a dictionary with the parameter name alongside the method.
To help easily test very big methods.
Also add functionality to convert to a list of args for easy verification.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.