Thursday, January 31, 2019

[CodedUI] MS batch file example to run Web Performance Test

@echo off


Rem ________________________________________________________________________________________________
Rem
Rem Select Windows Version
Rem
Rem ________________________________________________________________________________________________

rem MS Windows version 10.0.14393
rem set CURRENT_DATE=%date:~10,4%%date:~4,2%%date:~7,2%
rem MS Windows version 10.0.10586

 set CURRENT_DATE=%date:~6,4%%date:~0,2%%date:~3,2%

echo %CURRENT_DATE%

Rem ________________________________________________________________________________________________
Rem
Rem       Define Project Folders, the Exe file and Test result and logfile folders
Rem               TextExeFileProd = WebTestProd.webtest    - check Production sites only
Rem            TestExeFileAll  = WebTestAll.webtest     - check all sites including Test and Staging
Rem 
Rem ________________________________________________________________________________________________

set exeDir=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE
set ProjDir=C:\TestProject

set TestExeFileProd=%ProjDir%\WebAndLoadTestProject1\WebTestProd.webtest
set TestExeFileAll=%ProjDir%\WebAndLoadTestProject1\WebTestAll.webtest

set TestResultDir=%ProjDir%\TestResults\

set TestLogDir=\WebTest\TestResults\%CURRENT_DATE%\

Echo Creating %TestLogDir%

IF NOT EXIST "%TestLogDir%" (mkdir "%TestLogDir%")

echo Project Folder= %ProjDir%


Rem ________________________________________________________________________________________________
Rem
Rem       Cleanup the subfolders in Test LOG Folder
Rem
Rem ________________________________________________________________________________________________

pushd %TestLogDir%

 FOR /D %%P IN ("*HQ*") DO ECHO DELETING "%%P" & IF EXIST "%%P" RD /S /Q "%%P"

Rem ________________________________________________________________________________________________
Rem
Rem        Cleanup Test Log Folder and delete existing files
Rem 
Rem ________________________________________________________________________________________________

Echo Cleaning up %TestLogDir%

IF EXIST "%TestLogDir%\*" ( DEL /Q "%TestLogDir%\*" )


Rem ________________________________________________________________________________________________
Rem
Rem       Execute Test for Prod and All and Create a TestResult Log file
Rem               TextExeFileProd = WebTestProd.webtest    - check Production sites only
Rem            TestExeFileAll  = WebTestAll.webtest     - check all sites including Test and Staging
Rem ________________________________________________________________________________________________

Echo Executing %TestExeFileProd%

 "%exeDir%"\MSTest.exe /testcontainer:"%TestExeFileProd%" /resultsfile:"%TestLogDir%\testResultsProd.trx" > "%TestLogDir%"\TestResultsProd_%CURRENT_DATE%.log

Echo Executing "%TestExeFileAll%"

 "%exeDir%"\MSTest.exe /testcontainer:"%TestExeFileAll%" /resultsfile:"%TestLogDir%\testResultsAll.trx" > "%TestLogDir%"\TestResultsAll_%CURRENT_DATE%.log


Rem ________________________________________________________________________________________________
Rem
Rem     Move the Test Result file to Test LOG FOLDER
Rem
Rem ________________________________________________________________________________________________

Echo Moving Test Result file to %TestLodDir%

pushd  %TestLogDir%

FOR /R "%TestLogDir%" %%X IN (WebTestProd.webtestResult) do (IF EXIST "%%X" ECHO "%%X" & IF EXIST "%%X" copy "%%X" "%TestLogDir%\")

FOR /R "%TestLogDir%" %%X IN (WebTestAll.webtestResult) do (IF EXIST "%%X" ECHO "%%X" & IF EXIST "%%X" copy "%%X" "%TestLogDir%\")


Rem ________________________________________________________________________________________________
Rem
Rem       Cleanup the subfolders in Test LOG Folder again
Rem
Rem ________________________________________________________________________________________________

pushd %TestLogDir%

 FOR /D %%P IN ("*HQ*") DO ECHO DELETING "%%P" & IF EXIST "%%P" RD /S /Q "%%P"


Rem ________________________________________________________________________________________________
Rem
Rem     Run the powershell script to send an email
Rem
Rem ________________________________________________________________________________________________

Powershell.exe -executionpolicy remotesigned -File  SendEmailWebTestResult.ps1


popd


















[DOS] Call more than one command in For Loop



Add '&'

here is an example:

FOR /D %%P IN ("*HQ*") DO ECHO DELETING "%%P" & PAUSE & IF EXIST "%%P" RD /S /Q "%%P"

Monday, January 28, 2019

Friday, January 25, 2019

[Visual Studio] How to actually search all files in Visual Studio






I think you are talking about ctrl + shift + F, by default it should be on "look in: entire solution" and there you go.


Thursday, January 17, 2019

[SSMS] Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF



Server: Msg 544, Level 16, State 1, Line 1 Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF. 



 
SET IDENTITY_INSERT [AllAppsUITest].[dbo].[TestEnvironment] ON


Then Insert

 
/* Turn Identity Insert ON so records can be inserted in the Identity Column  */
SET IDENTITY_INSERT [dbo].[TableName] ON
GO
INSERT INTO [dbo].[TableName] ( [ID], [Name] )
VALUES ( 2, 'InsertName')
GO
/* Turn Identity Insert OFF  */
SET IDENTITY_INSERT [dbo].[TableName] OFF
GO

[Excel] Scroll Locked - Arrow Key not moving




Turning off scroll lock without the keyboard key

Windows 10 users
  1. Press the Windows key.
  2. Type on-screen keyboard and press Enter.
  3. When the on-screen keyboard appears, click the ScrLk button.

Tuesday, January 15, 2019

[MS Word] Font Size




Calibri 
Font size 11
Font size 14
Font size 18
Font size 24
Font size 36
Font size 48
Font size 72

Wednesday, January 9, 2019

[Coded UI] find matching control for wintabpage



           BrowserWindow br = new BrowserWindow();

            WinTabPage page = new WinTabPage(br);

            MessageBox.Show(page.FindMatchingControls().Count.ToString());

            foreach (WinTabPage pg in page.FindMatchingControls())
            {
                MessageBox.Show(pg.FriendlyName.ToString());
                Console.WriteLine(pg.FriendlyName.ToString());
            }



If the browser window is not specified, it finds a lot of tabs including VS, and every opened apps.

Tuesday, January 8, 2019

[Coded UI] ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded



System.InvalidOperationException
  HResult=0x80131509
  Message=The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>