yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::test::TestManager Class Reference

#include <test_manager.h>

Collaboration diagram for yaze::test::TestManager:

Public Member Functions

absl::Status RunAllTests ()
 
absl::Status RunTestsByCategory (TestCategory category)
 
absl::Status RunTestSuite (const std::string &suite_name)
 
void RegisterTestSuite (std::unique_ptr< TestSuite > suite)
 
std::vector< std::string > GetTestSuiteNames () const
 
TestSuiteGetTestSuite (const std::string &name)
 
const TestResultsGetLastResults () const
 
void ClearResults ()
 
void SetMaxConcurrentTests (size_t max_concurrent)
 
void SetTestTimeout (std::chrono::seconds timeout)
 
void UpdateResourceStats ()
 
const std::vector< ResourceStats > & GetResourceHistory () const
 
void * GetUITestEngine ()
 
void InitializeUITesting ()
 
void StopUITesting ()
 
void DestroyUITestingContext ()
 
void ShutdownUITesting ()
 
bool IsTestRunning () const
 
const std::string & GetCurrentTestName () const
 
float GetProgress () const
 
void DrawTestDashboard (bool *show_dashboard=nullptr)
 
void SetCurrentRom (Rom *rom)
 
RomGetCurrentRom () const
 
void RefreshCurrentRom ()
 
absl::Status LoadRomForTesting (const std::string &filename)
 
void ShowRomComparisonResults (const Rom &before, const Rom &after)
 
absl::Status CreateTestRomCopy (Rom *source_rom, std::unique_ptr< Rom > &test_rom)
 
std::string GenerateTestRomFilename (const std::string &base_name)
 
void OfferTestSessionCreation (const std::string &test_rom_path)
 
absl::Status TestRomSaveLoad (Rom *rom)
 
absl::Status TestRomDataIntegrity (Rom *rom)
 
absl::Status TestRomWithCopy (Rom *source_rom, std::function< absl::Status(Rom *)> test_function)
 
void DisableTest (const std::string &test_name)
 
void EnableTest (const std::string &test_name)
 
bool IsTestEnabled (const std::string &test_name) const
 
std::string RegisterHarnessTest (const std::string &name, const std::string &category)
 
void CaptureFailureContext (const std::string &test_id)
 
absl::Status ReplayLastPlan ()
 
absl::Status ShowHarnessDashboard ()
 
absl::Status ShowHarnessActiveTests ()
 
void RecordPlanSummary (const std::string &summary)
 

Static Public Member Functions

static TestManagerGet ()
 

Private Member Functions

 TestManager ()
 
 ~TestManager ()
 
absl::Status ExecuteTestSuite (TestSuite *suite)
 
void UpdateProgress ()
 
void CollectResourceStats ()
 
void TrimResourceHistory ()
 

Private Attributes

std::vector< std::unique_ptr< TestSuite > > test_suites_
 
std::unordered_map< std::string, TestSuite * > suite_lookup_
 
TestResults last_results_
 
bool is_running_ = false
 
std::string current_test_name_
 
float progress_ = 0.0f
 
size_t max_concurrent_tests_ = 1
 
std::chrono::seconds test_timeout_ {30}
 
std::vector< ResourceStatsresource_history_
 
bool show_dashboard_ = false
 
bool show_resource_monitor_ = false
 
std::string test_filter_
 
TestCategory category_filter_ = TestCategory::kUnit
 
Romcurrent_rom_ = nullptr
 
bool show_google_tests_ = false
 
bool show_rom_test_results_ = false
 
bool show_rom_file_dialog_ = false
 
bool show_test_session_dialog_ = false
 
bool show_test_configuration_ = false
 
std::string test_rom_path_for_session_
 
std::unordered_map< std::string, bool > disabled_tests_
 
absl::Mutex mutex_
 

Static Private Attributes

static constexpr size_t kMaxResourceHistorySize = 1000
 

Detailed Description

Definition at line 175 of file test_manager.h.

Constructor & Destructor Documentation

◆ TestManager()

yaze::test::TestManager::TestManager ( )
private

Definition at line 157 of file test_manager.cc.

◆ ~TestManager()

yaze::test::TestManager::~TestManager ( )
private

Definition at line 162 of file test_manager.cc.

References ShutdownUITesting().

Here is the call graph for this function:

Member Function Documentation

◆ Get()

TestManager & yaze::test::TestManager::Get ( )
static

Definition at line 152 of file test_manager.cc.

Referenced by yaze::editor::EditorManager::BuildModernMenu(), yaze::editor::AgentChatWidget::CheckHarnessConnection(), yaze::editor::EditorManager::CloseCurrentSession(), yaze::core::CreateWindow(), yaze::test::E2ETestSuite::DrawConfiguration(), yaze::test::RomDependentTestSuite::DrawConfiguration(), yaze::test::ZSCustomOverworldTestSuite::DrawConfiguration(), yaze::editor::EditorManager::DrawMenuBar(), yaze::editor::EditorManager::Initialize(), yaze::editor::EditorManager::InitializeTestSuites(), yaze::editor::EditorManager::LoadRom(), main(), yaze::editor::EditorManager::OpenProject(), yaze::test::RegisterZ3edTestSuites(), yaze::test::ZSCustomOverworldTestSuite::RunAddressValidationTest(), yaze::test::RomDependentTestSuite::RunComprehensiveSaveTest(), yaze::test::E2ETestSuite::RunCorruptionDetectionTest(), yaze::test::E2ETestSuite::RunDataIntegrityTest(), yaze::test::ZSCustomOverworldTestSuite::RunDataIntegrityTest(), yaze::test::ZSCustomOverworldTestSuite::RunFeatureToggleTest(), yaze::test::E2ETestSuite::RunLargeScaleEditingTest(), yaze::test::IntegratedTestSuite::RunRomBasicTest(), yaze::test::E2ETestSuite::RunRomLoadSaveTest(), yaze::test::E2ETestSuite::RunTests(), yaze::test::RomDependentTestSuite::RunTests(), yaze::test::ZSCustomOverworldTestSuite::RunTests(), yaze::test::E2ETestSuite::RunTransactionSystemTest(), yaze::test::ZSCustomOverworldTestSuite::RunV2UpgradeTest(), yaze::test::ZSCustomOverworldTestSuite::RunV3UpgradeTest(), yaze::test::ZSCustomOverworldTestSuite::RunVanillaBaselineTest(), yaze::editor::EditorManager::SetCurrentRom(), yaze::core::ShutdownWindow(), yaze::editor::EditorManager::SwitchToSession(), and yaze::editor::EditorManager::Update().

◆ RunAllTests()

absl::Status yaze::test::TestManager::RunAllTests ( )

◆ RunTestsByCategory()

absl::Status yaze::test::TestManager::RunTestsByCategory ( TestCategory  category)

◆ RunTestSuite()

absl::Status yaze::test::TestManager::RunTestSuite ( const std::string &  suite_name)

◆ RegisterTestSuite()

void yaze::test::TestManager::RegisterTestSuite ( std::unique_ptr< TestSuite suite)

Definition at line 299 of file test_manager.cc.

References suite_lookup_, and test_suites_.

Referenced by yaze::test::RegisterZ3edTestSuites().

◆ GetTestSuiteNames()

std::vector< std::string > yaze::test::TestManager::GetTestSuiteNames ( ) const

Definition at line 307 of file test_manager.cc.

References test_suites_.

◆ GetTestSuite()

TestSuite * yaze::test::TestManager::GetTestSuite ( const std::string &  name)

Definition at line 316 of file test_manager.cc.

References suite_lookup_.

◆ GetLastResults()

const TestResults & yaze::test::TestManager::GetLastResults ( ) const
inline

Definition at line 190 of file test_manager.h.

References last_results_.

◆ ClearResults()

void yaze::test::TestManager::ClearResults ( )
inline

Definition at line 191 of file test_manager.h.

References yaze::test::TestResults::Clear(), and last_results_.

Referenced by yaze::editor::EditorManager::BuildModernMenu(), and DrawTestDashboard().

Here is the call graph for this function:

◆ SetMaxConcurrentTests()

void yaze::test::TestManager::SetMaxConcurrentTests ( size_t  max_concurrent)
inline

Definition at line 194 of file test_manager.h.

References max_concurrent_tests_.

◆ SetTestTimeout()

void yaze::test::TestManager::SetTestTimeout ( std::chrono::seconds  timeout)
inline

Definition at line 197 of file test_manager.h.

References test_timeout_.

◆ UpdateResourceStats()

void yaze::test::TestManager::UpdateResourceStats ( )

Definition at line 321 of file test_manager.cc.

References CollectResourceStats(), and TrimResourceHistory().

Here is the call graph for this function:

◆ GetResourceHistory()

const std::vector< ResourceStats > & yaze::test::TestManager::GetResourceHistory ( ) const
inline

Definition at line 201 of file test_manager.h.

References resource_history_.

◆ GetUITestEngine()

void * yaze::test::TestManager::GetUITestEngine ( )
inline

Definition at line 214 of file test_manager.h.

◆ InitializeUITesting()

void yaze::test::TestManager::InitializeUITesting ( )
inline

Definition at line 215 of file test_manager.h.

Referenced by yaze::core::CreateWindow().

◆ StopUITesting()

void yaze::test::TestManager::StopUITesting ( )
inline

Definition at line 216 of file test_manager.h.

Referenced by yaze::core::ShutdownWindow().

◆ DestroyUITestingContext()

void yaze::test::TestManager::DestroyUITestingContext ( )
inline

Definition at line 217 of file test_manager.h.

Referenced by yaze::core::ShutdownWindow().

◆ ShutdownUITesting()

void yaze::test::TestManager::ShutdownUITesting ( )
inline

Definition at line 218 of file test_manager.h.

Referenced by ~TestManager().

◆ IsTestRunning()

bool yaze::test::TestManager::IsTestRunning ( ) const
inline

Definition at line 222 of file test_manager.h.

References is_running_.

◆ GetCurrentTestName()

const std::string & yaze::test::TestManager::GetCurrentTestName ( ) const
inline

Definition at line 223 of file test_manager.h.

References current_test_name_.

◆ GetProgress()

float yaze::test::TestManager::GetProgress ( ) const
inline

Definition at line 224 of file test_manager.h.

References progress_.

◆ DrawTestDashboard()

void yaze::test::TestManager::DrawTestDashboard ( bool *  show_dashboard = nullptr)
Todo:
Implement result export
Todo:
Implement file dialog to load ROM specifically for testing
Todo:
This would need access to EditorManager to create a new session

Definition at line 387 of file test_manager.cc.

References category_filter_, ClearResults(), current_rom_, current_test_name_, yaze::Rom::data(), yaze::Rom::dirty(), DisableTest(), EnableTest(), yaze::test::TestResults::failed_tests, yaze::Rom::filename(), yaze::core::FeatureFlags::get(), yaze::test::TestResults::GetPassRate(), yaze::test::GetTestStatusColor(), ICON_MD_ANALYTICS, ICON_MD_ASSESSMENT, ICON_MD_BLOCK, ICON_MD_CAMERA_ALT, ICON_MD_CHECK, ICON_MD_CHECK_CIRCLE, ICON_MD_CHECKLIST, ICON_MD_CLEAR, ICON_MD_CLOSE, ICON_MD_DESCRIPTION, ICON_MD_EDIT, ICON_MD_ERROR, ICON_MD_ERROR_OUTLINE, ICON_MD_FILTER_LIST, ICON_MD_FOLDER_OPEN, ICON_MD_HELP, ICON_MD_HISTORY, ICON_MD_INFO, ICON_MD_LAYERS, ICON_MD_MEMORY, ICON_MD_MONITOR, ICON_MD_PLAY_ARROW, ICON_MD_PLAY_CIRCLE_FILLED, ICON_MD_SCHEDULE, ICON_MD_SCIENCE, ICON_MD_SETTINGS, ICON_MD_SKIP_NEXT, ICON_MD_SPEED, ICON_MD_STORAGE, ICON_MD_TAB, ICON_MD_TEXTURE, ICON_MD_TIMER, ICON_MD_TIMER_OFF, ICON_MD_WARNING, yaze::test::TestResults::individual_results, yaze::Rom::is_loaded(), is_running_, IsTestEnabled(), yaze::test::kFailed, yaze::test::kIntegration, yaze::test::kMemory, yaze::test::kPassed, yaze::test::kPerformance, yaze::test::kRunning, yaze::test::kSkipped, yaze::test::kUI, yaze::test::kUnit, yaze::core::FeatureFlags::Flags::kUseNativeFileDialog, last_results_, LOG_INFO, yaze::test::TestResults::passed_tests, progress_, RefreshCurrentRom(), resource_history_, RunAllTests(), RunTestsByCategory(), show_dashboard_, show_google_tests_, show_resource_monitor_, show_rom_file_dialog_, show_rom_test_results_, show_test_configuration_, show_test_session_dialog_, yaze::util::FileDialogWrapper::ShowOpenFileDialog(), yaze::util::FileDialogWrapper::ShowOpenFileDialogBespoke(), yaze::util::FileDialogWrapper::ShowOpenFileDialogNFD(), yaze::Rom::size(), yaze::test::TestResults::skipped_tests, test_filter_, test_rom_path_for_session_, TestRomDataIntegrity(), TestRomSaveLoad(), yaze::Rom::title(), yaze::test::TestResults::total_duration, and yaze::test::TestResults::total_tests.

◆ SetCurrentRom()

◆ GetCurrentRom()

◆ RefreshCurrentRom()

void yaze::test::TestManager::RefreshCurrentRom ( )

Definition at line 1469 of file test_manager.cc.

References current_rom_, yaze::Rom::dirty(), yaze::Rom::is_loaded(), LOG_INFO, yaze::Rom::size(), and yaze::Rom::title().

Referenced by DrawTestDashboard().

Here is the call graph for this function:

◆ LoadRomForTesting()

absl::Status yaze::test::TestManager::LoadRomForTesting ( const std::string &  filename)

Definition at line 1572 of file test_manager.cc.

References LOG_INFO.

◆ ShowRomComparisonResults()

void yaze::test::TestManager::ShowRomComparisonResults ( const Rom before,
const Rom after 
)

Definition at line 1581 of file test_manager.cc.

References yaze::Rom::dirty(), ICON_MD_COMPARE, and yaze::Rom::size().

Here is the call graph for this function:

◆ CreateTestRomCopy()

absl::Status yaze::test::TestManager::CreateTestRomCopy ( Rom source_rom,
std::unique_ptr< Rom > &  test_rom 
)

Definition at line 1494 of file test_manager.cc.

References yaze::Rom::is_loaded(), LOG_INFO, yaze::Rom::title(), and yaze::Rom::vector().

Referenced by TestRomWithCopy().

Here is the call graph for this function:

◆ GenerateTestRomFilename()

std::string yaze::test::TestManager::GenerateTestRomFilename ( const std::string &  base_name)

Definition at line 1518 of file test_manager.cc.

Referenced by TestRomSaveLoad().

◆ OfferTestSessionCreation()

void yaze::test::TestManager::OfferTestSessionCreation ( const std::string &  test_rom_path)

Definition at line 1545 of file test_manager.cc.

References show_test_session_dialog_, and test_rom_path_for_session_.

Referenced by TestRomSaveLoad().

◆ TestRomSaveLoad()

◆ TestRomDataIntegrity()

absl::Status yaze::test::TestManager::TestRomDataIntegrity ( Rom rom)

◆ TestRomWithCopy()

absl::Status yaze::test::TestManager::TestRomWithCopy ( Rom source_rom,
std::function< absl::Status(Rom *)>  test_function 
)

Definition at line 1551 of file test_manager.cc.

References CreateTestRomCopy(), yaze::Rom::is_loaded(), LOG_INFO, and RETURN_IF_ERROR.

Referenced by TestRomDataIntegrity(), and TestRomSaveLoad().

Here is the call graph for this function:

◆ DisableTest()

void yaze::test::TestManager::DisableTest ( const std::string &  test_name)
inline

Definition at line 260 of file test_manager.h.

References disabled_tests_.

Referenced by DrawTestDashboard().

◆ EnableTest()

void yaze::test::TestManager::EnableTest ( const std::string &  test_name)
inline

Definition at line 263 of file test_manager.h.

References disabled_tests_.

Referenced by DrawTestDashboard().

◆ IsTestEnabled()

bool yaze::test::TestManager::IsTestEnabled ( const std::string &  test_name) const
inline

Definition at line 266 of file test_manager.h.

References disabled_tests_.

Referenced by DrawTestDashboard().

◆ RegisterHarnessTest()

std::string yaze::test::TestManager::RegisterHarnessTest ( const std::string &  name,
const std::string &  category 
)

Definition at line 1698 of file test_manager.cc.

◆ CaptureFailureContext()

void yaze::test::TestManager::CaptureFailureContext ( const std::string &  test_id)

Definition at line 1860 of file test_manager.cc.

◆ ReplayLastPlan()

absl::Status yaze::test::TestManager::ReplayLastPlan ( )

Definition at line 1883 of file test_manager.cc.

Referenced by yaze::editor::EditorManager::Initialize().

◆ ShowHarnessDashboard()

absl::Status yaze::test::TestManager::ShowHarnessDashboard ( )

Definition at line 1888 of file test_manager.cc.

Referenced by yaze::editor::EditorManager::Initialize().

◆ ShowHarnessActiveTests()

absl::Status yaze::test::TestManager::ShowHarnessActiveTests ( )

Definition at line 1897 of file test_manager.cc.

Referenced by yaze::editor::EditorManager::Initialize().

◆ RecordPlanSummary()

void yaze::test::TestManager::RecordPlanSummary ( const std::string &  summary)

Definition at line 1905 of file test_manager.cc.

◆ ExecuteTestSuite()

absl::Status yaze::test::TestManager::ExecuteTestSuite ( TestSuite suite)
private

Definition at line 326 of file test_manager.cc.

References CollectResourceStats(), last_results_, and yaze::test::TestSuite::RunTests().

Referenced by RunAllTests(), RunTestsByCategory(), and RunTestSuite().

Here is the call graph for this function:

◆ UpdateProgress()

void yaze::test::TestManager::UpdateProgress ( )
private

Definition at line 343 of file test_manager.cc.

References progress_, and test_suites_.

Referenced by RunAllTests(), and RunTestsByCategory().

◆ CollectResourceStats()

◆ TrimResourceHistory()

void yaze::test::TestManager::TrimResourceHistory ( )
private

Definition at line 378 of file test_manager.cc.

References kMaxResourceHistorySize, and resource_history_.

Referenced by UpdateResourceStats().

Member Data Documentation

◆ test_suites_

std::vector<std::unique_ptr<TestSuite> > yaze::test::TestManager::test_suites_
private

◆ suite_lookup_

std::unordered_map<std::string, TestSuite*> yaze::test::TestManager::suite_lookup_
private

Definition at line 330 of file test_manager.h.

Referenced by GetTestSuite(), RegisterTestSuite(), and RunTestSuite().

◆ last_results_

TestResults yaze::test::TestManager::last_results_
private

◆ is_running_

bool yaze::test::TestManager::is_running_ = false
private

◆ current_test_name_

std::string yaze::test::TestManager::current_test_name_
private

◆ progress_

float yaze::test::TestManager::progress_ = 0.0f
private

◆ max_concurrent_tests_

size_t yaze::test::TestManager::max_concurrent_tests_ = 1
private

Definition at line 338 of file test_manager.h.

Referenced by SetMaxConcurrentTests().

◆ test_timeout_

std::chrono::seconds yaze::test::TestManager::test_timeout_ {30}
private

Definition at line 339 of file test_manager.h.

Referenced by SetTestTimeout().

◆ resource_history_

std::vector<ResourceStats> yaze::test::TestManager::resource_history_
private

◆ kMaxResourceHistorySize

constexpr size_t yaze::test::TestManager::kMaxResourceHistorySize = 1000
staticconstexprprivate

Definition at line 343 of file test_manager.h.

Referenced by TrimResourceHistory().

◆ show_dashboard_

bool yaze::test::TestManager::show_dashboard_ = false
private

Definition at line 351 of file test_manager.h.

Referenced by DrawTestDashboard().

◆ show_resource_monitor_

bool yaze::test::TestManager::show_resource_monitor_ = false
private

Definition at line 352 of file test_manager.h.

Referenced by DrawTestDashboard().

◆ test_filter_

std::string yaze::test::TestManager::test_filter_
private

Definition at line 353 of file test_manager.h.

Referenced by DrawTestDashboard().

◆ category_filter_

TestCategory yaze::test::TestManager::category_filter_ = TestCategory::kUnit
private

Definition at line 354 of file test_manager.h.

Referenced by DrawTestDashboard().

◆ current_rom_

Rom* yaze::test::TestManager::current_rom_ = nullptr
private

Definition at line 357 of file test_manager.h.

Referenced by DrawTestDashboard(), GetCurrentRom(), RefreshCurrentRom(), and SetCurrentRom().

◆ show_google_tests_

bool yaze::test::TestManager::show_google_tests_ = false
private

Definition at line 361 of file test_manager.h.

Referenced by DrawTestDashboard().

◆ show_rom_test_results_

bool yaze::test::TestManager::show_rom_test_results_ = false
private

Definition at line 362 of file test_manager.h.

Referenced by DrawTestDashboard().

◆ show_rom_file_dialog_

bool yaze::test::TestManager::show_rom_file_dialog_ = false
private

Definition at line 363 of file test_manager.h.

Referenced by DrawTestDashboard().

◆ show_test_session_dialog_

bool yaze::test::TestManager::show_test_session_dialog_ = false
private

Definition at line 364 of file test_manager.h.

Referenced by DrawTestDashboard(), and OfferTestSessionCreation().

◆ show_test_configuration_

bool yaze::test::TestManager::show_test_configuration_ = false
private

Definition at line 365 of file test_manager.h.

Referenced by DrawTestDashboard().

◆ test_rom_path_for_session_

std::string yaze::test::TestManager::test_rom_path_for_session_
private

Definition at line 366 of file test_manager.h.

Referenced by DrawTestDashboard(), and OfferTestSessionCreation().

◆ disabled_tests_

std::unordered_map<std::string, bool> yaze::test::TestManager::disabled_tests_
private

Definition at line 369 of file test_manager.h.

Referenced by DisableTest(), EnableTest(), and IsTestEnabled().

◆ mutex_

absl::Mutex yaze::test::TestManager::mutex_
private

Definition at line 402 of file test_manager.h.


The documentation for this class was generated from the following files: