forked from beyond-all-reason/Beyond-All-Reason
-
Notifications
You must be signed in to change notification settings - Fork 0
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 framework one file #5
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is currently just a demonstration, and is not ready for production use yet. Tests can be executed with `/runtests <pattern1> ... <patternN>`, where any test file (excluding file extension) that matches any pattern is included. `/runtests` by itself will run all tests. Features: * setup/cleanup functions can be defined in each test file. cleanup will always run, even if the test code fails. * nicely formatted test results, including errors with line information * two ways to call synced code: * `x = SyncedProxy.<Y>.<Z>()`, which is equivalent to `x = Y.Z()` executed in a synced context. * `x = SyncedRun(function() ... end)`, which allows execution of arbitrary code in a synced context. This is faster for things involving loops or many synced calls. * wait API to allow in-game actions to happen during a test. For example, `Test.waitFrames(5)` will wait 5 frames before resuming test execution. * `spy(parent, target)`, which allows tracking all calls to a spied function. * isolated environments for each test, while still having access to most globals accessible to widgets. Included are several sample widget tests, of a few different kinds: * balance tests, that set up fights between units * an example demonstrating different the wait API * a test for a user widget (gui_battle_resource_tracker) * several tests for a built-in widget (gui_selfd_icons) * some of these have sections testing bugs that are not fixed yet, and are thus commented out. The serpent library is included for straightforward serialization.
This allows tests to run pre-game.
right now it breaks wait timeouts
Co-authored-by: sprunk <[email protected]>
Calling `widgetHandler:EnableWidget(widgetName, true)` instead of `widgetHandler:EnableWidget(widgetName)` will now allow access to local variables as if they were globals, with `widget.localVariable`. Read and write are both supported.
This allows us to leave the widget file untouched and still test it.
This more closely matches how they would be restored with the debug library (when that becomes an option).
The previous behavior was between coroutine resumes, which led to callins occasionally being lost.
Previously, line information was lost because the distance was set too high.
Previously, sometimes the widget wouldn't have enough time to act before the test checked results.
Otherwise we do a lot of steps very quickly. In headless mode this significantly impacts how the game runs.
This is a tradeoff - this makes it so we can wait in cases where the same event happens several times in a test, but it also makes it so we can't wait for several of the same type of event sequentially (such as waiting for several UnitCreated or UnitCommand events after causing several).
Test Results15 tests 12 ✅ 18s ⏱️ Results for commit 077271c. ♻️ This comment has been updated with latest results. |
…tprint clearance" gadget and the "debris explosions" gadget (beyond-all-reason#4052) * removed engine hotfixes gadget and devide its functions to a new footprint clearance gadget and the debris explosions gadget * revert changes to debris explosion gadget: has already been in: #4053plemented as modrule in
…-all-reason#4081) Fix typo at gui_transport_weight_limit later causing lua crash.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work done