-
-
Notifications
You must be signed in to change notification settings - Fork 0
Testing Strategy
Ashton edited this page Feb 5, 2026
·
1 revision
This guide covers how to verify the functionality of the Giveaway Bot, both through automated tests (for developers) and manual verification (for users).
The repository includes a comprehensive C# test suite designed to run outside of Streamer.bot using a Mock CPH environment.
- .NET 8.0 SDK (or compatible) installed.
- VS Code or Visual Studio.
-
Open a terminal in the
_testsdirectory:cd "_tests" -
Run the tests:
dotnet run
The suite covers:
- ConfigSyncTests: Verifies global variable synchronization and profile parsing.
-
ProfileTests: Tests CRUD operations for profiles (
create,delete,clone). - ProfileLogicTests: Validates entry logic, ticket calculation, and state management.
- ProfileStrictnessTests: Verifies strictness rules (RequireFollower, RequireSubscriber).
- ProfilePersistenceTests: Ensures data survives restarts (File/GlobalVar persistence).
- CoreTests: Checks logging, metrics, and system health.
- IntegrationTests: Tests external integrations (Mock Wheel of Names, External Bots).
For end-users or final integration testing inside Streamer.bot.
-
Import Code: Copy
GiveawayBot.csinto a C# Code sub-action in Streamer.bot. -
References: Ensure
System.Net.Http.dllandNewtonsoft.Json.dllare referenced. - Compile: Click "Find Refs" and "Compile" to ensure no errors.
Run these commands in your Twitch/YouTube chat to verify basic health.
| Command | Action | Expected Result |
|---|---|---|
!giveaway config check |
Health Check | Bot replies "Report: Configuration is VALID ✅" |
!giveaway profile list |
List Profiles | Bot lists available profiles (e.g., "Main") |
!giveaway start |
Start Giveaway | "Giveaway 'Main' is now OPEN!" |
!enter |
Enter | "Entry accepted! Total tickets: 1" |
!draw |
Pick Winner | "Winner is [User]!" |
!giveaway end |
End Giveaway | "Giveaway 'Main' is now CLOSED!" |
- Verify that changing Global Variables updates the bot.
- Go to Streamer.bot -> Settings -> Global Variables.
- Find
Giveaway Global TimerDuration. - Change value from
10mto5m. - Run
!giveaway config checkin chat. - Verify bot logs/replies confirm the update, or check
giveaway_config.jsonto see if it persisted.
- Start a giveaway and get some entries.
- Restart Streamer.bot.
- Run
!giveaway status. - Verify the giveaway is still active and entry count is preserved.
- Configure
RequireFollower = truefor a profile. - Use a non-follower account (or mock in Streamer.bot).
- Type
!enter. - Verify entry is rejected (Check logs for "Rejected: Not Following").
If tests fail or behavior is unexpected:
- Set Global Variable
Giveaway Global LogLeveltoDEBUG(orTRACEfor deep inspection). - Check Streamer.bot Logs tab for
[GiveawayBot]entries.
-
"System Health Check Failed": Check if
Giveaway Botfolder is writable. -
Global Variable Mismatch: Ensure you are using the correct PascalCase keys (e.g.,
TimerDurationnotTimer Duration). - Metrics Not Updating: Ensure the giveaway profile is ACTIVE when testing entries.