Saturday

How to Write a code Using C# or VB.NET in Teststudio

C# or VB.NET in Test studio


Telerik Test Studio supports code behind files. This allows you to write code and have it executed as a test step. It is for scenarios that require a test step that is more complex than what can be composed with the Verification Builder or the actions provided by the Element Menu.


1.Standalone version: click the "Script Step" button in the "Add" ribbon.

2. Once you have created a coded step, click the "View Class" button to see the entire code behind file.

3.Launch New IE browser and Add elements(objects) with "ADD to Project element" button pane with test studio and click 
4.Element is automatically added to element menu
5.After start writing a code



1. how to launch the application
activebrowser. Navigate To("www.Inforica.com")


2. 'How to set the textboxs in text
syntax:  pages. page name. object name.text.text ="ahamad"
example: Pages.WelcomeToFacebookLogIn.RegPasswdPassword.Text = "1234567"


3.How to parametrization(data driven) username and password(Text Boxes)
syntax:pages.page name.object name.text.text = C Type(System.Convert. ChangeType(Data("row name"), GetType(String)),String)
example:Pages.WelcomeToFacebookLogIn. Username.Text.text = CType(System.Convert.ChangeType(Data("UN"), GetType(String)),String)

example:Pages.WelcomeToFacebookLogIn. Password Text.Text = CType(System.Convert.ChangeType(Data("PWD"), Get Type(String)),String)



4.Data driven for drop downs
1. properties by value
syntax:Pages.page name. Object Name.SelectByValue("21", true)
example: pages.SignUpForFacebook.BirthdayYearSelect.SelectByValue(CType(System.Convert.ChangeType(Data("Year"), GetType(String)),String))
2. Properties by text
suntax:Pages.page name. Object Name.SelectByText("21", true)
example: pages.SignUpForFacebook.BirthdayYearSelect.SelectByText(CType(System.Convert.ChangeType(Data("Year"), GetType(String)),String))
2. Properties by Index
suntax:Pages.page name. Object Name.SelectByIndex("21", true)
example: pages.SignUpForFacebook.BirthdayYearSelect.SelectByIndex(CType(System.Convert.ChangeType(Data("Year"), GetType(String)),String))


5.data driven for check box check and unchecked 
syntax:Pages.page name. Object Name.Check(true, true)  'if want unchecked mention as false
 example:Pages.RegistrationTelerik.PageContentUsercontrolsPublicClientnetClientregistrationAscx1RptSubscriptionsInvitationCkSubscriptionCheckBox1.Check(true, true)
datadriven:Pages.RegistrationTelerik.PageContentUsercontrolsPublicClientnetClientregistrationAscx1RptSubscriptionsInvitationCkSubscriptionCheckBox.Check(CType(System.Convert.ChangeType(Data("check"), GetType(Boolean)),Boolean), true)



6. Data driven for radio button
IF Data("text")=1 THEN
Coded step Male or Female Radio button.click
ELSE
Coded step Male or Female Radio button.click
END IF 
syntax:Pages.Page name.Object name. Men Radio.Check(true, true)
example:Pages.TryitEditorV14. Frame View. Men Radio.Check(CType(System.Convert. Change Type(Data("check"), GetType(Boolean)),Boolean), true)

7.Verification for expected data and actual data
syntax:Pages.GoogleAccounts.GoogleAccountsImage.AssertAttribute().Value("alt", ArtOfTest.Common.StringCompareType.Contains, "Google Accounts")
 data driven for Expected data:
 Pages.GoogleAccounts.GoogleAccountsImage.AssertAttribute().Value(CType(System.Convert.ChangeType(Data("name"), GetType(String)),String), ArtOfTest.Common.StringCompareType.Contains, "Google Accounts")
'desktop Element for right Click 


8.'Desktop command: Left Click on A1Link
Dim A1Link As HtmlAnchor = Pages.TelerikCorporationAbout.A1Link
A1Link.Wait.ForExists(10000)
A1Link.ScrollToVisible(ArtOfTest.WebAii.Core.ScrollToVisibleType.ElementTopAtWindowTop)
A1Link.MouseClick(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference. Absolute Center)
'Desktop command: RightClick on A1Link
Dim A1Link As HtmlAnchor = Pages.TelerikCorporationAbout.A1Link
A1Link.Wait.ForExists(10000)
A1Link.ScrollToVisible(ArtOfTest.WebAii.Core.ScrollToVisibleType.ElementTopAtWindowTop)
A1Link.MouseClick(ArtOfTest.WebAii.Core.MouseClickType.RightClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter)


'9.if want to user for annotation for each execution frame
Manager.Settings.AnnotateExecution = True
activebrowser.NavigateTo("http://www.telerik.com")


10.'This scenario is used to "Entire Script execution speed" i.e "Execution delay"
Syntax: browser.settings. Execution delay ="M seconds"  
Example:
Manager.Settings.AnnotateExecution = True
manager.Settings.ExecutionDelay="400"
activebrowser.NavigateTo("http://www.telerik.com")
pages.NETUIControlsReporting0.YourAccountTmUsercontrolsPublicClientnetLoginnameandstatusAscx1BtnLoginSubmit.Click
pages.ClientLogIn.SectionContentUsercontrolsPublicClientnetSigninformAscx5LoginFormUserNameText.Text="test"


11.This method is used to "moused speed"
syntax:manager.setting.SimulatedMouseMoveSpeed= m sec\pixels
Example:manager.Settings.SimulatedMouseMoveSpeed="0.1"


12. Execution wait time for each element
system.threading.thread.sleep("2000")


13.This method choose the different browser execution
'Manager.Settings.DefaultBrowser = BrowserType.Chrome


14. This method is used to create log files
'manager.Settings.EnableScriptLogging="True"
'manager.Settings.CreateLogFile="True"
'manager.Settings.LogLocation="C:\ahamad"


15. This method is used Capture the browser
'Manager.Log.CaptureBrowser(Manager. Active Browser)


16.This method is used to "Client ready time out" 'i.e 
manager.Settings.ClientReadyTimeout="20000" 'M sec


17.'This method is used to close the any browser automatically
ActiveBrowser.Close() 


18.This method is used to maximize the browser
Activebrowser.Window.Maximize


19.This method is used to minimize the browser
Activebrowser.Window.Minimize


20.Performing your own Annotation
manager.Settings.ExecutionDelay="400"
activebrowser.Annotator.Annotate("Enter the url")
activebrowser.NavigateTo("http://google.co.in")
activebrowser.Annotator.Annotate("CLICK GMAIL LINK")
pages.Google.GmailSpan.Click
activebrowser.Annotator.Annotate("CLICK A CREATE NEW ACCOUNT LINK")
pages.GmailEmailFromGoogle.LinkSignupLink.Click

21.The following method is use to check the whether object is exist or not in page
EXISTMethod :- Pages.TrainingCrestLeadership.ContentPlaceHolder1Login1UserNameText.Wait.ForExists(10000)


22.Enter press
no need add the element in keyboard press .take the Element in before added object
ActiveBrowser.ContentWindow.SetFocus            Pages.RegistrationTelerik.PageContentUsercontrolsPublicClientnetClientregistrationAscx1TxtPhoneText.ScrollToVisible            Pages.RegistrationTelerik.PageContentUsercontrolsPublicClientnetClientregistrationAscx1TxtPhoneText.Focus           ActiveBrowser.Manager.Desktop.KeyBoard.KeyPress(ArtOfTest.WebAii.Win32.KeyBoard.KeysFromString("Enter"), 150, 1)
ActiveBrowser.WaitUntilReady

23.Launch Empty Note pad file or any Exe File

Dim notePad As New System.Diagnostics.Process()
        notePad.StartInfo.FileName = "notepad.exe"
        notePad.StartInfo.Arguments = "D:\myText.txt"
        notePad.Start()

24.Click Simulate Real Click 
based on the element is top position or button position and use the 

Click 'Objectname
ActiveBrowser.Window.SetFocus
Pages.pagename1.Elementname.ScrollToVisible(ArtOfTest.WebAii.Core.ScrollToVisibleType.ElementTopAtWindowTop)
Pages.pagename1.Elementname1.MouseClick

25.Click Simulate Real tying

Pages.pagename1.Elementname1.ScrollToVisible(ArtOfTest.WebAii.Core.ScrollToVisibleType.ElementTopAtWindowTop)
ActiveBrowser.Window.SetFocus
Pages.p
agename1.Elementname1.MouseClick
Manager.Desktop.KeyBoard.TypeText("test", 50, 100)



26.Messagebox
Add DLL:Telerik.window.forms
Messagebox.show("this is urs")




 

How to record a New test & Execute test & Debug

1. Dobble click the new test


2. Click record Option (Ctrl+R



3. Wait for 2 mints internet explorer automatically launching and record pane should display

4. After start recording and once we analyze mode of instances 




6. Enter the URL like www.trainingcrest.in and enter the Username and password

The steps are automatically record in record tab


All the steps are record automatically, when we modify the any steps just click on any and modify



If we change any modification in manually like username and password anything





If we any changes on step like drag and drop 




Click Execute button




After we click execute button .system should automatically execute





When we verify the total log details 


When Step is failed .system should display failed details and log details and failed images expected result and Actual result




Double clicks on failed steps system should display the Step failure window and verify the details and click Image button, verify the Expected result and actual result




Verify the actual image and actual image



If we resolve error .click on resolve failure or Click Element tab and right click on specified element, click Edit element and identify the id or name unique property click ok button


Step 1: Identify the Failure step, Double click and Click element tab ===èClick Edit element

Step 2: Indetify the property (like specified unique property
Step 3: Click “And button
Step 4: After Verify the specified element
Step 5: click on expert View
Step 6: Click ok button





How to Add a new test & Existing test

1. Here two ways to create a new project 1.Click New Test 2.Right click project on mouse select “Add new test”

2. Select the Test type; enter the Test Name and Click Ok button



  
3. New Test Created Successfully



Add Existing test

1. Right Click on project name and Click Add Existing project


2. Browse the existing project





How to Record New Web test & WPF test

1. Launch the test studio and click the Record new test option
2. Click the “Record New Web test option”

3. After system automatically create a new project and New IE browser launching and record menu displayed
4. Create WPF application recording


After we click wpf application, system should navigate to “Configure WPF application path”


How to create a new project in test studio & How to open Existing project


1. Launch Test Studio.
2. Click "Record New Test" and then "Record New Web Test."
Once finish the installing Go to ========èstart menu===èAll programs====èClick Telerik Folder ===èClick “Launch Test studio”


1. Click on Create a new project



2. After clicking a new project, system should display New project window enter the project name and
Location and Click ok button


3. New project successfully created


  
How to open Existing project

1. After creating New project and close the test studio. How to open the already existing project

2. Click the “open existing project” 


Browse the project and click ok button


Existing project display successfully

     

Installation procedure


1.       Enter the http://www.telerik.com/automated-testing-tools.aspx
2.      Click thedownload free trailer” option
3.       Register the email and contact details –click login and enter the username and password
4.       Click the download trial option and enter the Gmail ,automatically link will display the ur account and download
      After you have downloaded the install file, locate it using Windows Explorer and double click it to launch the installer.Click "Read License Agreement," then "OK," then "I Agree - Continue."
c            Click Here
gg


Test studio installation procedure and system requirements

System requirements



XP/Server 2003
Vista
Win7/Server 2008

Minimum
Minimum
Minimum
Disk Space
500 MB
500 MB
500 MB
Processor
1 GHz CPU
1.5 GHz CPU
1.8 GHz CPU
Memory
512 MB
768 MB
1 GB
Display
1024 x 768 or higher-resolution display
1024 x 768 or higher-resolution display
1024 x 768 or higher-resolution display
Browser
IE7,iE8+
IE7, IE8+
IE7, IE8+





Additional requirements: 

Framework: .NET 3.5 SP1
Optional browsers for test execution: Firefox 2.0 or above, Safari 5.0 or above, Chrome 7.0 or above
Test Studio VS plugin has the following additional prerequisite:
IDE: Visual Studio 2008 Professional or above with SP1, or Visual Studio 2010 Professional, or Visual Studio Team Edition 

Overview about test studio


Automated testing tools present their own challenges by being complex to use and are often built to suit the style of software developers more closely than QA engineers. The user interface can resemble the dashboard of a jet cockpit with many controls and windows, but no clear functional path that assists the tester through the process. Traditional automated testing tools are also script-centric and require coding skill to use effectively.Test Studio QA Edition addresses these issues by making tests easy to run and consistent overtime and where results can be shared easily with key players in the organization. Test Studio QA Edition is built to provide deep visibility into elements on a web page and is extensible so that your tools can always handle the latest technology challenges. Test Studio QA Edition is built specifically for QA engineers, without the trappings of complex development environments.Test Studio QA Edition is an automated testing tool that offers an intuitive, codeless and productive way to test any web application. Complex AJAX and Silver light scenarios, MVC, client-side functionality, JavaScript calls, data-driven testing – Test studio covers them all. Test management and failure resolution are brought to a new level, making you more productive.


Test Studio offers two versions:
*      The Standalone version is for QA professionals.
*      The Visual Studio plug-in is for developers wishing to perform functional testing themselves.
1.2 Features
*      Tight Visual Studio Integration
Test Studio is tightly integrated in Visual Studio, allowing users to generate tests as C# or VB.NET code. Native test types ensure first class test support in Visual Studio - both Professional and Team Editions.
*      Powerful test recorder for support desktop and web testing
you no longer need to write all your tests in code from scratch. Test Studio features a convenient recorder that outputs functional tests in code, which you can immediately customize or extend in Visual Studio. This will make you times more productive than before.
*      Test any application – HTML | AJAX | Silver light | WPF | MVC
Test Studio allows you to easily test ASP.NET AJAX and client-side functionality or bind test steps to a data source. It also supports JavaScript function invocation and validation directly from Your .NET code.
*      Cross-browser test execution
Test Studio’s unique browser abstraction saves you loads of time – you don’t need to duplicate your tests for different browsers anymore. You can have your test recorded just once and played on all supported browsers without re-recording: Internet Explorer, Firefox, Chrome, and Safari for Windows
*      Reuse of elements across all tests
all application elements in your tests are abstracted out and filed in the "Elements Explorer". If there are multiple tests that use the same element, the latter is referenced from the “Elements Explorer” instead of being duplicated in the test.
*      Simplifies QA – Developer collaboration
Telerik Test Studio ships with a standalone application aimed at QAs and a Visual Studio plug-in crafted for developers. Both tools use the same repositories and file formats so that QAs can check-in tests in the main project, which developers can then extend with code. In addition, teammates can quickly get an idea what their colleagues have already recorded through the built-in Visual Storyboard tool.
*      The best way to test your applications built with Telerik Controls Thanks to the integrated control translators; you can easily test your Telerik-powered applications. QAs and Developers now have access to exposed validations allowing for specific functionalities to be tested. You can verify HTML and XAML control elements, as well as more complex functionalities such as JavaScript calls, “Wait for AJAX” synchronization points, etc.
*      Silver light Integration
Test Studio 2.0 supports automated testing of Silver light applications, in addition to the product's support for ASP.NET testing. With the addition of Silver light support, testing of a Silver light application can recorded and automated using the Test Studio Design Canvas. Here's a summary of the key new features

Twitter Delicious Facebook Digg Stumbleupon Favorites More