OK, so you are trying to write a unit test for the validation method of edit form for your question type.
This seems to be a good idea, and I am suprised that I have never done that for any of my own question types. (I was hoping I could give you a link to a working example.)
The code you have writted mostly looks right. I think that should work, unless there are small mistakes in the code that you need to fix.
The other thing to think about is whether the form validate method is the best one to unit test. For example, in the STACK question type, the form method https://github.com/maths/moodle-qtype_stack/blob/master/edit_stack_form.php#L1056 calls some other methods https://github.com/maths/moodle-qtype_stack/blob/master/edit_stack_form.php#L1268, and those lower level methods are where we wrote lots of unit tests. https://github.com/maths/moodle-qtype_stack/blob/master/tests/castext_test.php
The reason to do it that way is that you can test all the deatils of the low-level validation logic without the overhead of creating an instance of the editing form.