using LoginPI.Engine.ScriptBase; public class windowsCalculatorCPUStressTest : ScriptBase { void Execute() { /* -Disclaimer: This workload is provided as-is and might need further configuration and customization to work successfully in each unique environment. For further Professional Services-based customization please consult with the Login VSI Support and Services team. Please refer to the Help Center section "Application Customization" for further self-help information regarding workload crafting and implementation. -If needed, configure the Set global variables section of this workload -Go through the workload to understand what it's doing. Comment out any unneeded app tests (code blocks) or add on any needed functional testing -Workload version and changelist: --V1.0 | original -Leave Application running compatibility: true Before production Login Enteprise testing please run this locally and manually on a target test system with a test user to determine if there are needed edits This workload will: -Launch calc with a custom timer -Navigate to Scientific view -Perform calculation: 0.1 n! (factorial), repeating the n! function for the defined amount in global vars --This will stress CPU --On the machine used to create the workload was about ~8% usage -Close calc Baremetal development machine and software information: -Winver Windows 11 Professional x64 21H2 -Toshiba nVME m.2 KXG60ZNV512G | 16GB DDR4 3200MHz | Intel Core i7-8850H -Login Enterprise version 4.7.5 Application Xray and Script Editor Other metadata: -Last updated 30 November 2021 */ // Set global vars double globalIntermittentWaitInSeconds = 0.5; // 1 int globalFunctionTimeoutInSeconds = 30; int globalCharacterPerMinuteToType = 2000; // 350 double timeBetweenFactorialButtonClicksInSeconds = 1.0; // This being faster (less time) can mean more CPU stress. This will vary from system to system. Suggest determining what is the best value here by manual testing. int factorialButtonClicksAmount = 30; ShellExecute(@"cmd /c taskkill /f /im calc*",timeout:globalFunctionTimeoutInSeconds,waitForProcessEnd:true); // Ensuring calc's closed out of before starting // Launching calc, using custom timer, and ensuring it's running StartTimer("CalcLaunchTime"); START(mainWindowTitle:"*Calc*",timeout:globalFunctionTimeoutInSeconds); MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Custom/Group:LandmarkTarget/Text",timeout:globalFunctionTimeoutInSeconds); // Looking for the output/input string pane StopTimer("CalcLaunchTime"); MainWindow.Maximize(); Wait(globalIntermittentWaitInSeconds); var hamburgerButton = MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Custom/Button:Button",timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); // Go into Scientific mode hamburgerButton.Click(); var scientificModeToggleButton = MainWindow.FindControlWithXPath(xPath : "Xaml Window:Windows.UI.Core.CoreWindow/Custom/Xaml Window:SplitViewPane/Pane:ScrollViewer/Group/ListItem:Microsoft.UI.Xaml.Controls.NavigationViewItem[1]",timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); scientificModeToggleButton.Click(); var factorialButton = MainWindow.FindControl(className : "Button:Button", title : "Factorial",timeout:globalFunctionTimeoutInSeconds); Wait(globalIntermittentWaitInSeconds); // Input 0.1 MainWindow.Type("0.1",cpm:globalCharacterPerMinuteToType); MainWindow.FindControl(className : "Text", title : "Display is 0.1",timeout:globalFunctionTimeoutInSeconds); // Iterate through the defined factorial button clicks int factorialButtonClickCounter = 1; while(factorialButtonClickCounter < factorialButtonClicksAmount) { factorialButton.Click(); factorialButtonClickCounter++; Wait(timeBetweenFactorialButtonClicksInSeconds); } STOP(timeout:globalFunctionTimeoutInSeconds); // Closing the calc app } }