go icon indicating copy to clipboard operation
go copied to clipboard

Move cases_test.go content into <exercise>_test.go

Open bitfield opened this issue 4 years ago • 7 comments

Mentors can't see test cases. I assume the student can see the test cases, as it would make life rather difficult for them if they couldn't, but I can't!

For example, I have a student asking:

My solution fails on the second test case, but I have no idea why.

Neither do I, as there's no way of seeing what the cases are. It's usual in Go to define your cases either in the test function itself, or at least in the same source file. Maybe we could do the same?

bitfield avatar Oct 17 '21 17:10 bitfield

What is the exercise for which you can't see the test cases?

andrerfcsantos avatar Oct 17 '21 17:10 andrerfcsantos

@bitfield Moving all the test cases into the usual <exercise>_test.go file was exactly our plan (as discussed here on Slack).

Nevertheless it might be worth opening an issue in exercism/exercism if its really the case that additional editor files don't show up for the mentor. As @andrerfcsantos said, if you give us an example, we can check it was at least configured correctly on our side.

junedev avatar Oct 17 '21 18:10 junedev

@andrerfcsantos Let's use this issue to track the task of getting rid of the cases_test.go files (I adjusted the issue title accordingly). Originally I thought this is a super easy copy&paste task but now I realized that the go track uses test case generators and those generate the cases_test.go files. That means if we want to move the cases, we need to adjust the generator(s). Do you still think we should go ahead with the plan?

junedev avatar Oct 18 '21 19:10 junedev

@junedev I think we should. But what do you think it'd be easier for now, adjusting the generators or making the test runner look for the tests in a cases_test.go?

andrerfcsantos avatar Oct 19 '21 09:10 andrerfcsantos

Adjusting the test runner is probably easier (especially because it only needs to be done once for everything), however that does not solve the issue that bitfield mentioned that it is rather unusual to have separate cases files in Go.

~~I would say we adjust 1-3 generators and then decide how to proceed depending on how difficult that was.~~ Changed my mind, let's get good output with the separate cases file first and then we can discuss other steps.

junedev avatar Oct 19 '21 10:10 junedev

@andrerfcsantos I believe it was "Word Search". The student was having a problem because reflect.DeepEqual wasn't comparing their result equal, even though it was absolutely correct. It turned out that the problem was the exact type definition that the test was expecting—which we couldn't see.

bitfield avatar Oct 20 '21 15:10 bitfield

Recently I saw what @bitfield is saying in another exercise - the exercise had cases_test.go well configured on our side, but I was unable to see it in the mentoring session.

My suspicion is that students where this is happening started the exercise before our changes to files.editor key, and apparently a change to files.editor requires students who already started the exercise to either "Revert to exercise start" or "Revert to last iteration" for such a change to appear to them. Updating the exercise is not enough. My guess is that they were also not seeing the cases_test.go file.

This should not be a problem for people who are recently starting the exercise completely fresh. june just sent me a mentoring request for "Word Search" and I can see the cases_test.go file:

image

I think this happens just because the exercise was started fresh.

A few weeks ago I opened a similar issue about files that were renamed not showing in the editor, even after an update: https://github.com/exercism/exercism/issues/5954. I guess the underlying issue here is the same and the solution should also the same - the files in the editor won't update unless the user either "Revert to exercise start" or "Revert to last iteration". Like it was mentioned in that issue, I agree that this sort of updates should be done automatically or make more explicit to the user that the "files available" changed and prompt an action.

andrerfcsantos avatar Oct 20 '21 19:10 andrerfcsantos