Thursday 27 August 2015

Enabling Coded UI Test playback logs in Visual Studio 2013

Coded UI Tests can fail for a number of reasons, producing detailed logs that can be used to rapidly identify what caused the failure.To enable this level of detail in the test results, open explorer and go to the following folder.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\
In this location you will find QTAgent32.exe.config. Before opening files in this directory, be sure that you have the permissions to edit and save files.
Locate the following section in the configuration file and set the “EqTraceLevel” to 4.
<system.diagnostics>
  <switches>
    <!-- You must use integral values for "value".
          Use 0 for off, 1 for error, 2 for warn, 3 for info, and 4 for verbose. -->
    <add name="EqtTraceLevel" value="4" />
  </switches>
</system.diagnostics>
Then scroll down to the appSettings section and a key “EnableHttpLogger” with a value of “true”. Then add another key “EnableSnapshotInfo” with a value of “true
  <appSettings>
 
    <add key="EnableSnapshotInfo" value="true"/>
    <add key="EnableHttpLogger" value="true"/>
 
    <add key="StopTestRunCallTimeoutInSeconds" value="5"/>
    <add key="LogSizeLimitInMegs" value="20"/>
    <add key="CreateTraceListener" value="no"/>
    <add key="GetCollectorDataTimeout" value="300"/>
  </appSettings>



Now when you run a codedUI Test you will see there is an output link in the Test Explorer results
Which in turn will take you to the Test output containing the UITestActionLog.html
Which contains the CodeUI Test Log

Monday 24 August 2015

Cross Browser Testing with CodedUI


Content:

1, Instal the CodedUI Test Cross Browser Plugin

2, Coding Change for Cross Browser Testing

3, Hand Coding for Maximize the Browser Window

 

1, Instal the CodedUI Test Cross Browser Plugin:

1,The Plugin will be downloaded as part of the VS update.

Steps : Open VS 2013 -> Tools -> Extensions and Updates -> Click Online

 
2,The Plugin also be downloaded from following link
3,The extension will be installed in the common file directory of your local machineC:\Program Files (x86)\Common Files\Microsoft Shared\VSTT”
 2, Coding Change for Cross Browser Testing
1, Create the Test Initialize method called MyTestInitialize().
2, Change the Current Browser Property of Browser window class.
Eg: BrowserWindow.CurrentBrowser = ”Chrome”
      BrowserWindow.CurrentBrowser = ”Firefox”
 
3, Hand Coding for Maximize the Browser Window
Cross browser does not support the default “Maximize”. So we want to write      the hand coding to Maximize the browser window.
A, Create object for Browser window class
B, Give the URL to launch the website when Browser window open
C, Maximize the Browser Window
 
 
 
 

Wednesday 22 July 2015

VB Naming Convention for Coded UI Test Automation

Naming Convention details for our reference:


Project Name: Module Name
Eg: "Talentoz.Test.Core"






  Folder Name: Sub Module as Folder
    Eg: "EPM"






        File Name: Project.Test.Functionality
        Eg: "manageemployee"




            Class Name: ClsFunctionality
            Eg: "ClsManageEmployee"




                Test Method Name: Mtdtestobjective
                Eg: "Mtdaddemployee"




                    Step Method Name: Actionname
                    Eg: "Loginasemployee"




                        Parameter Name: pdataname
                        Eg: "pEno"


Monday 20 July 2015

Coded UI Automation Training Tutorial

1)Add Browser Automation to Your Unit Tests With Selenium | Pluralsight
https://www.youtube.com/watch?v=UXzpzRkeODc


2)https://www.youtube.com/watch?v=Yp3YrG1Zmqk
CodedUI Cross Browser Demo


3)Cross Browser Testing with Coded UI Testing -- Part 26 (CUIT Video Series)
https://www.youtube.com/watch?v=jcELt9WWuqA

4)Taking Data Driven Web Testing For A Spin with Test Studio
https://www.youtube.com/watch?v=UY9c5dj4Ces

