Skip to content

Create test generators framework #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ErikSchierboom opened this issue Mar 10, 2017 · 5 comments
Closed

Create test generators framework #224

ErikSchierboom opened this issue Mar 10, 2017 · 5 comments
Assignees

Comments

@ErikSchierboom
Copy link
Member

Most exercises have a set of canonical data associated with them. This data can change from time to time, so the burden is on us to keep track of it. Wouldn't it be great if we could write a generator to generate the tests automatically based on the canonical data (which is described as JSON document)?

There is also an ongoing effort to update the canonical data to a fixed standard. This should make it possible to write something like a base test generator.

@robkeim
Copy link
Contributor

robkeim commented Mar 11, 2017

That would definitely be great @ErikSchierboom, do you have an idea on how you're going to tackle this?

@ErikSchierboom
Copy link
Member Author

I do. There will be a generic parser to parse the canonical data JSON files. Then there will be a generic test file generator, which can setup the structure and such to render the tests. Finally, each exercise will have its own test generator class deriving from the base one. At least, that's how I plan to structure it. The generators themselves will just be part of one .NET Core Console Application.

You can follow my progress here. I aim to use RazorLight to render the test file templates, which will allow using Razor-like syntax in the templates. To verify the correctness, I aim to use the C# Scripting library, which uses Roslyn to parse and verify C# source code.

It is an ambitious project, but part of the reason why I want to do this, is to have to do #195 only once.

@robkeim
Copy link
Contributor

robkeim commented Mar 12, 2017

That sounds like a good approach @ErikSchierboom! The reason that I haven't jumped on #195 is because there's currently no way to get updates when things fall out of date again. If you do this work then it should be trivial to update all of the cases whenever any of them change :)

@ErikSchierboom
Copy link
Member Author

@robkeim Precisely!

@ErikSchierboom
Copy link
Member Author

@robkeim I've just submitted PR #228, which adds the basic infrastructure for the test generators. In PR #229 (which is on hold until #228 is merged), you can see what an actual test generator would look like. If you think it looks okay, feel free to merge both PR's :)

@ErikSchierboom ErikSchierboom changed the title Investigate possibility of creating test generators Creating test generators framework Mar 14, 2017
@ErikSchierboom ErikSchierboom changed the title Creating test generators framework Create test generators framework Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants