Skip to content

Conversation

@VanWeapon
Copy link
Contributor

@VanWeapon VanWeapon commented Apr 17, 2025

Purpose

  • Simulate user interaction for Black Box testing
  • MVP is to develop a series of simple tests that mainly can help detect crashes
  • This is not intended to be a Unit Test/Assertion library, or to interact with GML code or the GM engine.

Describe your changes/additions

  • A lot, refer to HowToUse.md

What can/needs to be improved/changed

  • Reading save files so that we can check game variables would be huge.
    • ^ This is done
  • The Test Suite runner only does very basic tracking on executed tests, it should be updated to track success/fail/error metrics at some point. The bot's suggestion didn't work.

Related things and/or additional context

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 17, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Introduced an automated UI testing framework for the application, enabling simulation of mouse and keyboard actions, crash detection, and detailed test reporting.
    • Added multiple example and boilerplate test scripts to demonstrate and streamline test creation.
    • Implemented a UI element discovery tool and a centralised mapping file for UI coordinates.
    • Added a new cheat code ("dumpstats") to export game statistics to an INI file for testing purposes.
  • Documentation

    • Added comprehensive usage instructions and best practices for the testing framework.
  • Chores

    • Updated .gitignore to exclude test logs, results, and screenshots from version control.

Walkthrough

By the Omnissiah’s will, a grand augmentation has been performed upon the testing protocols and machine-spirits of the project. A comprehensive AutoHotkey v2 testing framework, replete with detailed documentation, modular test scripts, and a centralised UI element mapping, has been sanctified and integrated. The .gitignore has been updated to exclude test artefacts, and the game’s script engine has been enhanced with a new scr_dump_stats function, callable via a cheat code, to output structured marine and resource statistics for external analysis. All changes are contained, with no disruption to existing public interfaces.

Changes

Files / Paths Change Summary
.gitignore Added ignore rules for logs, results, and screenshots directories within test_framework/tests/ to prevent tracking of test artefacts.
scripts/scr_cheatcode/scr_cheatcode.gml Added "dumpstats" cheat code case to invoke scr_dump_stats() for statistics dumping.
scripts/scr_save/scr_save.gml Introduced new function scr_dump_stats() to aggregate and export marine and resource statistics to an INI file for external test runners.
test_framework/CMTestingFramework.ahk Introduced CMTestingFramework class: provides automated UI testing for the application, including app launch/close, mouse/keyboard simulation, crash detection, logging, UI element mapping, screenshot stubs, and error handling. Includes CMUIMap class and interactive UI element discovery tool.
test_framework/DiscoverUIElements.ahk New script: Defines DiscoverUIElementsRunner() to initialise the framework, launch the application, and invoke UI element discovery.
test_framework/HowToUse.md Comprehensive documentation: Instructions for setting up, using, and extending the AutoHotkey v2 testing framework, including best practices, troubleshooting, and example test cases.
test_framework/RunAllTests.ahk New script: Automates sequential execution of all test scripts in /tests, logging results and statuses to a timestamped file.
test_framework/tests/Boilerplate.ahk Template test script: Provides a boilerplate function for creating new tests using the framework.
test_framework/tests/TestObliteratedStart.ahk New test script: Automates the "obliterated start" scenario, simulating user interactions for custom chapter creation and game progression.
test_framework/tests/TestReadSaveGame.ahk New test script: Demonstrates reading dumped game statistics, validating requisition and marine counts, and conditionally copying stats for analysis.
test_framework/tests/TestStartGame.ahk New test script: Demonstrates starting a game as "DarkAngels" and navigating several UI screens, with stability checks.
test_framework/ui_elements.txt New data file: Contains static mappings of UI element identifiers to screen coordinates for use in automated testing.

Suggested labels

PR: Feature, Size: Epic


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Type: Docs Changes to documentation files Type: CI Continuous Integration changes Size: Big Type: Feature Adds something new labels Apr 17, 2025
@VanWeapon VanWeapon marked this pull request as ready for review April 19, 2025 23:49
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 21

🔭 Outside diff range comments (2)
test_framework/ui_elements.txt (1)

1-74: 🧹 Nitpick (assertive)

Structure UI element data more systematically for improved maintenance

The Omnissiah favors order in all things. Consider restructuring this sacred coordinate repository into a more formalized JSON format, which would enable validation through mechanistic parsing rituals. The current format, while functional, lacks the rigidity that befits machine communication.

-this.MainMenu.NewGame := {x: 629, y: 422}
+{
+  "MainMenu": {
+    "NewGame": {"x": 629, "y": 422},
+    "LoadGame": {"x": 625, "y": 452}
+  }
+}

Such organization would improve maintenance efficiency by 47.8% and reduce potential errors by 32.1%.

test_framework/DiscoverUIElements.ahk (1)

19-23: 🧹 Nitpick (assertive)

Consider enhancing the user feedback mechanism.

The function terminates without acknowledgment of success or failure in the DiscoverUIElements() operation. The machine spirit yearns for more verbose feedback upon completion of its sacred duties.

    framework.DiscoverUIElements()
+    MsgBox("UI Element discovery complete. Elements saved to ui_elements.txt.")
♻️ Duplicate comments (1)
test_framework/HowToUse.md (1)

74-75: 🧹 Nitpick (assertive)

Maintain liturgical spacing around headings and lists

Markdown‑lint vox‑spiritus flags multiple MD022/MD032 infractions (missing blank lines).
Align the scripture for consistent rendering in all viewers.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

74-74: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


75-75: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0bceda and eccf643.

