testez
testez copied to clipboard
Optionally clone test modules before executing to allow hot reloading
Right now, hot-reloading TestEZ tests isn't possible - you have to stop and restart from scratch. In some cases this is beneficial, but sometimes you may want to be able to re-run tests with (relative) ease. I think the only way to do this from a regular script is to clone each test module before calling require on it. Doing this forces the test code to be re-executed instead of being loaded from the cache.
This should probably be optional, since cloning big modules can't be performant. I know I've experienced major slowdowns in Studio from cloning scripts - I don't know if this is still the case.
~~I just have a script under TestService that runs the tests as soon as the game starts with studio Run mode using ExecuteWithStudioRun. I think that this is a better solution than running the tests directly in Studio edit mode because of the possibility of side effects being left over after running the tests.~~
~~While it's definitely a good idea to keep side effects to a minimum in your testable code, I don't think it's fair to assume that all code that needs to be tested must not have side effects. And if that's the case, then that means that there's a possibility of introducing these side effects into the saved/published version of the game, which is definitely not ideal.~~
~~So, I think that implementing this kind of functionality even as an option may be a bit of a footgun because it could cause developers to contaminate their saved/published game with side effects or even lose work due to being unable to just Ctrl+Z the changes that were made by running the tests in edit mode.~~
I think the goal of this feature is not running tests in the edit-time DataModel, but hot-reloading tests in a play solo/run environment as your code is edited.
Hmm, yeah maybe I misunderstood the OP. I never considered that people would want to edit code in a play test session since I have PTSD from back when Roblox didn't have that pop-up message that asked if you wanted to keep your changes :P
That's one advantage of Rojo -- you can have both the edit and play solo data models syncing code in so that your changes are guaranteed not to be lost.
A possible solution to this problem is #65, once it's available to us.