5)Test Automation with Microsoft Visual Studio 2010: Coded UI Tests and Lab Management
https://www.youtube.com/watch?v=rZ8Q5EJ2bQM


6)Test Impact Analysis with Team Foundation Server | Pluralsight
https://www.youtube.com/watch?v=GVb00RCoBlU


7)Test Your Unit Tests with Intellitrace
https://www.youtube.com/watch?v=C6hl8txBGcc


8)Using CSV, XML & SQL data for test automation | Pluralsight
https://www.youtube.com/watch?v=nsF-yZXC8TY


9)Visual Studio 2012 Test Explorer: Continuous Testing, Testing Triangle and multi-targeted testing
https://www.youtube.com/watch?v=y6KTlywXZZE

Wednesday 8 July 2015

How have Multiple Test in a VB file

Multiple Test in a File

Steps to Create Multiple Test in a Coded UI Test File -

1) Create a Coded UI Test File

2) Copy the automatic loaded file and paste below end class

3) Rename created class and method

4) Create required coded UI test

5) Select sub method and run

Friday 3 July 2015

Methods to Create CSV File to Pass Parameter in CodedUI and to integrate in code

Content:

1.      Create Test and Set Data

A.     Create Record and Assertion method

B.      Move Created methods from UIMap.Designer to UIMap.vb file

C.      Create CSV file

D.     Change Property settings for CSV file

E.      Add parameter values

F.       Save the CSV file through Advanced Save option

2.      Pass the input parameter from CSV file to Recorded Method

A.     Create Data source.

B.      Find Text value

C.      Assign the CSV file value to Text value in main method

3.      Pass the Expected value from CSV file to Assertion Method

A.     Declare data as string for assign the CSV file value

B.      Create object for the main class

C.      Call the data through the object

D.     Pass the data to Expected values

1-A : Record and Playback method created for

1, Login as User

2, Check Assertion for Username

3, Logout


1-B : Move Method from UI.Designer file to UI.VB file for editing the Method

Double Click on UIMap.uitest -> Right Click on Method -> Select Move Code to UIMap.cs/vb

1-C : Method for Create CSV file to pass parameter

Right Click on Project -> Add -> New Item

Model Window opened for Add New Item

General -> Text File -> Rename as Sample.csv -> Add
CSV File Got Created under the Project

1-D  : Change the Property Settings for CSV file

Right Click on CSV File -> Properties -> Copy to Output = Copy if newer

1-E,F : Save the CSV File

1, create the Parameter and Pass the value

2, Go to File -> Select Advanced Save Option -> Select Unicode (UTF-8 without Signature) – Code Page 65001 -> OK


2-A : Pass CSV file value through Data Source

1, Declare property for Employee name

2, Create Data source

3, Pass Data from CSV file to Property

2-B : Methods to change the Recorded code to pass the Parameter value

GO To Method SubLoginAdmin :

To Verify the Text Value:
2-C : Assigned the value for Username and Password
3 :  Pass the CSV file parameter value as Expected value in Assertion Method:

1, Create object for the class

2, Call the data through the object
3, Pass the Expected value for EmpName from csv file

Wednesday 3 June 2015

Coded UI Test Automation Learning Log

Dear Friends,

In recent days we are trailing, exploring and learning more in Automation Testing using Coded UI Test Automation. With that note I am creating this learning log post for us to share learned items and gain more information on CUITe. Thank you Suganya M from my team in consolidating this log list and Special thanks for those of my team and other who are going to contribute a lot into this.

View the Learning Log till now from our QA Team...

# Defect knowledge sharing
# Cloud Computing
# Usability Testing
# Visual Basic
# Coded UI Test Automation and lot more to come...

In line to this we are moving forward with a complete automation testing as a solution for better Product Quality and Competency this year. Though these are basic stuff but the initiative and support shown is excellent which helped in sharing and learning new things.



Herewith I have list few of our learned and few for our learning item...

Reference Link:
http://executeautomation.com/blog/functional-tools/visual-studio-coded-ui/


# How to create CodedUI project?
--New Project -> Visual Basic/C#  -> Test -> CodedUI Test Project
# How to Create Automation Test from existing recorded test case method?
--open CodedUItest.vb file -> Right click in the page  -> Generate Code for CodedUI test -> Use Existing Action Recording 
# How to Create Automation Test from new CodedUI record and playback?
--open CodedUItest.vb file -> Right click in the page  -> Generate Code for CodedUI test -> Use CodedUI test builder 
# How to Create New Assertion ?
--CodedUI test builder-> Drag Cross hair -> create new Assertion
# How to Create multiple Assertion in a single method?
--CodedUI test builder-> Drag Cross hair -> create multiple Assertion -> Generate Method
# How to Reuse Assertion within same method?
--Call Assertion method whenever to check that validation
# Code Reusability -> Frequently called methods group into single method ?
--Frequently used methods can group in to single method then we call it whenever we want
# Scroll bar not readable while record?
--Coded ui not consider the scroll bar option. With out scroll the page it can able to detect the clickable element in the page 
# Unable to delete the code getting Regenerate?
--Delete the unwanted code in the class "UIMap.uitest"
# How to Rename the method?
--If we want to rename the method, it can be done in the place where the method got generate.
Eg: Rename the recorded method in UIMap.Designer file
# How to remove the model window default save password in IE browser?
--Open IE -> Tools -> Internet Option -> Content Tab -> Uncheck Username & Password -> ok
# What are the default files created in CodedUI project?
--While create coded UI project by default CodedUI files & 3 UI files got created.
1,CodedUItest.vb/CodedUItest.c#  - Class,Methods
2,UiMap.UITest - XML File
3,UIMap.vb/UIMap.Cs
4,UIMap.Designer.vb/UIMap.Designer.cs
# How to generate method from recording?
--Do the above steps -> CodedUI builder got opened -> Click record button -> Record the action -> click pause button -> click generate code button
# Unable to Read Controls
Eg:Combo expandable issue?
AM Chart

# Error: System.Runtime.InteropServices.COMException will be show while run upon mouse click same from and to date in datepicker. To avoid the To date can be a keyed in.

# How to Edit assertion method and reuse in another method?
# Unable to automate the auto increment employee id while create new employee?
# While Run Test , exception not get handled in assertion error occurred?
# Unable to built some CodedUI project?
# Unable to read "User name" input field in Login page?
# How to Put Policy for Automatic Code Generate?
# Unable to create Assertion for Grid?
# Unable to read role card in user while record?
# Copy file and paste in to another project ?
# Create Assertion for icon and background color?
# How to manage feature action based test.
Eg: Pending Request(Color Change)?
# Action Delay , Method Delay , Partial Execution?
# How to Order Playlist?
http://blogs.msdn.com/b/slange/archive/2010/06/02/ordering-method-execution-of-a-coded-ui-test.aspx
# How to Split / Modify Method?
# Create Assertion for multiple parameter?
# Analyze Test Context - Property?
# Manual Coded Element (Click,Type,Assertion,Sub-Method,Class)?
# Analyze Coded UI Execution method?
# Naming Conversion for of the following?
1, VB file
2, Class
3, Main Method
4,Assertion Method
# How to regenerate the deleted method in UITest Map?
# How to eliminate mouse actions from code?



Thank You.
Sampath kumar Mohan

Tuesday 2 June 2015

First Post...

letstryitin.blogspot.in a blog created with the purpose of share information, momentum, learnings to gain and grow as a team. I would like to thank Mr. Ram kumar Elangovan for Insisting a blog and pushing me to new height as always he does. Whenever I see a new thing it reminds me Mr. Premnath Kannan who is always at my back.

As we learning new things, we can use this to share input and comments with real world. Let's share and express our talents to learn and perform better together as a team.

So Let's Do It friends.








Thank You.
Sampath kumar Mohan