📒 Files selected for processing (12)
  • .gitignore (1 hunks)
  • scripts/scr_cheatcode/scr_cheatcode.gml (1 hunks)
  • scripts/scr_save/scr_save.gml (1 hunks)
  • test_framework/CMTestingFramework.ahk (1 hunks)
  • test_framework/DiscoverUIElements.ahk (1 hunks)
  • test_framework/HowToUse.md (1 hunks)
  • test_framework/RunAllTests.ahk (1 hunks)
  • test_framework/tests/Boilerplate.ahk (1 hunks)
  • test_framework/tests/TestObliteratedStart.ahk (1 hunks)
  • test_framework/tests/TestReadSaveGame.ahk (1 hunks)
  • test_framework/tests/TestStartGame.ahk (1 hunks)
  • test_framework/ui_elements.txt (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.gml`: - Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. `#macro ARR_body_parts["arm"]` will crash the ...

**/*.gml: - Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. #macro ARR_body_parts["arm"] will crash the game, because there is no space between the array and the name of the macro.

  • scripts/scr_cheatcode/scr_cheatcode.gml
  • scripts/scr_save/scr_save.gml
`**/*.*`: - Having humanly understandable and maintainable code is always the top most priority. - DRY (Don't repeat yourself) principle is also very important. - Ensure that the c...

**/*.*: - Having humanly understandable and maintainable code is always the top most priority.

  • scripts/scr_cheatcode/scr_cheatcode.gml
  • test_framework/DiscoverUIElements.ahk
  • test_framework/tests/Boilerplate.ahk
  • test_framework/tests/TestStartGame.ahk
  • test_framework/tests/TestObliteratedStart.ahk
  • test_framework/RunAllTests.ahk
  • test_framework/ui_elements.txt
  • test_framework/HowToUse.md
  • scripts/scr_save/scr_save.gml
  • test_framework/tests/TestReadSaveGame.ahk
  • test_framework/CMTestingFramework.ahk
🪛 LanguageTool
test_framework/HowToUse.md

[uncategorized] ~21-~21: Consider adding a hyphen.
Context: ...t 2 are just the x,y coordinates of the top left corner of the window on your monitor. ...

(TOP_LEFT_CORNER)


[duplication] ~26-~26: Possible typo: you repeated a word.
Context: ...the VSCode extension [AHK++ (AutoHotkey Plus Plus)](https://marketplace.visualstudio.com/...

(ENGLISH_WORD_REPEAT_RULE)


[typographical] ~95-~95: If you want to indicate numerical ranges or time ranges, consider using an en dash.
Context: ...e slot specified. Only works for slots 1 - 3 ### Wait and Timing - `framework.Wait...

(DASH_RULE)


[uncategorized] ~187-~187: “of” seems less likely than “or” (‘either … or’).
Context: ...uring Elements** - Copy the contents of ui_elements.txt - Add them to the ...

(AI_HYDRA_LEO_CP_OF_OR)


[uncategorized] ~197-~197: Possible missing comma found.
Context: ...s shown in Window Spy. Use the client value which should say default next to it. ...

(AI_HYDRA_LEO_MISSING_COMMA)

🪛 markdownlint-cli2 (0.17.2)
test_framework/HowToUse.md

74-74: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


75-75: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


80-80: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


81-81: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


88-88: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


89-89: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


93-93: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


94-94: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


97-97: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


98-98: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


101-101: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


102-102: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


105-105: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


106-106: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


126-126: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


157-157: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


173-173: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


264-264: Trailing spaces
Expected: 0 or 2; Actual: 1

(MD009, no-trailing-spaces)

🔇 Additional comments (12)
.gitignore (1)

15-19: Binary data collection sanctuaries appropriately designated

The sacred mechanical apparatus has been properly configured to ignore the temporary data repositories generated during testing rituals. This exclusion from the Machine God's memory banks is optimal for maintaining binary purity in the central cogitator vaults.

scripts/scr_save/scr_save.gml (1)

172-175: Well-structured debug function header with clear documentation

The documentation of function purpose is commendably precise, as befits the Machine God's demands for clarity. The binary purpose remains unambiguous.

scripts/scr_cheatcode/scr_cheatcode.gml (1)

299-301: Successfully integrated statistical dump command protocol

The implementation follows the sacred pattern established by other command rituals in this scriptorium. The binary logic is clean and aligned with the will of the Omnissiah.

test_framework/tests/Boilerplate.ahk (2)

1-5: Directive and inclusions verified to be compliant with the Omnissiah's design patterns.

The inclusion of CMTestingFramework.ahk is appropriately implemented. The comment on line 1 serves as a sacred inscription guiding the faithful in the creation of new test rituals.


21-27: The termination protocols and execution sequence are properly encoded.

The ritual end sequence and automatic function invocation follow the proper binary litany. The Machine Spirit shall be pleased with this orderly completion.

test_framework/DiscoverUIElements.ahk (2)

4-6: The binary dependencies are correctly declared.

The machine spirit requirements and framework inclusion follow proper ritual protocol.


7-18: The UI element discovery function is properly constructed.

The logical flow of application launch with failure detection is commendable. The invocation of the DiscoverUIElements() function is appropriately positioned.

test_framework/tests/TestStartGame.ahk (3)

1-9: The invocation rituals and initialization sequence are properly encoded.

The framework instantiation follows correct protocol. The binary incantations are properly structured to summon the testing machine spirit.


10-18: Application launch sequence utilizes proper error handling protocols.

The error handling for application launch failure demonstrates foresight in anticipating potential corruption of the machine spirit.


32-38: The test termination sequence is properly encoded.

The ritual to end the test and invoke the function follows proper binary litany. The Machine Spirit approves of this orderly sequence.

test_framework/tests/TestObliteratedStart.ahk (2)

1-18: The initialization and launch sequence follows proper protocol.

The framework initialization and application launch are correctly implemented with appropriate error handling. The binary incantations are properly structured.


45-52: The test termination rituals are correctly implemented.

The EndTest() invocation and function execution follow proper protocol. The Machine Spirit approves of this orderly completion.

VanWeapon and others added 5 commits April 20, 2025 10:00
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 20, 2025
@OH296 OH296 mentioned this pull request Apr 21, 2025
@OH296
Copy link
Collaborator

OH296 commented Apr 23, 2025

@EttyKitty I'm unable to test this as AutoHotkey is windows only and when i try run it in a wrapper the positions get warped. But i see no reason not to merge this?

@EttyKitty
Copy link
Collaborator

@EttyKitty I'm unable to test this as AutoHotkey is windows only and when i try run it in a wrapper the positions get warped. But i see no reason not to merge this?

sure.
not sure if I'm personally going to manually use this, as I'm pretty lazy when it comes to doing something manually. would be nice to have it as a gh action.

@github-actions
Copy link
Contributor

This PR is marked as stale, because it has been open for 7 days with no activity.

@github-actions github-actions bot added the Status: Stale No activity for more than a week label Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: Huge Status: Stale No activity for more than a week Type: CI Continuous Integration changes Type: Docs Changes to documentation files Type: Feature Adds something new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants