Skip to content
This repository has been archived by the owner on Apr 25, 2022. It is now read-only.

Add more unit testing of modpack components #103

Open
Willster419 opened this issue Sep 12, 2020 · 2 comments
Open

Add more unit testing of modpack components #103

Willster419 opened this issue Sep 12, 2020 · 2 comments
Assignees

Comments

@Willster419
Copy link
Owner

Willster419 commented Sep 12, 2020

Currently it only has a few installer components. I'd like to see it increased so we can catch more bugs earlier before beta or official releases.

First should be finishing the installer components. Then I'd like to see some UI testing, if possible. And maybe some CI integration for testing the "Mods as a service" install system.

@hrobohboy i'm really hoping you can help out with this one.

Maybe we can include code coverage...?

@Willster419
Copy link
Owner Author

Willster419 commented Sep 14, 2020

I did some research and testing into how to automate UI. And by research I mean stack overflow reading. I have a working sandbox Unit Test project of it that can do the following:

  • Create a window component like ModSelectionList
  • Invoke the showing of the dialog
  • Use an async Task to either wait for a timeout, or event, or we can poll for a property
  • Using UiUtils I can get a list of all logical framework elements in the window
    • List<FrameworkElement> elements = UiUtils.GetAllWindowComponentsLogical(InstallerUnitTestHelper.InstallerHelperList, false);
  • Using the translation engine, I used the Tag property of the components, which we can use to get buttons, for example.
    • FrameworkElement buttonElement = elements.Find(element => element.Tag != null && element.Tag.Equals("ClearSelectionsButton"));
    • Button clearSelectionsButton = buttonElement as Button;
  • And finally we can use the RaiseEvent method to simulate UI interaction
    • clearSelectionsButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));

This is the unlocking key to the ability to deploy a CI system that can:

  • Load the modpack
  • Load the selection list
  • Load a preset selection OR we make a system to get a random selection
  • Run an install and grep the log for ERROR and EXCEPTION
  • Launch WoT with a 30 second replay or something and wait for an exit code

This could be run continuously to look for major issues, and would be a HUGE step towards bug finding. Like YUUGE.

I am considering placing this priority above the database automation and if you two have time would really appreciate your help.

@Willster419
Copy link
Owner Author

Added unit testing of loading the stable and beta database, along with duplicate UID and packageName checking with e9270f7

Make sure we can load and save the database after changes are made

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants