info@yoursite.com

Charles Morrison

Welcome!

This is a paragraph. Double-click to edit. This is a great place for you to add a greeting or a short introduction about yourself. This is a paragraph. Double-click to edit. This is a great place for you to add a greeting or a short introduction about yourself.

  • Programmatically Executing Visual Studio Load Tests

    I use the Windows Batch file below to launch load tests programmatically using mstest.exe.

    This is to programmatically launch VSTS load tests. Also the time date functions are improved.  The script includes a warmup “pre load” test.  Visual Studio has some problems with warm ups and the best solution is to run a test prior to your real load test in order to warm up the application under test.

    <iframe><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">Echo</span> <span style="color: #008800; font-weight: bold">off</span>
     
    <span style="color: #888888">rem /////////////////////////////////////////////////////////////////////////////</span>
    <span style="color: #888888">Rem //</span>
    <span style="color: #888888">Rem //</span>
    <span style="color: #888888">Rem //  Remember that the time of the test is controlled by Visual Studio </span>
    <span style="color: #888888">Rem //</span>
    <span style="color: #888888">Rem //</span>
    <span style="color: #888888">Rem /////////////////////////////////////////////////////////////////////////////</span>


     <span style="color: #008800; font-weight: bold">IF</span> NOT <span style="color: #008800; font-weight: bold">EXIST</span> TestResults <span style="color: #008800; font-weight: bold">md</span> TestResults
     <span style="color: #008800; font-weight: bold">IF</span> NOT <span style="color: #008800; font-weight: bold">EXIST</span> TestResults\Warmups <span style="color: #008800; font-weight: bold">md</span> TestResults\Warmups

     <span style="color: #008800; font-weight: bold">set</span> <span style="color: #996633">Scenario_1</span><span style="color: #333333">=</span>LT_CreateProdMast<span style="color: #6600EE; font-weight: bold">15</span>Variants
     <span style="color: #008800; font-weight: bold">Set</span> <span style="color: #996633">Scenario_01_WarmUp</span><span style="color: #333333">=</span>Perf_App_WS_CreateMasterVariantsDistinct
     <span style="color: #008800; font-weight: bold">set</span> <span style="color: #996633">Scenario_2</span><span style="color: #333333">=</span>ReleaseSharedProduct
     <span style="color: #008800; font-weight: bold">set</span> <span style="color: #996633">NumScenarios</span><span style="color: #333333">=</span><span style="color: #6600EE; font-weight: bold">2</span>
     
    <span style="color: #888888">Rem //////////////////////////////// Scenario # 1 //////////////////////////////////////////////////////////////////////////////////</span>
     <span style="color: #008800; font-weight: bold">set</span> <span style="color: #996633">c</span><span style="color: #333333">=</span><span style="color: #6600EE; font-weight: bold">1</span>
     <span style="color: #997700; font-weight: bold">:Start_Main_Loop</span> 
     <span style="color: #008800; font-weight: bold">call</span><span style="color: #997700; font-weight: bold">:SetDateTime</span>
     <span style="color: #008800; font-weight: bold">echo</span> The Date and Time <span style="color: #333333">=</span> <span style="color: #996633">%dateTime%</span>
     
     <span style="color: #008800; font-weight: bold">echo</span> Loop Count<span style="color: #333333">=</span><span style="color: #996633">%c%</span>
     <span style="color: #008800; font-weight: bold">echo</span>.

     
     <span style="color: #008800; font-weight: bold">echo</span>. Sending Warmup case #<span style="color: #6600EE; font-weight: bold">1</span>
     <span style="color: #008800; font-weight: bold">echo</span>. Executing: mstest /TestContainer:C:\Perf\Cases\DataServicesTests\bin\debug\DataServicesTests.dll /Test:App_WS_CreateMasterVariantsDistinct /resultsfile:TestResults/WarmUps/WarmupNo1_%dateTime%.trx 
     mstest /TestContainer:C:\Perf\Cases\DataServicesTests\bin\debug\DataServicesTests.dll /Test:App_WS_CreateMasterVariantsDistinct /resultsfile:TestResults/WarmUps/WarmupNo1_%dateTime%.trx 
     <span style="color: #008800; font-weight: bold">echo</span>.
     

    Rem: Execute Load Test #<span style="color: #6600EE; font-weight: bold">1</span>
     <span style="color: #008800; font-weight: bold">echo</span> Executing: mstest /TestContainer:C:\Perf\Cases\DataServicesTests\%Scenario_1%.loadtest /resultsfile:TestResults/%Scenario_1%_%dateTime%.trx
     mstest /TestContainer:C:\Perf\Cases\DataServicesTests\%Scenario_02%.loadtest /resultsfile:TestResults/%Scenario_%_%c%_%dateTime%.trx

     

    <span style="color: #888888">Rem ---------- End of Loop ----------------------------------</span>
     
     <span style="color: #008800; font-weight: bold">if</span> <span style="color: #996633">%c%</span><span style="color: #333333">==</span><span style="color: #996633">%NumScenarios%</span> <span style="color: #008800; font-weight: bold">goto</span> <span style="color: #997700; font-weight: bold">The_End</span> 
     <span style="color: #008800; font-weight: bold">set</span> /a c+<span style="color: #333333">=</span><span style="color: #6600EE; font-weight: bold">1</span> 
     sleep <span style="color: #6600EE; font-weight: bold">1</span>
     <span style="color: #008800; font-weight: bold">goto</span> <span style="color: #997700; font-weight: bold">Start_Main_Loop</span> 
     
     
    REM: ////////////////// Subroutines ////////////////////////////////////

     <span style="color: #997700; font-weight: bold">:SetDateTime</span>
     <span style="color: #008800; font-weight: bold">FOR</span> /F <span style="background-color: #fff0f0">&quot;tokens=1,2,3,4 delims=/ &quot;</span> <span style="color: #996633">%%A</span> IN (<span style="background-color: #fff0f0">&#39;Date /T&#39;</span>) <span style="color: #008800; font-weight: bold">DO</span> <span style="color: #008800; font-weight: bold">SET</span> <span style="color: #996633">theDate</span><span style="color: #333333">=</span><span style="color: #996633">%%D</span>-<span style="color: #996633">%%B</span>-<span style="color: #996633">%%C</span>
     <span style="color: #008800; font-weight: bold">FOR</span> /F <span style="background-color: #fff0f0">&quot;tokens=1,2 delims=: &quot;</span> <span style="color: #996633">%%A</span> IN (<span style="background-color: #fff0f0">&#39;TIME/T&#39;</span>) <span style="color: #008800; font-weight: bold">DO</span> <span style="color: #008800; font-weight: bold">SET</span> <span style="color: #996633">theHour</span><span style="color: #333333">=</span><span style="color: #996633">%%A</span>
     <span style="color: #008800; font-weight: bold">FOR</span> /F <span style="background-color: #fff0f0">&quot;tokens=2 delims= &quot;</span> <span style="color: #996633">%%A</span> IN (<span style="background-color: #fff0f0">&#39;TIME/T&#39;</span>) <span style="color: #008800; font-weight: bold">DO</span> <span style="color: #008800; font-weight: bold">SET</span> <span style="color: #996633">AMPM</span><span style="color: #333333">=</span><span style="color: #996633">%%A</span>

     <span style="color: #008800; font-weight: bold">FOR</span> /F <span style="background-color: #fff0f0">&quot;tokens=1-4 delims=:.&quot;</span> <span style="color: #996633">%%a</span> in (<span style="background-color: #fff0f0">&quot;%time%&quot;</span>) <span style="color: #008800; font-weight: bold">do</span> <span style="color: #008800; font-weight: bold">set</span> <span style="color: #996633">HH</span><span style="color: #333333">=</span><span style="color: #996633">%%a</span> &amp; <span style="color: #008800; font-weight: bold">set</span> /a MM<span style="color: #333333">=</span><span style="color: #6600EE; font-weight: bold">100</span><span style="color: #996633">%%b</span> %% <span style="color: #6600EE; font-weight: bold">100</span> &amp; <span style="color: #008800; font-weight: bold">set</span> /a SS<span style="color: #333333">=</span><span style="color: #6600EE; font-weight: bold">100</span><span style="color: #996633">%%c</span> %% <span style="color: #6600EE; font-weight: bold">100</span> &amp;<span style="color: #008800; font-weight: bold">set</span> /a MS<span style="color: #333333">=</span><span style="color: #6600EE; font-weight: bold">100</span><span style="color: #996633">%%d</span> %% <span style="color: #6600EE; font-weight: bold">100</span>
     <span style="color: #008800; font-weight: bold">set</span> <span style="color: #996633">dateTime</span><span style="color: #333333">=</span><span style="color: #996633">%theDate%</span>_<span style="color: #996633">%AMPM%</span>_<span style="color: #996633">%theHour%</span>_<span style="color: #996633">%MM%</span>_<span style="color: #996633">%SS%</span>_<span style="color: #996633">%MS%</span>
     

     <span style="color: #997700; font-weight: bold">:The_End</span>
    <span style="color: #888888">Rem echo The_End.... </span>
    </pre></div>

    </iframe>
     



This website is created and hosted by Website.com's Site Builder.