Closed Bajger closed 1 year ago
More commits to follow - especially unit tests and CLI handler.
@glennj Would be happy, if you can take a look at these changes and provide review. This should be test runner implementation (without docker part). Key Classes (and interface methods) are:
ClapExercismTestRunner class>>testRunnerCommand
specification of command line and arguments. These can be invoked from host OS (see class comment)
ClapExercismTestRunner>>execute
execution of command line command.
ExercismTestRunner>>runTestsOnExercise: slugName importSourceFrom: inputDirectory result: outputDirectory
this imports source code (from *.st files) to Pharo image, run test cases for given exercise, specified by slug name.
All functionality is unit tested. All and new tests are passing, so it should be safe to integrate. Thanks for the review!
fixes #453
Example of using CLI looks like this (tested on my Mac):
dbajger@Davids-MacBook-Pro P10-exercism-bajger % ../../vms/100-x64/Pharo.app/Contents/MacOS/Pharo --headless P10-exercism-bajger.image clap testExercise two-fer /tmp/two-fer/ /tmp/
Loading sources for exercise: 'two-fer' from input directory: '/tmp/two-fer/', result to output directory: '/tmp/'.
3 ran, 3 passed, 0 skipped, 0 expected failures, 0 failures, 0 errors, 0 passed unexpected
dbajger@Davids-MacBook-Pro P10-exercism-bajger %
In output directory results.json
can be found:
{
"version" : "v2",
"status" : "pass",
"message" : "3 ran, 3 passed.",
"tests" : [
{
"name" : "A name given",
"status" : "pass",
"test_code" : "testANameGiven\n\tself assert: (twoFer who: 'Alice') equals: 'One for Alice, one for me.'"
},
{
"name" : "Another name given",
"status" : "pass",
"test_code" : "testAnotherNameGiven\n\tself assert: (twoFer who: 'Bob') equals: 'One for Bob, one for me.' "
},
{
"name" : "No name given",
"status" : "pass",
"test_code" : "testNoNameGiven\n\tself assert: twoFer who equals: 'One for you, one for me.' \n\t"
}
]
}
@Bajger Sorry I've been quite busy lately. I'll find some time to look through this in the coming week.
@glennj Hi Glenn, you don't need to rush. I need to add additional so called "golden" tests (as mentioned here). I would probably need to push more changes into this branch. Probably I'll move test runner related things to separate Pharo package that could be easier resolved in Baseline of Pharo project (e.g. to use it as separate group and not relying on 'mentor' group).
@glennj It seems that CI is working with deployed Docker image and running example (golden) tests (Details here: https://github.com/exercism/pharo-smalltalk-test-runner/pull/16)
So it should be accomplished now!
Note that ExercismTestRunner, ExercismTestRunnerTests are 2 new packages I used for functionality within Pharo image. I additionaly changed baseline definition of Pharo project with 2 new groups (testRunner
and testRunnerTests
) that are used during docker build commands:
@Bajger Sorry I've been quite busy lately. I'll find some time to look through this in the coming week.
@glennj Hi Glen! Would you have time to look at PR? Just to briefly look, in order to have review from you as one who can read Pharo code.
I'm not entirely sure what this PR does, but 🤷
@ErikSchierboom Thanks Erik! I wanted to take a look from Glen, but he seems to be busy with other stuff. Changes should be non-destructive - it is unit tested. Core functionality is in this class (just for curiosity) here: https://github.com/exercism/pharo-smalltalk/pull/563/files#diff-916a1ed56361642604e90308f5da45f692efa3b24d239f92a52e5868419ea5c9
Added base implementation of test runner functionality according to specification of Test runner interface.