Skip to content
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

Test generator, step 1 #638

Merged
merged 29 commits into from
Mar 3, 2024
Merged

Test generator, step 1 #638

merged 29 commits into from
Mar 3, 2024

Conversation

mk-mxp
Copy link
Contributor

@mk-mxp mk-mxp commented Feb 23, 2024

This is the first step towards #631

  • Integrate POC test generator into new directory contribution/generator, so it is not installed in CI
  • Add a parameter to choose the exercise by slug
  • Use local configlet cached problem specification repository as information source
  • Write to already created /exercises/practice/${slug}/{PascalCaseSlug}.php
  • Have test class skeleton
  • Have testdox with description
  • Have UUID in DocBlock
  • Have all tests marked incomplete
  • Adjust track README to show usage

There are still many TODOs marked in the code, especially making things more failsafe. But it can currently be used with most missing practice exercise, as far as have looked into.

@mk-mxp mk-mxp mentioned this pull request Feb 24, 2024
19 tasks
@homersimpsons
Copy link
Contributor

Note that for a CLI Application it is not necessary to boot a full symfony framework: https://symfony.com/doc/current/components/console/single_command_tool.html

php-representer is a single command application: https://github.com/exercism/php-representer/blob/main/main.php and https://github.com/exercism/php-representer/blob/main/src/Application.php

@mk-mxp
Copy link
Contributor Author

mk-mxp commented Feb 25, 2024

Note that for a CLI Application it is not necessary to boot a full symfony framework: https://symfony.com/doc/current/components/console/single_command_tool.html

php-representer is a single command application: https://github.com/exercism/php-representer/blob/main/main.php and https://github.com/exercism/php-representer/blob/main/src/Application.php

Thanks for mentioning that. I am currently not sure if I want to make it a single command app or add some "update" command to ease syncing against problem specs. So I left it as is. I currently focus on functionality, to get experience with the approach.

@mk-mxp mk-mxp requested a review from homersimpsons February 25, 2024 23:12
@mk-mxp mk-mxp self-assigned this Feb 25, 2024
@mk-mxp mk-mxp added x:action/create Work on something from scratch x:knowledge/intermediate Quite a bit of Exercism knowledge required x:module/generator Work on Exercise generators x:type/coding Write code that is not student-facing content (e.g. test-runners, generators, but not exercises) x:size/large Large amount of work x:rep/large Large amount of reputation labels Feb 25, 2024
Copy link
Contributor

@homersimpsons homersimpsons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good start. I do not really know the goal of this Pull Request.

Is it to provide a fully working implementation for some existing exercises ?
Is it to just provide the basis for the generator and iterate on it later ?

contribution/generator/config/routes.yaml Show resolved Hide resolved
contribution/generator/src/TestGenerator.php Show resolved Hide resolved
phpunit.xml Outdated Show resolved Hide resolved
@mk-mxp
Copy link
Contributor Author

mk-mxp commented Feb 26, 2024

I think this is a good start. I do not really know the goal of this Pull Request.

Is it to provide a fully working implementation for some existing exercises ? Is it to just provide the basis for the generator and iterate on it later ?

The goal is to have a next step from POC to MVP. So we can discuss on direction and possible alternatives. And also to have something to experiment with and help with adding further exercises.

mk-mxp added 16 commits March 3, 2024 11:41
No changes, only removed composer.lock
Will use configlet to get path to the canonical data cache.
Generating the exercise with configlet makes sure the cached is filled.
When running configlet with detailed output (-v d) and a command that
requires problem specification data (e.g. info), it prints the location
of the cache as the first line. To avoid an HTTP call, use the offline
mode (-o).

Pipe the output through 'head' to get the first line only, then 'cut'
the 5th field to get the path only.

configlet may fail when there is no cached data (offline mode), which
tells us, that the exercise hasn't been generated before (the cache is
required for that, too).

Assemble the cache directory with the exercise location and if that's
not there, we don't have a usable exercise slug or no access rights.
The test creation will move to its own class. Right now it is not used.
@mk-mxp mk-mxp merged commit 9245951 into exercism:main Mar 3, 2024
9 checks passed
@mk-mxp mk-mxp deleted the test-generator branch March 3, 2024 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:action/create Work on something from scratch x:knowledge/intermediate Quite a bit of Exercism knowledge required x:module/generator Work on Exercise generators x:rep/large Large amount of reputation x:size/large Large amount of work x:type/coding Write code that is not student-facing content (e.g. test-runners, generators, but not exercises)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants