Need to execute for single user
Need to increase multiple user as 100 then 500 user
Pre-requisites
- Visual studio enterprise edition 2015 or later version.
- Selenium dot net tools 3.13 version for platform 21 or later updates.
- IEDriverServer x64 bit
- ODBC Driver 17 for SQL server
- Local certificate for authentication
- Test administrator account
- Login into performance testing environment
- Download the selenium software based on your Dynamics 365 for operations platform version https://selenium-release.storage.googleapis.com/index.html?path=3.13/
- For D365FO platform version 21 and above, you need to choose Version 3.13.1 version, if the platform version 20 or below you need to choose the selenium 2.0 version
- Download IEDriverServer_Win32 3.13.0.zip
- Right click the zip files -> Properties -> Unblock
- Right click -> Extract all (specify the folder path where you want to extract)
- In the dist folder, rename the .nupkg files as .zip files, and then unzip them.
- Selenium.Support.StrongNamed.3.13.1.nupkg file renamed as Selenium.Support.StrongNamed.3.13.1.zip
- Selenium.WebDriver.StrongNamed.3.13.1.nupkg file renamed as Selenium.WebDriver.StrongNamed.3.13.1.zip
- Create the following folder structure Under your PerfSDK folder, PerfSDKLocalDirectory\Common\External\Selenium.
- Copy below files into that folder from the downloaded file
- IEDriverServer.exe from the unzipped IEDriverServer_Win32_3.13.0.zip file
- WebDriver.dll and WebDriver.xml from the lib\net45 folder in the unzipped Selenium.WebDriver.StrongNamed.3.13.1.zip file
- WebDriver.Support.dll and WebDriver.Support.xml from the lib\net45 folder in the unzipped Selenium.Support.StrongNamed.3.13.1.zip file
Performance testing
environment readiness
- Go to Task recorder
- Create a recording for the scenario.
- Download the task recorder as download developer mode
- The recording file will be saved as XML format. (XML will be downloaded into default folder based on browser settings C:\Users\xyz\downloads)
- Open Visual studio in Administrator mode.
- Sample performance testing project is available in the system
- Open PerfSDKSample solution, the folder path will be C:\PerfSDK\PerfSdkSample (local VM) or K:\PerfSDK\PerfSDKLocalDirectory\PerfSDKSample (Tier 1 or cloud hosted environment)
- Add a reference to the WebDriver.dll file in the Common\External\Selenium
- Import task recording into Visual studio
- Dynamics 365-> Add ins ->Create C# perf test from recording
- It will open the import POP window.
- Recording path – The file location of the developer recording of your end-to-end scenario.
- Project path – The location of the PerfSDKSample project. Typically, the path is <Your_PerfSDK_Folder>\SampleProject\PerfSDKSample\PerfSDKSample.csproj.
- PerfSDK path – The location of PerfSDK. Typically, the path is <ServiceVolumeDrive>\PerfSDK\PerfSDKLocalDirectory.
- Click import
- C# file will be generated and stored against the project.
- Build the solution
- Update the CloudEnvironment.config file of the PerfSDKSample project
- Microsoft planned to implement the PerfSDK using Azure authentication method, but it is not implemented fully so follow below steps to remove the azure authentication.
- In each AuthenticatorConfiguration element under the AuthenticatorConfigurationCollection element, replace AadAuthenticator with SelfMintedTokenAuthenticator.
- Comment out the AzureActiveDirectoryConfiguration and KeyVaultConfigurations elements.
- In Visual Studio, on the Test menu, point to Windows, and then select Test Explorer
- Right-click your test case, and then select Run selected tests.
- Use the following tips and tricks for single-user testing that uses Task recorder and the Performance SDK:
- Run your business end-to-end scenario first, before you capture it by using Task recorder.
- When you record your scenario by using Task recorder, enter values manually instead of selecting them in drop-down lists.
- Replay your task recording to make sure that everything works as you expect.
- Restart Visual Studio if you don't see your test case after the solution is built
- First step need to update the performance SDK folder in the system environment variables (My computer -> Right click "Properties" -> Advanced system settings -> Advanced -> Environment variables)
- The PerfSDK folder is available in C drive for Local one box, K drive for cloud environment
- Platform update 21 or later version Microsoft using ODBC 17 SQL driver, so download the ODBC 17 SQL server and placed in C:\PerfSDK\Visual studio online tools
- Currently Microsoft not implemented the Azure authentication, so they are authenticating the application using local certificates while performing the load test from local box or azure DevOps.
- Generate the local certificate without password using windows Power shell
- Navigate the following path C:\Program Files (x86)\Windows Kits\8.1\bin\x64\
- Open Windows PowerShell in administrator mode and execute below command
- makecert.exe -n "CN=127.0.0.1" -ss Root -sr LocalMachine -a sha256 -len 2048 -cy end -r -eku 1.3.6.1.5.5.7.3.1 -sky exchange -sv c:\temp\AuthCert.pvk c:\temp\AuthCert.cer
- The Computer name should be 127.0.0.1 (i.e.) CN=127.0.0.1
- Don’t enter any password and click Ok
- Certificates generated and stored in the specified path.
- Copy the ThumpPrint of the certificate and paste it note pad, the value need to update some other files.
- Install the generated certificate(AuthCert) into Manage computer certificates -> Personal -> Certificates folder.
- Copy and paste the generated certificate into PerfSDK folder. This certificate will be uploaded into azure devOps later.
- Once certificate generation is completed need to update the 2 files (Setup,CloudCtuFakeACSInstall) inside the Visual studio online folder
- Open the Setup command file in notepad(Run as administrator mode)
- Update the generated certificate name in the file
- Open CloudQuFakeACSInstall file in notepad (Run as administrator mode)
- AS we generated the certificate without password protection, pass empty string as password.
- Now go to Visual studio and update default test processor architecture from x86 to x64.
- Visual studio -> Test -> Test settings -> Default Processor architecture -> x64
- Update cloud config files with Host name, Soap host name, self SigningCertificateThumprintm, user count, user format (test user), Tenant account and Performance monitor administrator account.
- The test user account and Administrator account should be in same tenant (domain)
- Go to visual studio sample project solutions
- Open VSOnines.testsettings
- Select the Test run locations (from Local computer or azure devops) in General Tab
- if you select local computer, the local computer will be act as test controller
- If you select the Azure devOps, the azure cloud will be act as a test controller
- Enable deployment in deployment tab and add the following folder as per below screenshot.
- Update the 64 bit processor details in Host tab.
- In case of The test location is selected as Azure devOps in "General" tab
- Select the Setup script(C:\PerfSDK\Visual Studio Online\setup.cmd) in "Setup and Cleanup scripts" tab.
- Open SampleLoadTest file from the solution explorer.
- In the TestMix node verfiy all your testing scenarios are added, in this case I have added only one test sceanrio, but in real time we will have multiple test scenarios will be listed.
- Right click the Testmix and click the Edit TestMix
- Here we can specify how many user going to execute the each test case, what is the percentage of each test case.
- In the Run Settings node properties, you can specify the time interval to run the test case, how much time the test should process.
- Once you complete the setup Open the C# class which is generated using task recorder.
- The MS.Dynamics.TestTools.CloudCommonTestUtilities and MS.Dynamics.TestTools.UIHelpers.Core classes need to add as a reference before the class declaration
Task recorder
Generate C# file for performance test from task recorder
.
CloudEnvironment config
file update
Tips
For Multi - user test /
Load test setup
Modify the TestSetup method by adding the following lines to the beginning of the TestSetup() method.
var testroot = System.Environment.GetEnvironmentVariable("DeploymentDir");
if (string.IsNullOrEmpty(testroot))
{
var testroot = System.Environment.GetEnvironmentVariable("DeploymentDir");
if (string.IsNullOrEmpty(testroot))
{
Environment.SetEnvironmentVariable("testroot", testroot);
testroot = System.IO.Directory.GetCurrentDirectory();
}
- In the TestSetup method, uncomment lines in the code titled "for multi-user uncomment following lines", and comment out the following line.
Modify the TestCleanup method so that it resembles the following example.
public void TestCleanup()
{
Client.Close();
Client.Dispose();
Client = Null;
//_userContext.Dispose();
}
Repeat steps for all the C# performance test classes that you have.
- Open WIF configuration file in Notepad(Run as administrator mode) (C:\AosService\webroot\wif.config file
- Add the Thumprint of the certificate which imported earlier step.
- Save and close the file
- Restart the IIS
- Once all steps are completed the environment is ready for performance testing with multiple user
- Go to solution explorer Open SampleLoadTest object
- Run load test
- Enter the values manually when capture scenarios with task recorder
- Maintain scripts for both single and multi-user
- Add workload incrementally
- Use real test users under your tenant during validation stage
Run
the Load test multiple times and compare the value between the test cases
execution
Tips and tricks.
No comments:
Post a Comment