diff --git a/docs-apitesting/advanced-topics/ci-server-integration.md b/docs-apitesting/advanced-topics/ci-server-integration.md index 333e126f..e29c114e 100644 --- a/docs-apitesting/advanced-topics/ci-server-integration.md +++ b/docs-apitesting/advanced-topics/ci-server-integration.md @@ -4,7 +4,7 @@ page_title: CI Server Integration description: "Progress® Test Studio® for APIs - CI Server Integration" previous_url: /api-testing/advanced-topics position: 1 -publish: true +published: true --- # CI Server Integration @@ -14,7 +14,7 @@ Continuous Integration regularly integrates the individual developer's changes i Thanks to its command line interface, Test Studio for APIs can easily be integrated in most famous CI Servers. {% if site.has_cta_panels == true %} -{% include cta-panel-teststudio-overview.html %} +{% include cta-panel-overview.html %} {% endif %} ## Jenkins Integration diff --git a/docs-apitesting/advanced-topics/configure-custom-proxy.md b/docs-apitesting/advanced-topics/configure-custom-proxy.md index a3860c73..e5b2dbb7 100644 --- a/docs-apitesting/advanced-topics/configure-custom-proxy.md +++ b/docs-apitesting/advanced-topics/configure-custom-proxy.md @@ -3,7 +3,7 @@ title: Configure Custom Proxy page_title: Configure Custom Proxy description: "Progress® Test Studio® for APIs - CI Server Integration" position: 2 -publish: true +published: true --- # Overview diff --git a/docs-apitesting/docs-builder.yml b/docs-apitesting/docs-builder.yml new file mode 100644 index 00000000..57da6c44 --- /dev/null +++ b/docs-apitesting/docs-builder.yml @@ -0,0 +1,67 @@ +#top nagivation might be wrong +top-navigation-product: api-testing +path-prefix: /teststudio-apis/documentation +product-id: 1720 +product-name: Telerik Test Studio for APIs +product-url: https://www.telerik.com/teststudio-apis +search-engine-id: 001595215763381649090:lxlmtcw2g-u +cta-overview: "@ProductLink is a test automation platform for web, WPF, and responsive web applications, supporting UI, functional, load, and RESTful API testing. Sign up for a free 30-day trial!" +cta-intro: "@ProductLink is a test automation platform for web, WPF, and responsive web applications, supporting UI, functional, load, and RESTful API testing. Sign up for a free 30-day trial!" +default-title-prefix: Telerik Test Studio for APIs +avatar-path: ./images/avatar-ninja.svg +no-results-image-path: ./images/ninja-no-results.svg +primary-color: + light: "#1D8800" + dark: "#68BF51" + +product-code: TESTSTUDIOAPI +product-trial-url: https://www.telerik.com/try/test-studio-ultimate +contribute-url: https://github.com/telerik/teststudio-docs/edit/master/docs-apitesting +enable-tabbed-code-blocks: true +#pdf-cover-png-path: ./images/pdf-cover.png +img-max-width: 100% +table-layout: fixed + + +meta: +# === Test Studio for APIs Documentation Main Nodes === + getting-started: + title: "Getting Started" + position: 2 + features: + title: "Features" + position: 3 + advanced-topics: + title: "Advanced Topics" + position: 4 + troubleshooting-guide: + title: "Troubleshooting Guide" + position: 5 + +# Features Section + features/steps: + title: "Steps" + position: 1 + features/code-features: + title: "Code Features" + position: 2 + features/record: + title: "Record" + position: 3 + features/command-line: + title: "Command Line Interface" + position: 4 + +redirects: +- + from: "^/?$" + to: "/" +- + from: "^/overview$" + to: "/" +- + from: "^/features/authorization/basic-authorization$" + to: "/features/steps/http-request#authorization" +- + from: "^/features/import/http-traffic$" + to: "/features/record/import-http-traffic" \ No newline at end of file diff --git a/docs-apitesting/features/code-features/add-assembly-reference.md b/docs-apitesting/features/code-features/add-assembly-reference.md index 2a1dcb14..c306274c 100644 --- a/docs-apitesting/features/code-features/add-assembly-reference.md +++ b/docs-apitesting/features/code-features/add-assembly-reference.md @@ -3,7 +3,7 @@ title: Add Assembly Reference page_title: Add Assembly Reference description: "Progress® Test Studio® for APIs - Code Features - Add Assembly Reference" position: 8 -publish: true +published: true --- # Add Assembly Reference diff --git a/docs-apitesting/features/code-features/code-behind-files.md b/docs-apitesting/features/code-features/code-behind-files.md index f7feeead..327bd926 100644 --- a/docs-apitesting/features/code-features/code-behind-files.md +++ b/docs-apitesting/features/code-features/code-behind-files.md @@ -3,7 +3,7 @@ title: Code-Behind Files page_title: Code-Behind Files description: "Progress® Test Studio® for APIs - Code Features - Code-Behind Files" position: 2 -publish: true +published: true --- # Code-Behind Files @@ -44,7 +44,7 @@ The example below shows hot to log messages to the test output before and after ![Base Test Methods][4] -```C# +````C# // This method will execute before the start of the test case public override void OnBeforeTestStarted() { @@ -56,9 +56,8 @@ public override void OnAfterTestCompleted() { this.Log.WriteLine("Ending the test case ..."); } -``` - -```VB +```` +````VB ' This method will execute before the start of the test Case' Public Overrides Sub OnBeforeTestStarted() Log.WriteLine("The test case is starting ...") @@ -68,7 +67,7 @@ End Sub Public Overrides Sub OnAfterTestCompleted() Log.WriteLine("Ending the test case ...") End Sub -``` +```` [Back to top](#Code-Behind-Files) @@ -94,7 +93,7 @@ The **Context.SetValue** method sets a value to a runtime variable. You can stor #### Examples -```C# +````C# // This statement will create a variable named "user-name" with value "user1" // in the scope of the current test case this.Context.SetValue("user-name", "user1", o); @@ -102,9 +101,8 @@ this.Context.SetValue("user-name", "user1", o); // This statement will create a variable named "user-id" with value 123 // in the root scope of the project this.Context.SetValue("user-id", 123, 1); -``` - -```VB +```` +````VB // This statement will create a variable named "user-name" with value "user1" // in the scope of the current test case this.Context.SetValue("user-name", "user1", 0); @@ -112,7 +110,7 @@ this.Context.SetValue("user-name", "user1", 0); // This statement will create a variable named "user-id" with value 123 // in the root scope of the project this.Context.SetValue("user-id", 123, 1); -``` +```` [Back to top](#Code-Behind-Files) @@ -135,19 +133,18 @@ The **Context.GetValue** method returns the value of a specified runtime variabl #### Examples -```C# +````C# string userName = this.Context.GetValue("user-name").ToString(); -``` - -```VB +```` +````VB Dim userName As String = Context.GetValue("user-name").ToString() -``` +```` > Remember to cast properly your variables when using Context.GetValue. The method returns an object and you need to be aware of where and how the target value was initially created. Any variable, created manually in the Variables pane in the UI, is stored as a string. ![Casting Variables][5] -```C# +````C# int count = 5; this.Context.SetValue("count", count, 0); @@ -164,7 +161,7 @@ this.Log.WriteLine(newUserId.ToString()); // The "user-name" variable is stored as string, but you still need to convert it with .ToString() string userName = this.Context.GetValue("user-name").ToString(); this.Log.WriteLine(userName); -``` +```` [Back to top](#Code-Behind-Files) @@ -180,13 +177,12 @@ The **ApiTestBase** base class exposes a **Log** property of type **ILog** which #### Examples -```C# +````C# this.Log.WriteLine("Logging some message from C# code ..."); -``` - -```VB +```` +````VB Log.WriteLine("Logging some message from VB code ...") -``` +```` > See the [Sample Project](../../getting-started/sample-project) for more examples. @@ -198,7 +194,7 @@ The Telerik.ApiTesting.Framework namespace provides a basic assertion framework The following methods ae available: -```C# +````C# static void AreEqual(T expected, T actual); static void AreEqual(T expected, T actual, string message); @@ -226,9 +222,8 @@ static void IsNull(object value, string message); static void IsTrue(bool condition); static void IsTrue(bool condition, string message); -``` - -```VB +```` +````VB Shared Sub AreEqual(Of T)(expected As T, actual As T) Shared Sub AreEqual(Of T)(expected As T, actual As T, message As String) @@ -256,19 +251,18 @@ Shared Sub IsNull(value As Object, message As String) Shared Sub IsTrue(condition As Boolean) Shared Sub IsTrue(condition As Boolean, message As String) -``` +```` > When an assertion fails, the execution of the test step will be terminated with status **failed** and the assertion message will be logged to the test output. ### Examples -```C# -Assert.AreEqual("administrator", actualValue); -``` - -```VB +````C# Assert.AreEqual("administrator", actualValue); -``` +```` +````VB +Assert.AreEqual("administrator", actualValue) +```` ![Assertion Error][6] diff --git a/docs-apitesting/features/code-features/code-items.md b/docs-apitesting/features/code-features/code-items.md index f249bb95..d292677c 100644 --- a/docs-apitesting/features/code-features/code-items.md +++ b/docs-apitesting/features/code-features/code-items.md @@ -3,7 +3,7 @@ title: Code Items page_title: Code Items description: "Progress® Test Studio® for APIs - Code Features - Code Items" position: 3 -publish: true +published: true --- # Code Items diff --git a/docs-apitesting/features/code-features/coded-steps.md b/docs-apitesting/features/code-features/coded-steps.md index 912ef140..885634b3 100644 --- a/docs-apitesting/features/code-features/coded-steps.md +++ b/docs-apitesting/features/code-features/coded-steps.md @@ -3,7 +3,7 @@ title: Coded Steps page_title: Coded Steps description: "Progress® Test Studio® for APIs - Code Features - Coded Steps" position: 1 -publish: true +published: true --- # Coded Steps diff --git a/docs-apitesting/features/code-features/compile-project.md b/docs-apitesting/features/code-features/compile-project.md index f20d34e7..6ba70b13 100644 --- a/docs-apitesting/features/code-features/compile-project.md +++ b/docs-apitesting/features/code-features/compile-project.md @@ -3,7 +3,7 @@ title: Compile Project page_title: Compile Project description: "Progress® Test Studio® for APIs - Code Features - Compile Project" position: 5 -publish: true +published: true --- # Compile Project diff --git a/docs-apitesting/features/code-features/debug-project.md b/docs-apitesting/features/code-features/debug-project.md index 6a47c736..2de5a561 100644 --- a/docs-apitesting/features/code-features/debug-project.md +++ b/docs-apitesting/features/code-features/debug-project.md @@ -3,7 +3,7 @@ title: Debug Project page_title: Compile Project description: "Progress® Test Studio® for APIs - Code Features - Debug Project" position: 6 -publish: true +published: true --- # Debug Project @@ -12,13 +12,12 @@ When a test project is compiled, Progress® Test Studio® for APIs generates a * To launch the debugger in Visual studio, you can add a `Debugger.Launch()` statement in the code that you wish to debug. (You wll need a `using System.Diagnostics` statement too.) -```C# -`Debugger.Launch(); -``` - -```VB -`Debugger.Launch()` -``` +````C# +Debugger.Launch(); +```` +````VB +Debugger.Launch() +```` ![Add Debug Statement][1] diff --git a/docs-apitesting/features/code-features/output-panel.md b/docs-apitesting/features/code-features/output-panel.md index 680e8d88..a0a3181d 100644 --- a/docs-apitesting/features/code-features/output-panel.md +++ b/docs-apitesting/features/code-features/output-panel.md @@ -3,7 +3,7 @@ title: Output Panel page_title: Output Panel description: "Progress® Test Studio® for APIs - Code Features - Output Panel" position: 7 -publish: true +published: true --- # Output Panel diff --git a/docs-apitesting/features/code-features/overview.md b/docs-apitesting/features/code-features/overview.md index 77e5ea82..68f403b4 100644 --- a/docs-apitesting/features/code-features/overview.md +++ b/docs-apitesting/features/code-features/overview.md @@ -3,7 +3,7 @@ title: Overview page_title: Overview description: "Progress® Test Studio® for APIs - Code Features - Overview" position: 0 -publish: true +published: true --- # Code Features Overview diff --git a/docs-apitesting/features/code-features/project-coding-language.md b/docs-apitesting/features/code-features/project-coding-language.md index 4aeca5a5..4db00916 100644 --- a/docs-apitesting/features/code-features/project-coding-language.md +++ b/docs-apitesting/features/code-features/project-coding-language.md @@ -3,7 +3,7 @@ title: Project Coding Language page_title: Project Coding Language description: "Progress® Test Studio® for APIs - Code Features - Project Coding Language" position: 4 -publish: true +published: true --- # Project Coding Language diff --git a/docs-apitesting/features/command-line/command-line-parameters.md b/docs-apitesting/features/command-line/command-line-parameters.md index 1c652c05..682c364f 100644 --- a/docs-apitesting/features/command-line/command-line-parameters.md +++ b/docs-apitesting/features/command-line/command-line-parameters.md @@ -3,7 +3,7 @@ title: Command Line Parameters page_title: Command Line Parameters description: "Progress® Test Studio® for APIs - Command Line Parameters" position: 1 -publish: true +published: true --- # Command Line Parameters diff --git a/docs-apitesting/features/command-line/overview.md b/docs-apitesting/features/command-line/overview.md index 6c0ae1e2..f0c774f3 100644 --- a/docs-apitesting/features/command-line/overview.md +++ b/docs-apitesting/features/command-line/overview.md @@ -3,14 +3,14 @@ title: Overview page_title: Overview description: "Progress® Test Studio® for APIs - Command Line Interface - Overview" position: 0 -publish: true +published: true --- # Command Line Interface - Overview Test Studio for APIs provides a Command Line Interface application (Telerik.ApiTesting.Runner.exe) that you can use to directly execute an existing test project without using the application's user interface. {% if site.has_cta_panels == true %} -{% include cta-panel-teststudio-overview.html %} +{% include cta-panel-overview.html %} {% endif %}
diff --git a/docs-apitesting/features/condition.md b/docs-apitesting/features/condition.md index 93df3cb8..13ca00cd 100644 --- a/docs-apitesting/features/condition.md +++ b/docs-apitesting/features/condition.md @@ -3,7 +3,7 @@ title: Condition page_title: Condition description: "Progress® Test Studio® for APIs - Condition" position: 0 -publish: true +published: true --- # Condition diff --git a/docs-apitesting/features/project-explorer.md b/docs-apitesting/features/project-explorer.md index fb60ce94..201da63d 100644 --- a/docs-apitesting/features/project-explorer.md +++ b/docs-apitesting/features/project-explorer.md @@ -3,7 +3,7 @@ title: Project Explorer page_title: Project Explorer description: "Progress® Test Studio® for APIs - Project explorer functionality" tags: project, explorer, mobile -publish: true +published: true position: 0 --- diff --git a/docs-apitesting/features/record/http-traffic.md b/docs-apitesting/features/record/http-traffic.md index 95a8ceac..c9cebf1e 100644 --- a/docs-apitesting/features/record/http-traffic.md +++ b/docs-apitesting/features/record/http-traffic.md @@ -3,7 +3,7 @@ title: Record HTTP(S) Traffic page_title: Record HTTP(S) Traffic description: "Progress® Test Studio® for APIs - Record HTTP(S) Traffic" position: 1 -publish: true +published: true --- # Record HTTP(S) Traffic diff --git a/docs-apitesting/features/record/import-http-traffic.md b/docs-apitesting/features/record/import-http-traffic.md index ced7f41a..cfec5361 100644 --- a/docs-apitesting/features/record/import-http-traffic.md +++ b/docs-apitesting/features/record/import-http-traffic.md @@ -3,7 +3,7 @@ title: Import HTTP(S) Traffic page_title: Import HTTP(S) Traffic description: "Progress® Test Studio® for APIs - Import HTTP(S) Traffic" position: 2 -publish: true +published: true --- # Import HTTP(S) Traffic diff --git a/docs-apitesting/features/source-path-expressions.md b/docs-apitesting/features/source-path-expressions.md index 5d1248ea..e0bd0c63 100644 --- a/docs-apitesting/features/source-path-expressions.md +++ b/docs-apitesting/features/source-path-expressions.md @@ -3,7 +3,7 @@ title: Source Path Expressions page_title: Source Path Expressions description: "Progress® Test Studio® for APIs - Source Path Expressions" position: 0 -publish: true +published: true --- # Source Path Expressions diff --git a/docs-apitesting/features/steps/goto.md b/docs-apitesting/features/steps/goto.md index 39defba7..f53186f2 100644 --- a/docs-apitesting/features/steps/goto.md +++ b/docs-apitesting/features/steps/goto.md @@ -3,7 +3,7 @@ title: Goto Step page_title: Goto Step description: "Progress® Test Studio® for APIs - Steps - Goto Step" position: 1 -publish: true +published: true --- # Goto Step diff --git a/docs-apitesting/features/steps/http-request.md b/docs-apitesting/features/steps/http-request.md index c46d6c0c..cb68fc54 100644 --- a/docs-apitesting/features/steps/http-request.md +++ b/docs-apitesting/features/steps/http-request.md @@ -3,7 +3,7 @@ title: Http Request Step page_title: Http Request Step description: "Progress® Test Studio® for APIs - Steps - Http Request Step" position: 2 -publish: true +published: true --- # Http Request Step diff --git a/docs-apitesting/features/steps/overview.md b/docs-apitesting/features/steps/overview.md index 6b6b8926..69470c2c 100644 --- a/docs-apitesting/features/steps/overview.md +++ b/docs-apitesting/features/steps/overview.md @@ -3,7 +3,7 @@ title: Overview page_title: Overview description: "Progress® Test Studio® for APIs - Steps - Overview" position: 0 -publish: true +published: true --- # Steps Overview diff --git a/docs-apitesting/features/steps/set-variable.md b/docs-apitesting/features/steps/set-variable.md index ec6dfd8f..44fd17b3 100644 --- a/docs-apitesting/features/steps/set-variable.md +++ b/docs-apitesting/features/steps/set-variable.md @@ -3,7 +3,7 @@ title: Set Variable Step page_title: Set Variable Step description: "Progress® Test Studio® for APIs - Steps - Set Variable Step" position: 3 -publish: true +published: true --- # Set Variable Step diff --git a/docs-apitesting/features/steps/verification.md b/docs-apitesting/features/steps/verification.md index 0f485cee..3557258b 100644 --- a/docs-apitesting/features/steps/verification.md +++ b/docs-apitesting/features/steps/verification.md @@ -3,7 +3,7 @@ title: Verification Step page_title: Verification Step description: "Progress® Test Studio® for APIs - Steps - Verification Step" position: 4 -publish: true +published: true --- # Verification Step diff --git a/docs-apitesting/features/steps/wait.md b/docs-apitesting/features/steps/wait.md index e7dd5805..71726064 100644 --- a/docs-apitesting/features/steps/wait.md +++ b/docs-apitesting/features/steps/wait.md @@ -3,7 +3,7 @@ title: Wait Step page_title: Wait Step description: "Progress® Test Studio® for APIs - Steps - Wait Step" position: 5 -publish: true +published: true --- # Wait Step diff --git a/docs-apitesting/features/test-results.md b/docs-apitesting/features/test-results.md index a9374b40..ef873b92 100644 --- a/docs-apitesting/features/test-results.md +++ b/docs-apitesting/features/test-results.md @@ -3,7 +3,7 @@ title: Test Results page_title: Test Results description: "Progress® Test Studio® for APIs - Test Results" position: 0 -publish: true +published: true --- # Test Results diff --git a/docs-apitesting/features/variables.md b/docs-apitesting/features/variables.md index 02728412..9153b321 100644 --- a/docs-apitesting/features/variables.md +++ b/docs-apitesting/features/variables.md @@ -3,7 +3,7 @@ title: Variables page_title: Variables description: "Progress® Test Studio® for APIs - Variables" position: 0 -publish: true +published: true --- # Variables diff --git a/docs-apitesting/features/verifications.md b/docs-apitesting/features/verifications.md index d8840895..a576b917 100644 --- a/docs-apitesting/features/verifications.md +++ b/docs-apitesting/features/verifications.md @@ -3,7 +3,7 @@ title: Verifications page_title: Verifications description: "Progress® Test Studio® for APIs - Verifications" position: 0 -publish: true +published: true --- # Verifications diff --git a/docs-apitesting/getting-started/installation.md b/docs-apitesting/getting-started/installation.md index 380365cd..c613d2bc 100644 --- a/docs-apitesting/getting-started/installation.md +++ b/docs-apitesting/getting-started/installation.md @@ -3,10 +3,10 @@ title: Installation page_title: Installation description: "Progress® Test Studio® for APIs - Getting Started - Installation" position: 1 -publish: true +published: true --- -#Installation Procedure +# Installation Procedure 1. After you have downloaded the install file, locate it using Windows Explorer and double click it to launch the installer. 2. Click __Read License Agreement__, then __OK__, then I __Agree - Continue__. diff --git a/docs-apitesting/getting-started/sample-project.md b/docs-apitesting/getting-started/sample-project.md index a61f9dc8..23882abd 100644 --- a/docs-apitesting/getting-started/sample-project.md +++ b/docs-apitesting/getting-started/sample-project.md @@ -3,10 +3,10 @@ title: Sample Project page_title: Sample Project description: "Progress® Test Studio® for APIs - Getting Started - Sample Project" position: 2 -publish: true +published: true --- -#Running Sample Project +# Running Sample Project To help you explore the functionalities of Test Studio for APIs we have created a demo test project that calls a very simple demo application under test. diff --git a/docs-apitesting/images/avatar-ninja.svg b/docs-apitesting/images/avatar-ninja.svg new file mode 100644 index 00000000..d98c1b20 --- /dev/null +++ b/docs-apitesting/images/avatar-ninja.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs-apitesting/images/ninja-no-results.svg b/docs-apitesting/images/ninja-no-results.svg new file mode 100644 index 00000000..5d84ade5 --- /dev/null +++ b/docs-apitesting/images/ninja-no-results.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs-apitesting/index.md b/docs-apitesting/index.md index 87847d94..67b93042 100644 --- a/docs-apitesting/index.md +++ b/docs-apitesting/index.md @@ -1,16 +1,16 @@ --- -title: Index -page_title: Overview +title: About Test Studio for APIs +page_title: About of Test Studio for APIs description: "Progress® Test Studio® for APIs - Overview" position: 1 --- -# Overview +# About Test Studio for APIs The new Test Studio for APIs helps customers verify the integrity and reliability of their APIs in an easy way and incorporate their API testing effort in their continuous testing and delivery process. Test Studio for APIs is used to determine whether APIs return the correct response for a broad range of commonly accepted requests, react properly to edge cases such as failures and unexpected inputs, as well as deliver the responses in an acceptable amount of time. {% if site.has_cta_panels == true %} -{% include cta-panel-teststudio-introduction.html %} +{% include cta-panel-introduction.html %} {% endif %} ## Features diff --git a/docs-apitesting/system-requirements.md b/docs-apitesting/system-requirements.md index f17231db..d04b2f28 100644 --- a/docs-apitesting/system-requirements.md +++ b/docs-apitesting/system-requirements.md @@ -6,23 +6,23 @@ into your continuous testing and delivery process. Telerik API Testing by Progre enables even non-technical testers to get up-to-speed with testing APIs." position: 1 --- -# System Requirements# +# System Requirements ## Supported Environments * .NET Framework - 4.7.2 -## Supported Operating Systems## +## Supported Operating Systems * Windows 11. 10, 8.1 * Windows Server 2012, 2016, 2019 -## Minimum Hardware Requirements## +## Minimum Hardware Requirements * Disk Space: 500MB * RAM: 2GB * CPU: 2.4GHz {% if site.has_cta_panels == true %} -{% include cta-panel-teststudio-introduction.html %} +{% include cta-panel-introduction.html %} {% endif %} \ No newline at end of file diff --git a/docs-apitesting/troubleshooting-guide/corrupted-response.md b/docs-apitesting/troubleshooting-guide/corrupted-response.md index 1b14d5c6..99f6f1b0 100644 --- a/docs-apitesting/troubleshooting-guide/corrupted-response.md +++ b/docs-apitesting/troubleshooting-guide/corrupted-response.md @@ -3,7 +3,7 @@ title: Corrupted Response due to HTTP compression page_title: Corrupted Response due to HTTP compression description: "Progress® Test Studio® for APIs - Troubleshooting guide - Corrupted response due to HTTP compression" position: 2 -publish: true +published: true --- # Corrupted Response due to HTTP compression diff --git a/docs-apitesting/troubleshooting-guide/no-internet-connection.md b/docs-apitesting/troubleshooting-guide/no-internet-connection.md index 3cd55c1b..9fd3b8a7 100644 --- a/docs-apitesting/troubleshooting-guide/no-internet-connection.md +++ b/docs-apitesting/troubleshooting-guide/no-internet-connection.md @@ -4,7 +4,7 @@ page_title: No Internet Connection description: "Progress® Test Studio® for APIs - Troubleshooting guide - No Internet Connection" previous_url: /troubleshooting-guide/deregister-proxy position: 3 -publish: true +published: true --- # No Internet Connection diff --git a/docs-apitesting/troubleshooting-guide/no-test-execution-output.md b/docs-apitesting/troubleshooting-guide/no-test-execution-output.md index 2c430084..078b6321 100644 --- a/docs-apitesting/troubleshooting-guide/no-test-execution-output.md +++ b/docs-apitesting/troubleshooting-guide/no-test-execution-output.md @@ -3,7 +3,7 @@ title: No Test Execution Output page_title: No Test Execution Output description: "Progress® Test Studio® for APIs - Troubleshooting guide - No Test Execution Output" position: 1 -publish: true +published: true --- # No Test Execution Output diff --git a/docs-apitesting/troubleshooting-guide/target-wrong-dll-version.md b/docs-apitesting/troubleshooting-guide/target-wrong-dll-version.md index af51602d..539e9390 100644 --- a/docs-apitesting/troubleshooting-guide/target-wrong-dll-version.md +++ b/docs-apitesting/troubleshooting-guide/target-wrong-dll-version.md @@ -3,7 +3,7 @@ title: Targeting Wrong API Framework DLL Version After Upgrade page_title: Targeting Wrong API Framework DLL Version After Upgrade description: "Progress® Test Studio® for APIs - Troubleshooting guide - Targeting Wrong API Framework DLL Version After Upgrade. Error 'Could not load file or assembly 'Telerik.ApiTesting.Framework, Version=' or one of its dependencies. The system cannot find the file specified. Die Datei oder Assembly 'Telerik.ApiTesting.Framework, Version=' oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden." position: 4 -publish: true +published: true --- # Targeting Wrong API Framework DLL Version After Upgrade diff --git a/docs-teststudiodev/README.md b/docs-teststudiodev/README.md index 1456f092..1488c64b 100644 --- a/docs-teststudiodev/README.md +++ b/docs-teststudiodev/README.md @@ -1,6 +1,6 @@ --- title: Kendo UI Documentation Repo -publish: false +published: false --- # Kendo UI Public Documentation diff --git a/docs-teststudiodev/advanced-topics/ci/execute-test-with-vstest.md b/docs-teststudiodev/advanced-topics/ci/execute-test-with-vstest.md index 8f1ca978..5c44b94c 100644 --- a/docs-teststudiodev/advanced-topics/ci/execute-test-with-vstest.md +++ b/docs-teststudiodev/advanced-topics/ci/execute-test-with-vstest.md @@ -4,7 +4,7 @@ page_title: Execute Test Studio Test with VSTestConsole.exe - Test Studio Dev Do description: Execute Test Studio Test with VSTestConsole.exe position: 10 --- -# Execute Test Studio Tests with VSTestConsole.exe # +# Execute Test Studio Tests with VSTestConsole.exe To be able to execute Test Studio tests with the Visual Studio default test runner there are few requirements to set in advance. These are described below: @@ -14,11 +14,11 @@ To be able to execute Test Studio tests with the Visual Studio default test runn 3.There are two variables you have to set before executing Test Studio tests - ***TS_PROJECT_PATH*** and ***TS_DLL_PATH***. Project path is the folder which contains the Settings.aiis file. Dll path is the folder which contains the built project dll. -``` +```` set TS_PROJECT_PATH=C:\Visual Studio 2015\Projects\TestStudioProject11\TestStudioProject11 set TS_DLL_PATH=C:\Visual Studio 2015\Projects\TestStudioProject11\TestStudioProject11\bin\Debug\TestStudioProject11.dll -``` +```` > __Note!__ The variables are set for this instance of the Developer Command Prompt. By each next start of the command prompt the variables need to be set again. Therefore these need to be set in the build tasks in __CI environment__ prior the task to execute the test. @@ -28,6 +28,6 @@ The TestAdapter dll will be in any of the sub-folders in the Visual Studio Exten Below you may find a sample command to execute a Test Studio test with the VSTestConsole.exe after the TS\_PROJECT\_PATH and TS\_DLL\_PATH variables are set for the current instance of the VS Developer Command Prompt: -``` +```` C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow>vstest.console "C:\Visual Studio 2015\Projects\TestStudioProject11\TestStudioProject11\Parent.tstest" /TestAdapterPath:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\t1fos0ab.vkx" -``` +```` diff --git a/docs-teststudiodev/advanced-topics/ci/jenkins-ci-plugin.md b/docs-teststudiodev/advanced-topics/ci/jenkins-ci-plugin.md index 4b8a789c..7a90068d 100644 --- a/docs-teststudiodev/advanced-topics/ci/jenkins-ci-plugin.md +++ b/docs-teststudiodev/advanced-topics/ci/jenkins-ci-plugin.md @@ -36,7 +36,7 @@ The *project root folder* and *settings file* fields accept relative path to the Your test execution step is now ready to save and run. -[1]: images/ciplugin/fig1.png + [2]: images/ciplugin/fig2.png [3]: images/ciplugin/fig3.png [4]: images/ciplugin/fig4.png diff --git a/docs-teststudiodev/advanced-topics/data-driven-testing/data-driven-image-verification.md b/docs-teststudiodev/advanced-topics/data-driven-testing/data-driven-image-verification.md index 7aea3400..c86917d2 100644 --- a/docs-teststudiodev/advanced-topics/data-driven-testing/data-driven-image-verification.md +++ b/docs-teststudiodev/advanced-topics/data-driven-testing/data-driven-image-verification.md @@ -4,14 +4,11 @@ page_title: Data Driven Image Verification - Test Studio Dev Documentation description: How to data drive image verification in Test Studio Dev position: 3 --- -# Data Driven Image Verification # +# Data Driven Image Verification To data bind an image verification step certain actions have to be performed. An approach to this scenario is to have previously stored histograms of the image element to which verification should be bonded. Then in a coded step the verification has to be managed as it is given in the sample below: -#### __[C#]__ - - {{region }} - +````C# // get an image of MyImage element System.Drawing.Bitmap bitmap = Pages.MyPage.MyImage.Capture(); @@ -36,12 +33,8 @@ To data bind an = compareValue); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim bitmap As System.Drawing.Bitmap = Pages.MyPage.MyImage.Capture() Dim histogram As ArtOfTest.Common.Histogram = ArtOfTest.Common.Histogram.FromBitmap(bitmap) @@ -59,8 +52,7 @@ To data bind an = compareValue) - {{endregion}} - +```` To complete this scenario using the provided sample: - *System.Drawings* .NET assembly has to be referenced in the project diff --git a/docs-teststudiodev/advanced-topics/data-driven-testing/oracle-db-example.md b/docs-teststudiodev/advanced-topics/data-driven-testing/oracle-db-example.md index a8f558aa..2e69b120 100644 --- a/docs-teststudiodev/advanced-topics/data-driven-testing/oracle-db-example.md +++ b/docs-teststudiodev/advanced-topics/data-driven-testing/oracle-db-example.md @@ -28,9 +28,9 @@ Once the table is created it is possible to connect to it and use it for data-dr 4.  Here's an example for **Connection String**: -``` +```` Data Source=XE;User Id=SYSTEM;Password=pass; -``` +```` It is possible to create many different connection strings. See here for more examples. diff --git a/docs-teststudiodev/advanced-topics/data-driven-testing/sql-database-example.md b/docs-teststudiodev/advanced-topics/data-driven-testing/sql-database-example.md index f2613227..b22f3ffd 100644 --- a/docs-teststudiodev/advanced-topics/data-driven-testing/sql-database-example.md +++ b/docs-teststudiodev/advanced-topics/data-driven-testing/sql-database-example.md @@ -24,9 +24,9 @@ Now we can connect to it and use it for data-driven testing. 4.  Here's an example for **Connection String**: -``` +```` Data Source=MACHINENAME\SQLEXPRESS; Initial Catalog=myFirstDB; Integrated Security=true; -``` +```` - Data Source is the name of the SQL Server. - Initial Catalog is the named of the Database. diff --git a/docs-teststudiodev/advanced-topics/elements/element-repository.md b/docs-teststudiodev/advanced-topics/elements/element-repository.md index 36be2762..89bfc1ef 100644 --- a/docs-teststudiodev/advanced-topics/elements/element-repository.md +++ b/docs-teststudiodev/advanced-topics/elements/element-repository.md @@ -34,6 +34,6 @@ Since this file is automatically generated, it should not be checked into your s ## How is the Element Repository used during test execution? -When you look at the elements being displayed in the Elements Explorer pane, you will see them in a tree structure. At the root is the web page from which they were recorded. Under that may be a Frame node if the element was contained on the source page that an \ -``` +```` -## Add a Tag Dynamically in Code ## +## Add a Tag Dynamically in Code If it is not possible to add custom tags to your iframes, you can add them at runtime using a coded step. 1. Add the following using directive to your ode-behind file: -#### __[C#]__ - - {{region }} - - using ArtOfTest.WebAii.Design.Extensions; - {{endregion}} +````C# + using ArtOfTest.WebAii.Design.Extensions; +```` 2. Call the **myFrame()** method on the frame object in a coded step. For example: -#### __[C#]__ - - {{region }} - - [CodedStep(@"Tag Frame with 'MyCustomTag'")] - public void WebTest1_CodedStep() +````C# + [CodedStep(@"Tag Frame with 'MyCustomTag'")] + public void WebTest1_CodedStep() + { + Browser myFrame = this.ActiveBrowser.Frames[0] as Browser; + if (myFrame != null ) { - Browser myFrame = this.ActiveBrowser.Frames[0] as Browser; - if (myFrame != null ) - { - myFrame.TagFrame("MyCustomTag"); - } - } - {{endregion}} + myFrame.TagFrame("MyCustomTag"); + } + } +```` To tag a nested iframe, ensure the entire DOM is built, so that Test Studio Dev can access the iframes. For example: -#### __[C#]__ - - {{region }} - +````C# [CodedStep(@"Tag nested frame with 'MyCustomTag'")] public void WebTest1_CodedStep() { @@ -67,7 +58,7 @@ To tag a nested iframe, ensure the entire DOM is built, so that Test Studio Dev myFrame.TagFrame("MyCustomTag"); } } - {{endregion}} +```` __See also:__ diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/ajax-calendar-random-date.md b/docs-teststudiodev/code-in-test/coded-samples/html/ajax-calendar-random-date.md index fd3b018f..2e36b50f 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/ajax-calendar-random-date.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/ajax-calendar-random-date.md @@ -4,18 +4,15 @@ page_title: AJAX Calendar Random Date - Test Studio Dev Documentation description: AJAX Calendar Random Date position: 1 --- -#AJAX Calendar - Random Date Selection# +# AJAX Calendar - Random Date Selection *I would like to select a random date from an Ajax Calendar.* -##Solution## +## Solution The code below will show you how to select a random date from the Calendar on this site. -#### __[C#]__ - - {{region }} - +````C# //We scroll to the date picker so that we can see the click occurring. //Pages.WeekEndCourseullesSurMer.WeekendFormFormTag is a definition which Test Studio Dev automatically generated. Pages.WeekEndCourseullesSurMer.WeekendFormFormTag.ScrollToVisible(ScrollToVisibleType.ElementBottomAtWindowBottom); @@ -52,12 +49,8 @@ The code below will show you how to select a random date from the Calendar on Find Settings*. -## Solution ## +## Solution Let's use wikipedia.org as an example. First we'll find and click the top bold English link. @@ -16,7 +16,7 @@ Let's use wikipedia.org Here's the HTML code for that link: -```HTML +````HTML English
@@ -24,27 +24,21 @@ Here's the HTML code for that link:
3 907 000+ articles
-``` +```` The anchor element has no direct TextContent, so we'll need to locate by a partial match on InnerText: -#### __[C#]__ - - {{region }} - +````C# HtmlAnchor a = Find.ByExpression("InnerText=~English", "tagname=a"); Assert.IsNotNull(a); a.Click(); - {{endregion}} - -#### __[VB]__ - - {{region }} +```` +````VB Dim a As HtmlAnchor = Find.ByExpression(Of HtmlAnchor)("InnerText=~English", "tagname=a") Assert.IsNotNull(a) a.Click() - {{endregion}} +```` If we locate by an exact match on TextContent, the bottom *English* link will found. @@ -52,77 +46,50 @@ If we locate by an exact match on TextContent, the bottom *English* link will fo Here's the HTML code for that link: -```HTML +````HTML English -``` +```` Here's how to locate and click that link: -#### __[C#]__ - - {{region }} +````C# HtmlAnchor a = Find.ByExpression("TextContent=English", "tagname=a"); Assert.IsNotNull(a); a.Click(); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim a As HtmlAnchor = Find.ByExpression(Of HtmlAnchor)("TextContent=English", "tagname=a") Assert.IsNotNull(a) a.Click() - {{endregion}} +```` The following attributes apply to both links, however Test Studio returns the first HtmlAnchor that matches. In this case, that's the top bold *English* link. -#### __[C#]__ - - {{region }} - +````C# HtmlAnchor a = Find.ByExpression("tagname=a", "href=//en.wikipedia.org/"); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim a As HtmlAnchor = Find.ByExpression(Of HtmlAnchor)("tagname=a", "href=//en.wikipedia.org/") - {{endregion}} +```` You can find it by xpath: -#### __[C#]__ - - {{region }} - +````C# HtmlAnchor a = Find.ByXPath("//*[@id=\"www-wikipedia-org\"]/div[5]/div/a[2]"); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim a As HtmlAnchor = Find.ByXPath(Of HtmlAnchor)("//*[@id=""www-wikipedia-org""]/div[5]/div/a[2]") - {{endregion}} +```` You can also data drive the find expression: -#### __[C#]__ - - {{region }} - +````C# HtmlAnchor a = Find.ByExpression("tagname=a", "textcontent=" + Data["Col1"].ToString()); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim a As HtmlAnchor = Find.ByExpression(Of HtmlAnchor)("tagname=a", "textcontent=" + Data("Col1").ToString()) - {{endregion}} +```` [1]: images/common-find-expressions/fig1.png [2]: images/common-find-expressions/fig2.png diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/conditional-dialog-handling.md b/docs-teststudiodev/code-in-test/coded-samples/html/conditional-dialog-handling.md index 1c76fde7..9b6558a9 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/conditional-dialog-handling.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/conditional-dialog-handling.md @@ -4,18 +4,15 @@ page_title: Conditional Dialog Handling - Test Studio Dev Documentation description: Conditional Dialog Handling position: 1 --- -#Conditionally Handling Dialog# +# Conditionally Handling Dialog *I would like to conditionally handle a dialog. If it appears, I'd like to handle it normally. If it doesn't, I'd like to continue with test execution.* -##Solution## +## Solution This is possible with a coded solution. The action that potentially triggers the dialog must be included in the code. -#### __[C#]__ - - {{region }} - +````C# ActiveBrowser.NavigateTo("http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert"); //Create the dialog and add it to the monitor @@ -40,12 +37,8 @@ This is possible with a coded solution. The action that potentially triggers the Manager.DialogMonitor.RemoveDialog(ad); ActiveBrowser.NavigateTo("http://www.bing.com"); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB ActiveBrowser.NavigateTo("http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert") @@ -65,5 +58,5 @@ This is possible with a coded solution. The action that potentially triggers the Manager.DialogMonitor.RemoveDialog(ad) ActiveBrowser.NavigateTo("http://www.bing.com") - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/dynamic-grid.md b/docs-teststudiodev/code-in-test/coded-samples/html/dynamic-grid.md index 435b430e..25659f08 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/dynamic-grid.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/dynamic-grid.md @@ -34,10 +34,7 @@ Going back to Test Studio Dev project, you will notice a new element has appeare Create a new coded step and add the following lines that go through each (visible) cell in the Grid: -#### __[C#]__ - - {{region }} - +````C# foreach (HtmlTableRow r in Pages.ClientSideRowSelection.ContentPlaceholder1RadGrid1Table.AllRows) { foreach(HtmlTableCell c in r.Cells) @@ -45,7 +42,7 @@ Create a new coded step and add the following lines that go through each (visibl Log.WriteLine("Cell found. TextContent:"+c.TextContent); } } - {{endregion}} +```` This is C# code, the VB code will follow the same logic only transcribed in the corresponding syntax. Make sure the coded step executes at a point in your test when the page contains the grid fully loaded in the currently active browser. @@ -57,10 +54,7 @@ Let's look at the grid in the below image. Let's imagine we want to get the row In this example we want to check a checkbox but this could be any kind of control. The code we will use doesn't take into account what the content of the actual cell is: we just click it. Once again we'll be using the definition of the grid that we've stored in the the elements repository. Here's the code: -#### __[C#]__ - - {{region }} - +````C# HtmlTableRow containerRow=null; //The variable that will store the row that contains the name cell and the checkbox cell foreach (HtmlTableRow r in Pages.ClientSideRowSelection.ContentPlaceholder1RadGrid1Table.AllRows) @@ -83,12 +77,9 @@ In this example we want to check a checkbox but this could be any kind of contro checkbox.ScrollToVisible(); checkbox.MouseClick(); - {{endregion}} +```` [1]: images/dynamic-grid/fig1.png [2]: images/dynamic-grid/fig2.png [3]: images/dynamic-grid/fig3.png [4]: images/dynamic-grid/fig4.png -[5]: images/dynamic-grid/fig5.png - - diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/extract-an-attribute.md b/docs-teststudiodev/code-in-test/coded-samples/html/extract-an-attribute.md index a81f5cfb..d4455aff 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/extract-an-attribute.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/extract-an-attribute.md @@ -4,46 +4,39 @@ page_title: Extract an Attribute - Test Studio Dev Documentation description: Extract an Attribute position: 1 --- -# Extract an Individual HTML Attribute # +# Extract an Individual HTML Attribute *I would like to extract an individual HTML attribute and use it later in the test.* -## Solution ## +## Solution This is possible with a coded solution. Note that if you're simply verifying the value for a specific attribute you could use an Advanced Verification. HTML elements are formatted the following way: -```HTML +````HTML content -``` +```` -```HTML +````HTML Go to Google -``` +```` Here's how to set the value of the *lang* attribute (*which is en*) to a string. That string is then set as an extracted value to use later in the test through data binding (either attached to an input value or a verification). -#### __[C#]__ - - {{region }} - +````C# HtmlAnchor a = Find.ById("googleLink"); Assert.IsNotNull(a); string atr = a.Attributes.Single(x => x.Name == "lang").Value; Log.WriteLine(atr); SetExtractedValue("extraction", atr); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim a As HtmlAnchor = Find.ById(Of HtmlAnchor)("googleLink") Assert.IsNotNull(a) Dim atr As String = a.Attributes.[Single](Function(x) x.Name = "lang").Value Log.WriteLine(atr) SetExtractedValue("extraction", atr) - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/image-comparison.md b/docs-teststudiodev/code-in-test/coded-samples/html/image-comparison.md index 0ba25394..29fc9be9 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/image-comparison.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/image-comparison.md @@ -4,18 +4,15 @@ page_title: Image Comparison - Test Studio Dev Documentation description: Image Comparison position: 1 --- -# Perform an Image Comparison in Code # +# Perform an Image Comparison in Code *I would like to compare a specific image from the browser to one stored on disk.* -## Solution ## +## Solution Here is sample code showing how to perform the image comparison: -#### __[C#]__ - - {{region }} - +````C# HtmlImage img = Find.ById("myImageId"); System.Drawing.Bitmap actualbmp = img.Capture(); @@ -23,12 +20,8 @@ Here is sample code showing how to perform the image comparison: ArtOfTest.Common.PixelMap actual = ArtOfTest.Common.PixelMap.FromBitmap(actualbmp); Assert.IsTrue(expected.Compare(actual, 5.0)); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim img As HtmlImage = Find.ById(Of HtmlImage)("myImageId") Dim actualbmp As System.Drawing.Bitmap = img.Capture() @@ -36,6 +29,6 @@ Here is sample code showing how to perform the image comparison: Dim actual As ArtOfTest.Common.PixelMap = ArtOfTest.Common.PixelMap.FromBitmap(actualbmp) Assert.IsTrue(expected.Compare(actual, 5.0)) - {{endregion}} +```` In the above code I am getting the image of the "myImageId" element from the browser and comparing it to the expected image stored on disk named "myExpected.png". The comparison is allowing a 5% tolerance, meaning there may be up to a 5% difference in the image or else the Assert fails and the test aborts. diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/jQuery-events-do-not-fire.md b/docs-teststudiodev/code-in-test/coded-samples/html/jQuery-events-do-not-fire.md index 8d7c003f..9be09ac2 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/jQuery-events-do-not-fire.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/jQuery-events-do-not-fire.md @@ -20,17 +20,16 @@ Inputting text into -``` +```` Invoke the script that changes the background color with the following coded step: -#### __[C#]__ - - {{region }} +````C# + Pages.TryitEditorV220.FrameIframeResult.Text.AsjQueryControl().InvokejQueryEvent(ArtOfTest.WebAii.jQuery.jQueryControl.jQueryControlEvents.change); - {{endregion}} +```` * The guideline is to always pair the two steps together. Immediately after performing the change step (input, radio button, etc.), run the coded step that calls the .change function for that element. diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/partial-attributes-search-fails.md b/docs-teststudiodev/code-in-test/coded-samples/html/partial-attributes-search-fails.md index cf20b66e..752afa0b 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/partial-attributes-search-fails.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/partial-attributes-search-fails.md @@ -4,42 +4,33 @@ page_title: Partial Attributes Search Fails - Test Studio Dev Documentation description: Partial Attributes Search Fails position: 1 --- -# Partial Attributes Search by Control Type Fails # +# Partial Attributes Search by Control Type Fails _A partial search of control by attribute may return null even with correct partial search syntax._ For example a HtmlInputButton search on the page having a complex ID containing some specific string should be located successfully using the following syntax: -#### __[C#]__ - - {{region }} - +````C# HtmlInputButton button = Find.ById("~MyButtonIDPart"); - {{endregion}} +```` Although the next example works as well: -#### __[C#]__ - - {{region }} - +````C# HtmlInputButton button = Find.ById("SomeButtonIDPart_MyButtonIDPart"); - {{endregion}} +```` -## Notes ## +## Notes The framework locates the first element matching the given attribute search criteria. Next, it compares the control type of the element and returns that element if the control type matches. If it does not, it simply returns null. In the first example, the framework returns null if there is another element that matches the given attribute search criteria and it is found before the target element. The control type does not match. -## Solution ## - -A simple solution is available. Use Find.AllByAttributes overload and return the first (and actually the only completely matching control): - -#### __[C#]__ +## Solution - {{region }} +A simple solution is available. Use `Find.AllByAttributes` overload and return the first (and actually the only completely matching control): +````C# HtmlInputButton button = Find.AllByAttributes("id=~MyButtonIDPart")[0]; - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/radwindow-width-height.md b/docs-teststudiodev/code-in-test/coded-samples/html/radwindow-width-height.md index 79af0fd0..43e25220 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/radwindow-width-height.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/radwindow-width-height.md @@ -4,20 +4,17 @@ page_title: RadWindow Width & Height - Test Studio Dev Documentation description: RadWindow Width & Height position: 1 --- -# Getting RadWindow Width and Height # +# Getting RadWindow Width and Height *I need to get the RadWindow width or height property.* -## Solution ## +## Solution First you need to get a reference to the RadWindow control by ID. Once you get it there are two options for getting the width/height. The first option is to use the relevant width/height properties of the RadWindow. The second is by invoking a straight JavaScript on the page. Here is the standard approach: -#### __[C#]__ - - {{region }} - +````C# Manager.LaunchNewBrowser(); ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx"); Find.ById("Button3").MouseClick(); @@ -27,12 +24,8 @@ Here is the standard approach: //First Option Assert.AreEqual(300, window.Width); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Manager.LaunchNewBrowser() ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx") Find.ById(Of HtmlInputSubmit)("Button3").MouseClick() @@ -41,14 +34,11 @@ Here is the standard approach: Dim window As RadWindow = Find.ById(Of RadWindow)("RadWindowWrapper_RadWindow_ContentTemplate") Assert.AreEqual(300, window.Width) - {{endregion}} +```` Invoking JavaScript on the page: -#### __[C#]__ - - {{region }} - +````C# Manager.LaunchNewBrowser(); ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx"); Find.ById("Button3").MouseClick(); @@ -59,11 +49,8 @@ Invoking JavaScript on the page: //Second Option string windowWidth = this.ActiveBrowser.Actions.InvokeScript(String.Format("$telerik.getBounds($find('RadWindow_ContentTemplate').get_popupElement()).width")); Assert.AreEqual("300", windowWidth); - {{endregion}} - -#### __[VB]__ - - {{region }} +```` +````VB Manager.LaunchNewBrowser() ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx") @@ -74,6 +61,6 @@ Invoking JavaScript on the page: Dim windowWidth As String = Me.ActiveBrowser.Actions.InvokeScript([String].Format("$telerik.getBounds($find('RadWindow_ContentTemplate').get_popupElement()).width")) Assert.AreEqual("300", windowWidth) - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/table-searching-paging.md b/docs-teststudiodev/code-in-test/coded-samples/html/table-searching-paging.md index 32c1000e..1501f50d 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/table-searching-paging.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/table-searching-paging.md @@ -4,18 +4,15 @@ page_title: Table Searching & Paging - Test Studio Dev Documentation description: Table Searching & Paging position: 1 --- -#HTML Table Searching and Paging# +# HTML Table Searching and Paging *I would like to search an HTML table for specific content and continue through the pages until it is found.* -##Solution## +## Solution This is possible with a coded solution. The example below is against this Telerik demo site. -#### __[C#]__ - - {{region }} - +````C# HtmlTable table = Find.ByExpression("id=Grid", "|", "tagIndex=table:1"); HtmlSpan next = Find.ByExpression("class=k-icon k-i-arrow-e"); HtmlAnchor a = Find.ByExpression("title=Go to the next page"); @@ -54,12 +51,8 @@ This is possible with a coded solution. The example below is against this this W3Schools site. -#### __[C#]__ - - {{region }} - +````C# HtmlTable table = Find.ByTagIndex("table", 0); double r = table.Rows.Count; @@ -38,12 +35,8 @@ This is possible with a coded solution. The example below is against Dialog that is fired from the browser during test execution.* -##Solution## +## Solution This could be achieved in a coded solution. The code will both handle the dialog and verify the text within it. What is used to handle this in Chrome is **AutomationElement Class**. A new AutomationElement object is retrieved for the dialog window referenced by the specified window handle and its node is located. The location of the text may vary depending on the machine used for execution though this is handled in the if..else statement. @@ -21,10 +21,7 @@ This could be achieved in a coded solution. The code will both handle the dialog The last three could be usually found in *'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\'*. -#### __[C#]__ - - {{region }} - +````C# [CodedStep(@"New Coded Step")] public void WebTest_CodedStep() { @@ -54,12 +51,8 @@ The last three could be usually found in *'C:\Program Files (x86)\Reference Asse // handle the dialog Manager.Desktop.KeyBoard.KeyPress(Keys.Enter); } - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB _ Public Sub WebTest_CodedStep() System.Threading.Thread.Sleep(1000) @@ -85,24 +78,17 @@ The last three could be usually found in *'C:\Program Files (x86)\Reference Asse ' handle the dialog Manager.Desktop.KeyBoard.KeyPress(Keys.Enter) End Sub - {{endregion}} +```` Ensure you add the following *using or Imports* statements to the top of the code-behind file: -#### __[C#]__ - - {{region }} - +````C# using System.Windows.Automation; using ArtOfTest.Common.Extensions; using System.Windows.Forms; - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Imports System.Windows.Automation Imports ArtOfTest.Common.Extensions Imports System.Windows.Forms - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/verify-dialog-text.md b/docs-teststudiodev/code-in-test/coded-samples/html/verify-dialog-text.md index a4473de9..180baa00 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/verify-dialog-text.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/verify-dialog-text.md @@ -4,18 +4,15 @@ page_title: Verify Dialog Text - Test Studio Dev Documentation description: Verify Dialog Text position: 1 --- -# How to Verify Dialog Text (Internet Explorer only) # +# How to Verify Dialog Text (Internet Explorer only) *I would like to verify the text of a Dialog that is fired from the browser during test execution.* -## Solution ## +## Solution This is possible with a coded solution. The code will both handle the dialog and verify the text within it. The second part uses a delegate to implement a custom handler for the dialog. -#### __[C#]__ - - {{region }} - +````C# string dialogText; [CodedStep(@"Navigate then verify text in popup dialog")] @@ -53,12 +50,8 @@ This is possible with a coded solution. The code will both handle the dialog an Manager.Desktop.KeyBoard.KeyPress(Keys.Enter); dialog.HandleCount++; } - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Private dialogText As String _ @@ -90,22 +83,15 @@ This is possible with a coded solution. The code will both handle the dialog an Manager.Desktop.KeyBoard.KeyPress(Keys.Enter) dialog.HandleCount += 1 End Sub - {{endregion}} +```` Ensure you add the following *using* or *Imports* statements to the top of the code-behind file. -#### __[C#]__ - - {{region }} - +````C# using ArtOfTest.WebAii.Win32.Dialogs; using System.Windows.Forms; - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Imports ArtOfTest.WebAii.Win32.Dialogs Imports System.Windows.Forms - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/verify-sort-order-html.md b/docs-teststudiodev/code-in-test/coded-samples/html/verify-sort-order-html.md index 7dd7020c..c1ce9065 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/verify-sort-order-html.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/verify-sort-order-html.md @@ -4,20 +4,17 @@ page_title: Verify Sort Order - Test Studio Dev Documentation description: Verify Sort Order position: 1 --- -# Verify Sort Order in an HTML Table # +# Verify Sort Order in an HTML Table *I would like to sort a column in an HTML Table and verify the content is in the correct order.* -## Solution ## +## Solution This is possible with a coded solution. The example below is against this Telerik demo site. Let's verify the first column, Order ID, is in sequential order: -#### __[C#]__ - - {{region }} - +````C# //Get the table. HtmlTable table = Find.ByExpression("id=Grid", "|", "tagIndex=table:1"); @@ -45,12 +42,8 @@ Let's verify the first column, Order ID, is in sequential order: Assert.IsTrue(list[j+1].CompareTo(list[j]) >= 0); } } - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim table As HtmlTable = Find.ByExpression(Of HtmlTable)("id=Grid", "|", "tagIndex=table:1") Dim r As Integer = table.Rows.Count @@ -72,4 +65,4 @@ Let's verify the first column, Order ID, is in sequential order: Assert.IsTrue(list(j + 1).CompareTo(list(j)) >= 0) End If Next - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/html/verify-style.md b/docs-teststudiodev/code-in-test/coded-samples/html/verify-style.md index 11702230..fc8a1478 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/html/verify-style.md +++ b/docs-teststudiodev/code-in-test/coded-samples/html/verify-style.md @@ -4,20 +4,17 @@ page_title: Verify Style - Test Studio Dev Documentation description: Verify Style position: 1 --- -# Verify HTML Style # +# Verify HTML Style *I would like to verify an HTML element's style and extract it for use later in the test.* -## Solution ## +## Solution This is possible with a coded solution. Note that if you're simply verifying the style of an element you could use an Advanced Verification. The example below is against this W3Schools site. Two styles are verified, retrieved as strings, and set as extracted values to use later in the test through data binding (either attached to an input value or a verification). -#### __[C#]__ - - {{region }} - +````C# Browser frame = ActiveBrowser.Frames["view"]; HtmlControl paragraph = frame.Find.ByTagIndex("p", 0); Assert.IsNotNull(paragraph); @@ -32,12 +29,8 @@ The example below is against Silverlight demo site. After navigating there, click DataGrid in the left-hand menu. Then add a coded step: -#### __[C#]__ - - {{region }} - +````C# SilverlightApp app = ActiveBrowser.SilverlightApps()[0]; FindStrategy originalStrategy = app.Find.Strategy; @@ -44,12 +41,8 @@ The example below is against this Telerik demo site. -#### __[C#]__ - - {{region }} - +````C# public FrameworkElement FindElementByTextContent(string content) { int extentHeight; // The total height of the grid, visible plus non-visible @@ -79,12 +76,8 @@ The following code demonstrates how to accomplish this on a Telerik demo page. -#### __[C#]__ - - {{region }} +````C# + int verticalOffset = 0; // Holds the current vertical offset in the viewport int viewPortHeight; // The height of the visible part of the grid int extentHeight; // The total height of the grid, visible plus non-visible @@ -54,12 +53,10 @@ The following code demonstrates how to accomplish this against a Due to the volume of data contained in the sample RadGridView, this test will take hours to run through it all. But it shows all the necessary steps. diff --git a/docs-teststudiodev/code-in-test/coded-samples/silverlight/radgridview-automation/total-rows-count.md b/docs-teststudiodev/code-in-test/coded-samples/silverlight/radgridview-automation/total-rows-count.md index ea1b1acc..ade0b9e3 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/silverlight/radgridview-automation/total-rows-count.md +++ b/docs-teststudiodev/code-in-test/coded-samples/silverlight/radgridview-automation/total-rows-count.md @@ -4,20 +4,17 @@ page_title: Total Rows Count - Test Studio Dev Documentation description: Total Rows Count position: 1 --- -# RadGridView Total Rows Count # +# RadGridView Total Rows Count *I need to get the total number of rows contained in a RadGridView. The Rows.Count property of the RadGridView only returns the number of rows on the current page.* -## Solution # +## Solution The only way to get the total rows count is by calculating the number of rows per page and adding them to the running total. The following code demonstrates how to get the rows count of the RadGridView shown on this Telerik demo site. We use a Do/While loop in code which exits once the "Next Page" button is no longer Enabled. Then the row count is performed once more to account for the last page. -#### __[C#]__ - - {{region }} - +````C# int extentHeight; // The total height of the grid, visible plus non-visible int rowHeight; // The height of the row @@ -48,12 +45,8 @@ The following code demonstrates how to get the rows count of the RadGridView sho // Show the result Log.WriteLine("Total Number of Rows: "+ totalOverallRows.ToString()); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim extentHeight As Integer Dim rowHeight As Integer @@ -83,4 +76,4 @@ The following code demonstrates how to get the rows count of the RadGridView sho Log.WriteLine("Total Number of Rows: " + totalOverallRows.ToString()) - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/silverlight/radgridview-automation/verify-specific-column.md b/docs-teststudiodev/code-in-test/coded-samples/silverlight/radgridview-automation/verify-specific-column.md index 91847036..bd19b874 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/silverlight/radgridview-automation/verify-specific-column.md +++ b/docs-teststudiodev/code-in-test/coded-samples/silverlight/radgridview-automation/verify-specific-column.md @@ -4,18 +4,15 @@ page_title: Verify Specific Column - Test Studio Dev Documentation description: Verify Specific Column position: 1 --- -# RadGridView Verify Data in a Specific Column # +# RadGridView Verify Data in a Specific Column *I need to find the correct column of a GridView based on something other than index, such as text content or a data driven variable.* -## Solution ## +## Solution Here is how to accomplish this against a Telerik demo site. First you need to retrieve all the Header Row Cells from the Grid and iterate through each one looking for a specific string. Each time it isn't found, the integer idx is increased by one. Once a match is made, idx will equal the index of the target column. Then you can use that integer to identify the column later: -#### __[C#]__ - - {{region }} - +````C# int verticalOffset = 0; // Holds the current vertical offset in the viewport int viewPortHeight; // The height of the visible part of the grid int extentHeight; // The total height of the grid, visible plus non-visible @@ -59,12 +56,8 @@ Here is how to accomplish this against a @@ -88,14 +88,11 @@ My sample Silverlight application to test contains this XAML code to render my l -``` +```` To help make the code necessary to accomplish our search task more modular, let's define a function that takes a listbox, a string to search for and finds and returns the listbox item want. Here is that function: -#### __[C#]__ - - {{region }} - +````C# private static ListBoxItem FindListboxItemByText (string itemToFind, ListBox myLB) { @@ -130,15 +127,12 @@ To help make the code necessary to accomplish our search task more modular, let' // We scanned the entire list and didn't find the right item to select. return null; } - {{endregion}} +```` We call this resusable function from a coded step like this: -#### __[C#]__ - - {{region }} - +````C# [CodedStep("Select a listbox item by text")] public void SelectListItemByTextCodedStep() { @@ -151,4 +145,4 @@ We call this resusable function from a coded step like this: Assert.IsNotNull(item, "\"" + itemToFind + "\" not found in the listbox."); item.User.Click(); } - {{endregion}} \ No newline at end of file +```` \ No newline at end of file diff --git a/docs-teststudiodev/code-in-test/coded-samples/silverlight/verify-colors-in-silverlight.md b/docs-teststudiodev/code-in-test/coded-samples/silverlight/verify-colors-in-silverlight.md index 17db3151..c5640eb8 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/silverlight/verify-colors-in-silverlight.md +++ b/docs-teststudiodev/code-in-test/coded-samples/silverlight/verify-colors-in-silverlight.md @@ -2,20 +2,17 @@ title: Verify Colors in Silverlight page_title: Verify Colors in Silverlight - Test Studio Dev Documentation description: Verify Colors in Silverlight -position: 1 +position: 2 --- -# Verify Colors in Silverlight # +# Verify Colors in Silverlight _I would like to add a color verification for an element in a Silverlight application._ -## Solution ## +## Solution The code below demonstrates this approach against this Telerik demo site. It gets the first item in the menu and verifies that its foreground color matches pre-defined values: -#### __[C#]__ - - {{region }} - +````C# Manager.Settings.Web.EnableSilverlight = true; Manager.LaunchNewBrowser(); ActiveBrowser.NavigateTo("http://demos.telerik.com/silverlight/#TreeView/Performance"); @@ -47,11 +44,8 @@ The code below demonstrates this approach against this a Silverlight toolkit sample. After navigating there, click DataGrid in the left-hand menu. Then click the **FirstName** column header to sort that column. Finally, add a coded step: -#### __[C#]__ - - {{region }} - +````C# //Get the data grid. SilverlightApp app = ActiveBrowser.SilverlightApps()[0]; DataGrid grid = app.Find.ByAutomationId("dataGrid"); @@ -46,12 +43,8 @@ After navigating there, click DataGrid in the left-hand menu. Then click the **F Assert.IsTrue(list[j+1].CompareTo(list[j]) >= 0); } } - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim app As SilverlightApp = ActiveBrowser.SilverlightApps()(0) Dim grid As DataGrid = app.Find.ByAutomationId(Of DataGrid)("dataGrid") @@ -74,6 +67,6 @@ After navigating there, click DataGrid in the left-hand menu. Then click the **F Assert.IsTrue(list(j + 1).CompareTo(list(j)) >= 0) End If Next - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/silverlight/verify-text-in-rich-textbox.md b/docs-teststudiodev/code-in-test/coded-samples/silverlight/verify-text-in-rich-textbox.md index 7a5d0182..0e7aea11 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/silverlight/verify-text-in-rich-textbox.md +++ b/docs-teststudiodev/code-in-test/coded-samples/silverlight/verify-text-in-rich-textbox.md @@ -2,25 +2,25 @@ title: Verify Text in Rich TextBox page_title: Verify Text in Rich TextBox - Test Studio Dev Documentation description: Verify Text in Rich TextBox -position: 1 +position: 2 --- -# Verify Text in a Silverlight RichTextBox # +# Verify Text in a Silverlight RichTextBox _I cannot verify all the text or its properties in my Silverlight RichTextBox. The contents are either not visible or each word is contained in an individual TextBlock in the Visual Tree._ -## Solution ## +## Solution The Silverlight RichTextBox is tricky to work with. It is a "container" type of control, meaning it contains other "block" elements, usually the Paragraph or Section. It is these block elements that hold the actual text displayed in the RichTextBox. Thus, to fetch the displayed text, you must enumerate through the individual blocks and fetch the text from each block element. To make matters worse, the contents of the RichTextBox may not be contained in the Silverlight Visual Tree. You have to get the Xaml property and parse the contents yourself. Here is an example. Let's assume that you have this in the XAML file for your Silverlight application: -```XAML +````XML -``` +```` The application will show text as shown below. @@ -28,7 +28,7 @@ The application will show text as shown below. However in DOM Explorer all you see is this: -```XAML +````XML @@ -52,14 +52,13 @@ However in DOM Explorer all you see is this: -``` +```` Notice that there's no text in the DOM view, even though it is specified in the XAML and displayed in the application. We have to use code to fetch the XAML that the RichTextBox holds as data, then parse out the text buried in it. Here's an example: -#### __[C#]__ - - {{region }} +````C# + // Fetch the XAML property of the RichTextBox string rtbContents = (string)Pages.SilverlightAppTesting.SilverlightApp.RichTextBox1Richtextbox.GetProperty(new AutomationProperty("Xaml", typeof(string))); @@ -75,12 +74,10 @@ Notice that there's no text in the DOM view, even though it is specified in the { Log.WriteLine(runNode.Attributes["Text"].Value); } - {{endregion}} - -#### __[VB]__ - - {{region }} +```` +````VB + Dim rtbContents As String = DirectCast(Pages.SilverlightAppTesting.SilverlightApp.RichTextBox1Richtextbox.GetProperty(New AutomationProperty("Xaml", GetType(String))), String) Dim doc As XmlDocument = New System.Xml.XmlDocument() @@ -91,14 +88,13 @@ Notice that there's no text in the DOM view, even though it is specified in the For Each runNode As XmlNode In runNodes Log.WriteLine(runNode.Attributes("Text").Value) Next - {{endregion}} +```` Here's how to verify the text is bold: -#### __[C#]__ - - {{region }} +````C# + string rtbContents = (string)Pages.SilverlightAppTesting.SilverlightApp.RichTextBox1Richtextbox.GetProperty(new AutomationProperty("Xaml", typeof(string))); Log.WriteLine(rtbContents); @@ -114,12 +110,10 @@ Here's how to verify the text is bold: // Verify it is Bold Assert.AreEqual("Bold", attr.Value); - {{endregion}} - -#### __[VB]__ - - {{region }} +```` +````VB + Dim rtbContents As String = DirectCast(Pages.SilverlightAppTesting.SilverlightApp.RichTextBox1Richtextbox.GetProperty(New AutomationProperty("Xaml", GetType(String))), String) Log.WriteLine(rtbContents) @@ -135,6 +129,6 @@ Here's how to verify the text is bold: Assert.AreEqual(Of String)("Bold", attr.Value) - {{endregion}} +```` [1]: images/verify-text-in-rich-textbox/fig1.png \ No newline at end of file diff --git a/docs-teststudiodev/code-in-test/coded-samples/wpf/automate-clickonce-app.md b/docs-teststudiodev/code-in-test/coded-samples/wpf/automate-clickonce-app.md index eb0a5235..6cc475dd 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/wpf/automate-clickonce-app.md +++ b/docs-teststudiodev/code-in-test/coded-samples/wpf/automate-clickonce-app.md @@ -14,33 +14,23 @@ To automate a WPF application it is necessary to p.ProcessName == "WPFHelloWorld"); @@ -31,12 +28,8 @@ To work around this limitation, create a mock application to feed to Test Studio } Manager.ActiveApplication.MainWindow.RefreshVisualTrees(); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB ActiveApplication.Quit() Dim runningApp = System.Diagnostics.Process.GetProcesses().Where(Function(p) p.ProcessName = "WPFHelloWorld") @@ -47,4 +40,4 @@ To work around this limitation, create a mock application to feed to Test Studio End If Manager.ActiveApplication.MainWindow.RefreshVisualTrees() - {{endregion}} \ No newline at end of file +```` \ No newline at end of file diff --git a/docs-teststudiodev/code-in-test/coded-samples/wpf/go-through-grid-cells.md b/docs-teststudiodev/code-in-test/coded-samples/wpf/go-through-grid-cells.md index 1fb84917..82b1701b 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/wpf/go-through-grid-cells.md +++ b/docs-teststudiodev/code-in-test/coded-samples/wpf/go-through-grid-cells.md @@ -4,18 +4,15 @@ page_title: Go Through Grid Cells - Test Studio Dev Documentation description: Connect to Running App position: 4 --- -# Go Through Each Cell in a WPF RadGridView # +# Go Through Each Cell in a WPF RadGridView *I would like to go through each cell in a WPF RadGridView and perform some action or verification.* -##Solution## +## Solution This is possible with a coded solution. Here's an example that goes through all the visible cells in a WPF demo grid (as opposed to all the cells contained in the grid). It writes the text content of each cell into the test log. -#### __[C#]__ - - {{region }} - +````C# WpfApplication app = Manager.ActiveApplication; Assert.IsNotNull(app); @@ -36,12 +33,8 @@ This is possible with a coded solution. Here's an example that goes through all } rowCounter++; } - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim app As WpfApplication = Manager.ActiveApplication Assert.IsNotNull(app) @@ -60,7 +53,7 @@ This is possible with a coded solution. Here's an example that goes through all Next rowCounter += 1 Next - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/wpf/go-through-radtreeview.md b/docs-teststudiodev/code-in-test/coded-samples/wpf/go-through-radtreeview.md index 34806d22..99e79797 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/wpf/go-through-radtreeview.md +++ b/docs-teststudiodev/code-in-test/coded-samples/wpf/go-through-radtreeview.md @@ -4,18 +4,15 @@ page_title: Go Through RadTreeView - Test Studio Dev Documentation description: Go Through RadTreeView position: 3 --- -# Go Through Each Node in a WPF RadTreeView # +# Go Through Each Node in a WPF RadTreeView *I would like to go through each node in a WPF RadTreeView until a match is made.* -## Solution ## +## Solution This is possible with a coded solution. You'll expand each node and refresh the tree until you find your match. -#### __[C#]__ - - {{region }} - +````C# WpfApplication app = Manager.ActiveApplication; Assert.IsNotNull(app); Telerik.WebAii.Controls.Xaml.Wpf.RadTreeView tree = app.MainWindow.Find.ByName("treeView"); @@ -55,12 +52,8 @@ This is possible with a coded solution. You'll expand each node and refresh the break; } } - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim app As WpfApplication = Manager.ActiveApplication Assert.IsNotNull(app) Dim tree As Telerik.WebAii.Controls.Xaml.Wpf.RadTreeView = app.MainWindow.Find.ByName(Of Telerik.WebAii.Controls.Xaml.Wpf.RadTreeView)("treeView") @@ -92,6 +85,6 @@ This is possible with a coded solution. You'll expand each node and refresh the Exit While End If End While - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/coded-samples/wpf/parameterize-wpf-app.md b/docs-teststudiodev/code-in-test/coded-samples/wpf/parameterize-wpf-app.md index aca91549..d7c214f0 100644 --- a/docs-teststudiodev/code-in-test/coded-samples/wpf/parameterize-wpf-app.md +++ b/docs-teststudiodev/code-in-test/coded-samples/wpf/parameterize-wpf-app.md @@ -4,13 +4,13 @@ page_title: Parameterize WPF App - Test Studio Dev Documentation description: Parameterize WPF App position: 2 --- -# Parameterize the Location of a WPF Application # +# Parameterize the Location of a WPF Application Currently Test Studio Dev is rigged that you cannot run a WPF Test unless you provide a definite (non-parameterized) location for the application under testing. ![Configure WPF path][1] -## Solution ## +## Solution To work around this limitation, create a mock application to feed to Test Studio Dev. Then change the application under testing in a coded step. This allows you to use a parameterization method of your choosing for the app's location. @@ -24,10 +24,7 @@ To work around this limitation, create a mock application to feed to Test Studio Let's assume that the "real" application is in the following location: **C:\myapps\Go.exe**. Here's the code: -#### __[C#]__ - - {{region }} - +````C# //Shut down "mock" app ActiveApplication.Quit(); @@ -45,12 +42,8 @@ Let's assume that the "real" application is in the following location: **C:\myap //Check whether we connected successfully Assert.IsNotNull(app); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB ActiveApplication.Quit() @@ -64,15 +57,12 @@ Let's assume that the "real" application is in the following location: **C:\myap Assert.IsNotNull(app) - {{endregion}} +```` You can extend this code to include parameterization for the app's location. You can use data binding, for instance. Let's say your test is bound to a data sheet with a column named "paths": -#### __[C#]__ - - {{region }} - +````C# var pinfo = new System.Diagnostics.ProcessStartInfo(Data["paths"]); - {{endregion}} +```` [1]: images/parameterize-wpf-app/fig1.png diff --git a/docs-teststudiodev/code-in-test/element-identification/dom-navigation.md b/docs-teststudiodev/code-in-test/element-identification/dom-navigation.md index 3dc8807a..92eb1f9d 100644 --- a/docs-teststudiodev/code-in-test/element-identification/dom-navigation.md +++ b/docs-teststudiodev/code-in-test/element-identification/dom-navigation.md @@ -4,7 +4,7 @@ page_title: DOM Navigation - Test Studio Dev Documentation description: DOM Navigation position: 1 --- -#DOM Navigation# +# DOM Navigation Once you have an element, you can navigate to other elements relative to this element. Navigation methods include: @@ -20,7 +20,7 @@ Once you have an element, you can navigate to other elements relative to this el Suppose we have some HTML that looks like this: -```HTML +````HTML
DIV1 TEXT
@@ -30,13 +30,10 @@ Suppose we have some HTML that looks like this: SPAN3 TEXT
-``` +```` Here is how we can navigate around the DOM once we have a starting element: -#### __[C#]__ - - {{region }} - +````C# // Let's start with the span1 element. Element span1 = Find.ById("span1"); Element span2 = span1.GetNextSibling(); @@ -67,12 +64,8 @@ Here is how we can navigate around the DOM once we have a starting element: Assert.IsTrue(span1.IdAttributeValue.Equals("span1"), string.Format("Actual ID: {0}", span1.IdAttributeValue)); Assert.IsTrue(span2.IdAttributeValue.Equals("span2"), string.Format("Actual ID: {0}", span2.IdAttributeValue)); Assert.IsTrue(span3.IdAttributeValue.Equals("span3"), string.Format("Actual ID: {0}", span3.IdAttributeValue)); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB ' Let's start with the span1 element. Dim span1 As Element = Find.ById("span1") Dim span2 As Element = span1.GetNextSibling() @@ -103,4 +96,4 @@ Here is how we can navigate around the DOM once we have a starting element: Assert.IsTrue(span1.IdAttributeValue.Equals("span1"), String.Format("Actual ID: {0}", span1.IdAttributeValue)) Assert.IsTrue(span2.IdAttributeValue.Equals("span2"), String.Format("Actual ID: {0}", span2.IdAttributeValue)) Assert.IsTrue(span3.IdAttributeValue.Equals("span3"), String.Format("Actual ID: {0}", span3.IdAttributeValue)) - {{endregion}} \ No newline at end of file +```` \ No newline at end of file diff --git a/docs-teststudiodev/code-in-test/element-identification/find-expressions.md b/docs-teststudiodev/code-in-test/element-identification/find-expressions.md index e6216b72..2c4f3398 100644 --- a/docs-teststudiodev/code-in-test/element-identification/find-expressions.md +++ b/docs-teststudiodev/code-in-test/element-identification/find-expressions.md @@ -4,7 +4,7 @@ page_title: Find Expressions - Test Studio Dev Documentation description: Find Expressions position: 1 --- -#HTML and XAML Find Expressions# +# HTML and XAML Find Expressions FindExpression's are the replacement/evolution of FindParam's. We will be using FindExpression's as the base for all element searches in the DOM, HWnd, or control trees (including Translator Locators). The key design goal for FindExpressions is to enable a flexible, rich and extensible search definition pattern that can be used across all of our Telerik technologies. This will enable our customers to carry over their product experience as they move across our product stacks making the learning curve for customers moving from one technology to another minimal.ma @@ -32,28 +32,28 @@ FindExpression's are the following: 6.Can't easily be leveraged for searches within other technologies. -##Basic Concept## +## Basic Concept The key to understanding FindExpression's is to understand its basic component: the FindClause. A FindClause is a name/value pair with an optional comparison operator. A FindExpression consists of 1-n FindClauses. For example: -###FindClauses Without Operators### +### FindClauses Without Operators -``` +```` TagName=div id=bar innermarkup=hellothere -``` +```` -###FindClauses With Operators### +### FindClauses With Operators -``` +```` name=~bar [name attribute partially contains bar] automationid=^hat [the automation id of an element starts with hat] -``` +```` **Note:** The optional operator is ALWAYS the first character after the = in the expression. This special character can be escaped with a preceding ' character if it is meant to be interpreted as a literal character. -###Supported Operators### +### Supported Operators @@ -108,17 +108,17 @@ automationid=^hat [the automation id of an element starts with hat] The name portion of the clause can be a well known enumeration that a certain technology (i.e. HTML, XAML) recognizes as a certain search pattern. For example, in HTML: -``` +```` xpath=HTML[0]/div[1] -``` +```` is interpreted by the HTML search tree as a specific search that requires XPATH interpretation. -``` +```` automationid=?sam -``` +```` -##Constructing FindExpressions## +## Constructing FindExpressions Each technology (HTML, Silverlight, etc.) will define its own FindExpression that inherits from the base FindExpression object. All FindExpression's need only one constructor to define any type of search. @@ -126,14 +126,11 @@ For example: Find the HTML element with an id that ends with 'sam' and also has a class attribute that contains bar and also has a text content that does not contain foo. -#### __[C#]__ - - {{region }} - +````C# HtmlFindExpression expr = new HtmlFindExpression("id=bar","|","tagindex=td:0","|","tagname=img","src=~png"); - {{endregion}} +```` -##Hierarchy Constraint## +## Hierarchy Constraint You can also describe a certain hierarchal constraint to be applied against that FindExpression so that the decision on whether a specific element matches a specific translator or not is not solely based on the tag but also takes into consideration its hierarchical position. For example a tag that looks like
might be part of a grid while at the same time other elements on the page could contain that tag. The only way to distinguish whether that tag is part of the grid is to inspect its parent or child hierarchy. @@ -147,19 +144,18 @@ A hierarchy constraint contains two pieces of data: For example, suppose we have the following HTML code snippet to deal with: -```HTML +````HTML
-``` +```` Now we want to match the div tag that has class='bar' and its parent's parent has an id='foo1': -#### __[C#]__ - - {{region }} +````C# + // This expression will locate both p tags at [0] & [3] HtmlFindExpression expression = new HtmlFindExpression("class=bar", "tagname=div"); @@ -170,12 +166,10 @@ Now we want to match the div tag that has class='bar' and its parent's parent ha // -2 signifies two parents up. // Note that HierarchyConstraints are [1] based. Zero signifies the target element or reference point. expression.AddHierarchyConstraint(new HierarchyConstraint(parentExpr, -2)); - {{endregion}} - -#### __[VB]__ - - {{region }} +```` +````VB + ' This expression will locate both p tags at [0] & [3] Dim expression As New HtmlFindExpression("class=bar", "tagname=div") @@ -186,13 +180,13 @@ Now we want to match the div tag that has class='bar' and its parent's parent ha ' -2 signifies two parents up. ' Note that HierarchyConstraints are [1] based. Zero signifies the target element or reference point. expression.AddHierarchyConstraint(New HierarchyConstraint(parentExpr, -2)) - {{endregion}} +```` The resulting expression now will match [3] ONLY. Here is a more involved scenario: -```HTML +````HTML

@@ -204,13 +198,13 @@ Here is a more involved scenario:

-``` +```` If we wish the constraint to match the first child of the parent's parent (i.e. [2]) and to be an 'span' instead, that is also doable. The path in that case is -2, 1 => Two parents up, one down at index 1. (Or -1, -1, 1, both are the same) and the second FindExpression will be "TagName=span" instead of "id=foo1". -##HtmlFindExpression Types## +## HtmlFindExpression Types The following is a list of the types that can appear on the left side of the expression in HtmlFindExpressions: @@ -234,7 +228,7 @@ The following is a list of the types that can appear on the left side of the exp * XPath - search for an element at the specified XPath expression. -##XamlFindExpression Types## +## XamlFindExpression Types The following is a list of the types that can appear on the left side of the expression in XamlFindExpressions: diff --git a/docs-teststudiodev/code-in-test/element-identification/find-param-as-xml-data.md b/docs-teststudiodev/code-in-test/element-identification/find-param-as-xml-data.md index 9fffa750..9c3ad0f3 100644 --- a/docs-teststudiodev/code-in-test/element-identification/find-param-as-xml-data.md +++ b/docs-teststudiodev/code-in-test/element-identification/find-param-as-xml-data.md @@ -4,7 +4,7 @@ page_title: FindParam as XML Data - Test Studio Dev Documentation description: FindParam as XML Data position: 1 --- -#FindParams as External XML Data Sources# +# FindParams as External XML Data Sources **Note:** This topics assumes a basic understanding of FindParam objects. It is recommended to read the Finding Page Elements topic first before reading this topic. @@ -18,14 +18,12 @@ By doing so we can: * Enable the same test logic/code to run against different versions of the same application that differ in UI layout or DOM structure. By versioning the external data sources per each different application version, we can configure our tests to consume different data source versions for each application being tested without having to duplicate test code and worry about maintaining multiple code bases. This approach can dramatically cut down maintenance and support costs especially for product teams that maintain and service multiple versions of the same application. It is also a great approach to take on if you are starting a new project and you think you will end up having to support multiple versions of that product in the future. -##Building FindParam Data Sources## +## Building FindParam Data Sources We currently don't offer any UI design tools that can help build these data sources directly from your application. Therefore, to build these data source we need to craft our FindParams manually and then using FindParam and FindParamCollection XML serialization methods, store the generated sources to our storage medium of choice (i.e. database, file system ...etc). The sample below shows an example of how to build an XML file that can be later consumed by your test code to identify elements to use in the automation logic. -#### __[C#]__ - - {{region }} +````C# // First we build the list of FindParam objects we want serialized // and add them to a FindParamCollection object. @@ -48,16 +46,13 @@ The sample below shows an example of how to build an XML file that can be later // in your choice of storage medium. // // string serializedParams = paramCol.ToXml(); - {{endregion}} +```` -##Consuming the Data Sources## +## Consuming the Data Sources The are three different methods you can use to consume the data source generated above. We can deserialize the data back into a FindParamCollection object and then select one of these FindParams to locate a specific element on the page. -#### __[C#]__ - - {{region }} - +````C# // Given we already have a datasource of FindParam's stored on a different medium, // we can deserialize the data back into a FindParamCollection object and then // select one of these FindParam's to locate a specific element on the page @@ -69,14 +64,11 @@ The are three different methods you can use to consume the data source generated // Perform your automation actions on the element. ActiveBrowser.Actions.SetText(inputText, "sometext"); - {{endregion}} +```` Alternatively we can can create a Dictionary lookup object from the external datasource. -#### __[C#]__ - - {{region }} - +````C# // FindParams can be completely extracted out of test code and stored in an external xml file. // // This allows you to: @@ -101,14 +93,11 @@ Alternatively we can can create a Dictionary lookup object from the external dat // Note: // 1. If you have the XML string stored in a DataBase, you can use the Find.FromXml() // to find these elements directly from the string. - {{endregion}} +```` Finally we can load the external datasource using a FindParamAttribute. -#### __[C#]__ - - {{region }} - +````C# // The SupportFiles\FindElementsFromFile.xml shows a sample xml file with two FindParams defined; one for // the MainTable and the other for ProgramsTable. @@ -120,9 +109,9 @@ Finally we can load the external datasource using a FindParamAttribute. Assert.IsTrue(Find.Elements.Count == 2); Assert.IsTrue(Find.Elements["MainTable"].ElementType == ElementType.Table); Assert.IsTrue(Find.Elements["ProgramsTable"].ElementType == ElementType.Table); - {{endregion}} +```` -##Managing and Organizing Data Sources for an Entire Application## +## Managing and Organizing Data Sources for an Entire Application There are probably many ways you can think of to organize your external data sources for your an entire application. We though want to discuss three approaches you might want to consider. You can organize your external sources: diff --git a/docs-teststudiodev/code-in-test/element-identification/find-param-objects.md b/docs-teststudiodev/code-in-test/element-identification/find-param-objects.md index ec5a6454..fe3f01c2 100644 --- a/docs-teststudiodev/code-in-test/element-identification/find-param-objects.md +++ b/docs-teststudiodev/code-in-test/element-identification/find-param-objects.md @@ -4,27 +4,21 @@ page_title: FindParam Objects - Test Studio Dev Documentation description: FindParam Objects position: 1 --- -#FindParam Objects# +# FindParam Objects All the identification methods exposed by the 'Find' object described above use FindParam objects under the covers to describe the desired element within the DOM tree to Telerik's identification engine. The engine itself can only understand searches using FindParam's. You can directly invoke element searches against the identification engine using the Find.ByParam() or Find.AllByParam() methods. When FindParam's are used directly to define a search, they enable a richer, consistent and more flexible way to describe a certain element than just the Find.Byxx() which were designed to cater for the most common scenarios. For example, if you want to describe the second 'div' on a page with class=myclass. You can't directly do that using the Find.Byxx() methods unless you first find the second 'div' element then inspect its attributes to figure out if the class attribute is set 'myclass'. With FindParam objects, you can simply describe that search by: -#### __[C#]__ - - {{region }} - +````C# // The find object will only return an element if all conditions // exist. Else NULL. Element e = Find.ByParam(new FindParam("div", 1,"class=myclass")); Assert.IsNotNull(e); - {{endregion}} +```` Here are some other examples: -#### __[C#]__ - - {{region }} - +````C# Element e; // Find.ById() is implemented as @@ -42,9 +36,9 @@ Here are some other examples: p.ContentType = FindContentType.InnerMarkup; e = Find.ByParam(p); Assert.IsNotNull(e); - {{endregion}} +```` -##Chained Identification## +## Chained Identification Chained identification is simply using multiple FindParam objects (as in a chain) to identify an element. Chained identification is used to help simplify locating nested and complex markup elements and promote a more robust approach for element identification in these scenarios. @@ -54,7 +48,7 @@ To help understand chained identification better, let's take a concrete example. Many times developers find themselves struggling with a markup nesting similar to the one below; particularly on rich content websites when heavy styling is applied or when using dynamic web development technologies like ASP.NET. In the sample below, the outer table contains an id attribute but the rest of the nested tables don't. Let's assume a test needs to access the inner most table to verify its content. Instead of looking up the overall 'table' occurrence index over an entire document which can easily become difficult on large complex pages, we would like to first identify the "table1" element by its id and then simply count two table occurrences from it (occurrence index 1) to locate the inner table. -```HTML +````HTML
@@ -80,15 +74,12 @@ Many times developers find themselves struggling with a markup nesting similar t
-``` +```` Below is the chained identification code to accomplish that. -#### __[C#]__ - - {{region }} - +````C# // Generic chained identification FindParam idtable1 = new FindParam("id=table1"); @@ -99,8 +90,8 @@ Below is the chained identification code to accomplish that. Element innerTable = Find.ByParam(new FindParam[] { idtable1, innertable }); Assert.IsNotNull(innertable); Assert.AreEqual(3, innerTable.Children[0].Children.Count); - {{endregion}} +```` -##Defining FindParam Objects Outside Test Code (i.e. FindParam Serialization)## +## Defining FindParam Objects Outside Test Code (i.e. FindParam Serialization) FindParam objects support serialization including the FindParamCollection. This support allows you to define your FindParam's outside your test code and consume them as data sources. This enables you to be more agile when changes are made to your application by simply updating the xml that defines your FindParam objects. This topic is covered in more detail under FindParams as External Xml DataSources. diff --git a/docs-teststudiodev/code-in-test/element-identification/finding-page-elements.md b/docs-teststudiodev/code-in-test/element-identification/finding-page-elements.md index 1d838545..aaeaa7fc 100644 --- a/docs-teststudiodev/code-in-test/element-identification/finding-page-elements.md +++ b/docs-teststudiodev/code-in-test/element-identification/finding-page-elements.md @@ -5,33 +5,7 @@ description: "Test Studio Find methods. Progress Testing Framework Find.By metho position: 1 --- - - -# Finding Page Elements # +# Finding Page Elements Telerik Testing Framework provides one of the richest markup identification infrastructures currently available on the market. It builds on top of commonly known element identification methods like 'getElementById', 'getElementByName' or 'XPath' and extends them to provide identification routines that cater more to application automation scenarios. In addition to maintaining a simple and easy to use set of APIs, Telerik Testing Framework introduces a consistent and extensible way to build identification and persist it using 'FindParam' objects. @@ -39,7 +13,7 @@ All the Find.Byxxx methods now support LINQ queries. It is important to understand how Telerik's identification method works because that understanding will allow you to exploit the power of these identification methods to build robust automation quicker. -##Element Identification Overview## +## Element Identification Overview The following identification methods are supported: @@ -48,56 +22,61 @@ The following identification methods are supported: MethodsDescriptionExample - **Find.ById()** + Find.ById() Searches for an element contained in a markup document using its set 'id' attribute. When the desired 'id' matches an element's id, the element is returned - identical to getElementById -``` + +```` // Find element with id=input1 Element e = Find.ById("input1"); -``` +```` - **Find.ByName()** + Find.ByName() Searches for an element contained in a markup document using its set 'name' attribute. When the desired 'name' matches an element's name, the element is returned -``` + +```` // Find element with name=goButton Element e = Find.ByName("goButton") -``` +```` - **Find.ByImage()**
- **Find.AllByImage()** + Find.ByImage()
+ Find.AllByImage() Searches for an element or 'All' elements that look like a predefined image -``` + +```` // Specify the predefined image on which the search will be based System.Drawing.Image img1 = System.Drawing.Image.FromFile(@"C:\sampleImg.png"); // Find an element that looks like the predefind image var elementImg1 = Manager.ActiveBrowser.Find.ByImage(img1, 70); // the second argument is the threshold % to use, while searching for the image // Cast the found element to be able to use it. The type of located element needs to be specified. HtmlButton btn1 = elementImg1.As(); -``` +```` - **Find.ByTagIndex()** + Find.ByTagIndex() Searches for an element using its tag name occurrence index. Finds the element at the specified occurrence index and returns it. This method uses zero based indexing. -``` + +```` // Find the 3rd occurrence of table tag Element table = Find.ByTagIndex("table", 2); -``` +```` - **Find.ByAttributes()**
- **Find.AllByAttributes()** + Find.ByAttributes()
+ Find.AllByAttributes() Searches for an element or 'All' elements using an 'exact' or 'partial' list of attribute values (You can specify 1-N attribute/value pairs). When all attribute values match, the element or collection of elements is returned. -``` + +```` // Find the first element with attribute class=myclass Element e = Find.ByAttributes("class=myclass"); // Find the first element with attribute class=myclass @@ -105,15 +84,16 @@ Element e = Find.ByAttributes("class=myclass"); Element e = Find.ByAttributes("class=myclass", "src=~foo.gif"); // Find all elements with class=myclass and src has a partial foo.gif IList allbtns = Find.AllByAttributes("class=myclass", "src=~foo.gif"); -``` +```` - **Find.ByContent()**
- **Find.AllByContent()** + Find.ByContent()
+ Find.AllByContent() Searches for an element or 'All' elements using 'exact', 'partial' or 'regex' of the element content. The element content can be: InnerText, InnerMarkup, OuterMarkup, TextContent (default), StartTagContent. -``` + +```` // Find element with TextContent has literal value: Education // l: signifies literal Element e = Find.ByContent("l:Education"); @@ -138,64 +118,68 @@ IList alle = Find.AllByContent("p:car") // TextContent of div1 : Text1 {non-recursive} // // Default for ByContent is TextContent which is the most common usage. -``` +```` - **Find.ByExpression()**
- **Find.AllByExpression()** + Find.ByExpression()
+ Find.AllByExpression() Searches for an element or 'All' elements matching an HtmlFindExpression. The HtmlFindExpression cannot use any type of hierarchical expressions including tag index path expressions, HTML path expressions, and XPath expressions. -``` + +```` // Create an HtmlFindExpression element HtmlFindExpression expr = new HtmlFindExpression("id=?sam","class=~bar","textcontent=!foo"); // Return all elements matching HtmlFindExpression IList allSams = Find.AllByExpression(expr); -``` +```` - **Find.ByXPath()**
- **Find.AllByXPath()** + Find.ByXPath()
+ Find.AllByXPath() Searches for an element or 'All' elements using an XPath expression. WebAii supports the .NET Framework XPath implementation. -``` + +```` // Find the banner img element Element img = Find.ByXPath("//body[1]/table[1]/tbody[1]/tr[1]/td[1]/img[1]"); // Find all times with id=div IList allDivs = Find.AllByXPath("/descendant::node()[starts-with(@id,'div')]"); -``` +```` - **Find.ByCssSelector()**
- **Find.AllByCssSelector()** + Find.ByCssSelector()
+ Find.AllByCssSelector() Searches for an element or 'All' elements using a css selector query. -``` + +```` // Find the active link HtmlAnchor activeLink = Find.ByCssSelector("a:active"); // Find all links IList allLinks = Find.AllByCssSelector("a"); -``` +```` - **Find.AllByTagName()** + Find.AllByTagName() Searches for 'All' elements with the specified tag name and returns it as a list of elements. -``` + +```` // Return all img elements IList allimg = Find.AllByTagName("img"); -``` +```` - **Find.ByNodeIndexPath()** + Find.ByNodeIndexPath() Searches for an element using dom tree node index paths. This identification is done using an xpath like approach that simply describes the hierarchy path to a specific element using the node index within the hierarchy without having to specify the tag name at each level. This identification method can be chosen in cases where a segment of the DomTree hierarchy at a specific location is consistent but element type changes. For example, if an element you are trying to target is the direct child of another element that fluctuates between a span and div, you can choose this identification method to provide a consistent way to identify that element. -``` +```` Given this DOM: @@ -217,25 +201,27 @@ Given this DOM: // We can find the element by: Element target = Find.ByNodeIndexPath("0/2/0/1"); -``` +```` - **Find.FromCollection()** + Find.FromCollection() Finds all elements with the FindParams in the passed in collection. -``` + +```` FindParamCollection col = FindParamCollection.LoadFromXml(xml); return this.FromCollection(col); -``` +```` - **Find.ByCustom()**
- **Find.AllByCustom()** + Find.ByCustom()
+ Find.AllByCustom() Searches for an element or 'All' elements using a custom predicate. -``` + +```` // Find the first input button having an ID of 'input1' HtmlInputButton btn = Find.ByCustom( delegate(HtmlInputButton e) @@ -247,12 +233,12 @@ HtmlInputButton btn = Find.ByCustom( } ); Assert.IsNotNull(btn); -``` +```` -##Identification Methods Usage## +## Identification Methods Usage Telerik Testing Framework identification methods are accessible using the **Find** object that is exposed as a property off of the 'Browser' object : *Manager.ActiveBrowser.Find.Byxx(...)* and also as a property off of each TestRegion object : *TestRegion.Find.Byxx(...)*. @@ -260,7 +246,7 @@ The difference between the Find object off of the Browser class (Root Base Ident With TestRegions, depending on the areas of the application that each automated test is targeting, you can use different Find objects to give each test a greater level of independence and shield it from product changes outside its target area. This topic is discussed in greater details in Introduction to TestRegions. -##Matching Syntax Used in Parameters## +## Matching Syntax Used in Parameters The Byxxx functions that take a nameValuePairs parameter recognizes the following matching syntax: @@ -280,11 +266,11 @@ The Byxxx functions that take a content string parameter recognizes the followin * Prefix the string parameter with 'x:' for regular expression matching. e.g. 'x:[*foo*]' will match any content containing the string 'foo' in the middle of it. For more information about regular expressions see: http://msdn.microsoft.com/en-us/library/2k3te2cs.aspx. -##Identification Sample## +## Identification Sample To help illustrate the above identification methods, let's use the following sample application. Note that this application uses TestRegions excessively to allow it to demonstrate the different identification methods that can be performed using both **RBI** and **RGBI**: -```HTML +````HTML @@ -328,11 +314,11 @@ To help illustrate the above identification methods, let's use the following sam -``` +```` The code below shows the different methods you can use in your test code to identify elements. Note in the sample below, we are using Visual Studio's Assert class to demonstrate how different objects can be identified differently and to illustrate how to scope the identification with TestRegions using RGBI and across the entire document DomTree using RBI. -```C# +````C# // Set the short-cuts to the main automation objects. Browser brwser = mgr.ActiveBrowser; Find rootFind = brwser.Find; @@ -386,8 +372,8 @@ Assert.IsTrue(rootFind.ByNodeIndexPath("1/0/0").TagName.Equals("div", StringComp //*** Using name Assert.IsNull(r1.Find.ByName("bla")); -``` -```VB +```` +````VB ' Set the short-cuts to the main automation objects. Dim brwser As ArtOfTest.WebAii.Core.Browser = Manager.ActiveBrowser Dim rootFind As Find = brwser.Find @@ -441,4 +427,4 @@ Assert.IsTrue(rootFind.ByNodeIndexPath("1/0/0").TagName.Equals("div", StringComp '*** Using name Assert.IsNull(r1.Find.ByName("bla")) -``` \ No newline at end of file +```` \ No newline at end of file diff --git a/docs-teststudiodev/code-in-test/element-identification/linq-queries.md b/docs-teststudiodev/code-in-test/element-identification/linq-queries.md index 3ca34780..0bde9878 100644 --- a/docs-teststudiodev/code-in-test/element-identification/linq-queries.md +++ b/docs-teststudiodev/code-in-test/element-identification/linq-queries.md @@ -4,7 +4,7 @@ page_title: LINQ Queries - Test Studio Dev Documentation description: LINQ Queries position: 1 --- -#LINQ Queries# +# LINQ Queries The Find.Byxxx methods now support Language-Integrated Query (LINQ) queries. Some of the Find functions are intended to be used by LINQ queries only. These include: @@ -13,24 +13,27 @@ The Find.Byxxx methods now support Language-Integrated Query (LINQ) queries. Som - + - - - + + +
MethodsDescriptionExample
**AllElements** + +**AllElements** Gets a IEnumerable for all elements to be used for LINQ queries. var inlineStyledElements = Find.AllElements().Where(element =>
element.ContainsAttribute("style"));
**AllControls**Gets an IEnmerable for TControl to be used for LINQ queries. This will return only elements that are convertable to TControl.var images = Find.AllControls(); + +**AllControls**Gets an IEnmerable for TControl to be used for LINQ queries. This will return only elements that are convertable to TControl. + +`var images = Find.AllControls();`
Using LINQ we can create strongly typed advanced queries with intellisense support that we couldn't before. The most basic LINQ example is something like this: -### __[VB]__ - - {{region }} - +````C# // Find all images on a page. var images = Find.AllControls(); @@ -38,14 +41,11 @@ Using LINQ we can create strongly typed advanced queries with intellisense suppo { // Do what you want with each img. } - {{endregion}} +```` We can also use lambda expressions like this: -### __[VB]__ - - {{region }} - +````C# // Find the first element that contains "Go Google" Element el = Find.ByCustom(e => e.TextContent.Contains("Go Google")); @@ -69,4 +69,4 @@ We can also use lambda expressions like this: // Fetch a list of HTML anchor's that contain 'a' in the ID IList li = (from b in Find.AllElements() where b.IdAttributeValue.Contains("a") select b).ToArray(); Assert.IsTrue(li.Count > 0); - {{endregion}} \ No newline at end of file +```` \ No newline at end of file diff --git a/docs-teststudiodev/code-in-test/features-in-code.md b/docs-teststudiodev/code-in-test/features-in-code.md index 7b16cc59..ceebf23c 100644 --- a/docs-teststudiodev/code-in-test/features-in-code.md +++ b/docs-teststudiodev/code-in-test/features-in-code.md @@ -57,7 +57,7 @@ A code behind file can be generated for each test where you need to implement co You can implement any custom logic organized in standalone code files located in your project. This includes but is not limited to classes and functions which perform common or often re-used functionality and can be called by your coded steps or code behind methods. The only requirement is to define classes in the project namespace else they will not be accessible. [1]: images/fig1.png -[2]: images/fig2.png + [3]: images/fig3.png [4]: images/fig4.png [5]: images/fig5.png \ No newline at end of file diff --git a/docs-teststudiodev/code-in-test/generate-unit-test.md b/docs-teststudiodev/code-in-test/generate-unit-test.md index 054427c5..d26e83c0 100644 --- a/docs-teststudiodev/code-in-test/generate-unit-test.md +++ b/docs-teststudiodev/code-in-test/generate-unit-test.md @@ -22,15 +22,14 @@ A unit test file and XML file containing your data are created in your Test Proj **Note:** When you convert an entire test to code, it doesn't take into account the **Enable Silverlight** setting. You need to enable it in code prior to the LaunchNewBrowser call: -```C# +````C# Manager.Settings.Web.EnableSilverlight = true; Manager.LaunchNewBrowser(); -``` - -```VB +```` +````VB Manager.Settings.Web.EnableSilverlight = True Manager.LaunchNewBrowser() -``` +```` ## Preview Code diff --git a/docs-teststudiodev/code-in-test/html-control-suite/custom-html-control.md b/docs-teststudiodev/code-in-test/html-control-suite/custom-html-control.md index 6620429b..098c3de5 100644 --- a/docs-teststudiodev/code-in-test/html-control-suite/custom-html-control.md +++ b/docs-teststudiodev/code-in-test/html-control-suite/custom-html-control.md @@ -4,13 +4,13 @@ page_title: Custom HtmlControl - Test Studio Dev Documentation description: Custom HtmlControl position: 2 --- -#Creating Your Own Custom HtmlControls# +# Creating Your Own Custom HtmlControls Let's suppose you're testing a web site that uses a third party or custom control. You can easily create your own custom HtmlControl class and then design tests that interact with the custom control via your custom HtmlControl class. As an example, let's create a custom HtmlControl that wraps the ASP.NET calendar control. We'll give it some methods for reading and controlling the date selection along with a custom ClientSideLocator just for an example. First here's our ASPX web page containing a calendar control that we want to test -``` +```` <% @ Page Language="C#" MasterPageFile="~/AppMaster.master" Title="Untitled Page" %> <% @ Import Namespace="System.Data" %> <% @ Register Assembly="ArtOfTest.WebAii.AspNet" Namespace="ArtOfTest.WebAii.AspNet.WebControls" TagPrefix="test" %> @@ -146,14 +146,11 @@ As an example, let's create a custom HtmlControl that wraps the ASP.NET calendar -``` +```` Let's put together our custom HtmlControl that we can use interact with an ASP.NET calendar control: -#### __[C#]__ - - {{region }} - +````C# public class AspNetCalendar : HtmlTable { /// @@ -284,12 +281,8 @@ Let's put together our custom HtmlControl that we can use interact with an ASP.N return GetMonth(); } } - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Public Class AspNetCalendar Inherits HtmlTable ''' @@ -408,7 +401,7 @@ Let's put together our custom HtmlControl that we can use interact with an ASP.N Return GetMonth() End Function End Class - {{endregion}} +```` Notice how we derive from an HtmlTable. That way we can take advantage of all the functionality already built into a standard table. We'll just add all the functions useful for our calendar control which include: diff --git a/docs-teststudiodev/code-in-test/html-control-suite/drag-and-drop.md b/docs-teststudiodev/code-in-test/html-control-suite/drag-and-drop.md index 65f36f0c..5c22ce3c 100644 --- a/docs-teststudiodev/code-in-test/html-control-suite/drag-and-drop.md +++ b/docs-teststudiodev/code-in-test/html-control-suite/drag-and-drop.md @@ -4,7 +4,7 @@ page_title: Drag & Drop - Test Studio Dev Documentation description: Drag & Drop position: 2 --- -#How to Drag and Drop# +# How to Drag and Drop The HTML element wrapper classes make mouse drag & drop operations significantly easier. There are 7 different drag methods defined: @@ -33,10 +33,7 @@ The HTML element wrapper classes make mouse drag & drop operations significantly Suppose we have an sales by area table that supports drag & drop between cells. We can easily drag & drop the contents of one cell to another cell like this: -#### __[C#]__ - - {{region }} - +````C# // Find the sales table HtmlTable salesTable = Find.ById("area_1_table"); @@ -46,13 +43,8 @@ salesTable.BodyRows[3].Cells[1].DragTo(salesTable.BodyRows[2].Cells[1]); // Verify the new row subtotals are correct Assert.AreEqual(salesTable.Rows[2].Cells[5].TextContent, "$3342.78"); Assert.AreEqual(salesTable.Rows[3].Cells[5].TextContent, "$2175.17"); -{{endregion}} - - -#### __[VB]__ - - {{region }} - +```` +````VB ' Find the sales table Dim salesTable As HtmlTable = Find.ById(Of HtmlTable)("area_1_table") @@ -62,4 +54,4 @@ salesTable.BodyRows(3).Cells(1).DragTo(salesTable.BodyRows(2).Cells(1)) ' Verify the new row subtotals are correct Assert.AreEqual(salesTable.Rows(2).Cells(5).TextContent, "$3342.78") Assert.AreEqual(salesTable.Rows(3).Cells(5).TextContent, "$2175.17") -{{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/html-control-suite/element-styles.md b/docs-teststudiodev/code-in-test/html-control-suite/element-styles.md index 1db155db..c46071bf 100644 --- a/docs-teststudiodev/code-in-test/html-control-suite/element-styles.md +++ b/docs-teststudiodev/code-in-test/html-control-suite/element-styles.md @@ -4,7 +4,7 @@ page_title: Element Styles - Test Studio Dev Documentation description: Element Styles position: 2 --- -#Element Styles and HtmlStyle, GetStyle, GetComputedStyle# +# Element Styles and HtmlStyle, GetStyle, GetComputedStyle Telerik Testing Framework includes a good set of classes and methods for reading and validating the styles often attached to HTML controls. With this feature you can do things like: @@ -25,10 +25,7 @@ Telerik Testing Framework includes a good set of classes and methods for reading Let's look at some code samples to see how this works: -#### __[C#]__ - - {{region }} - +````C# // Verify the color of the warning text is Red HtmlSpan warningSpan = Find.ById("Warning"); HtmlStyle warningColorStyle = warningSpan.GetStyle("color"); @@ -64,14 +61,11 @@ HtmlStyle warningMarginStyle = warningSpan.GetStyle("margin"); Assert.IsTrue(warningMarginStyle.IsInt()); int warningMargin = warningMarginStyle.ToInt(); Assert.AreEqual(30, warningMargin); -{{endregion}} +```` -#### __[VB]__ - - {{region }} - +````VB ' Verify the color of the warning text is Red Dim warningSpan As HtmlSpan = Find.ById(Of HtmlSpan)("Warning") Dim warningColorStyle As HtmlStyle = warningSpan.GetStyle("color") @@ -105,17 +99,14 @@ Assert.AreEqual(30, warningMargin); Assert.IsTrue(warningMarginStyle.IsInt()) Dim warningMargin As Integer = warningMarginStyle.ToInt() Assert.AreEqual(30, warningMargin) - {{endregion}} +```` The GetComputedStyle is especially powerful. It will follow the CSS chain up through all the parent elements until it finds the first matching style and returns the value picked up from that style. This is quite different from GetStyle which only returns an explicitly set style value on the specific element (i.e. it does not follow the CSS chain). If no explicit value has been set then GetStyle returns an empty string for the value. Here's an example: -#### __[C#]__ - - {{region }} - +````C# // GetStyle returns the value of an explicit style applied to the element. // If the element does not have an explicit style applied, GetStyle returns an empty value. // Since our warning span does not have the padding style explicitly applied to it, @@ -128,13 +119,10 @@ Here's an example: // Therefore GetComputedStyle on the warning span will return the value set in the parent form tag. paddingStyle = warningSpan.GetComputedStyle("padding"); Assert.IsFalse(string.IsNullOrEmpty(paddingStyle.Value)); - {{endregion}} - - -#### __[VB]__ +```` - {{region }} +````VB ' GetStyle returns the value of an explicit style applied to the element. ' If the element does not have an explicit style applied, GetStyle returns an empty value. ' Since our warning span does not have the padding style explicitly applied to it, @@ -147,4 +135,4 @@ Here's an example: ' Therefore GetComputedStyle on the warning span will return the value set in the parent form tag. paddingStyle = warningSpan.GetComputedStyle("padding") Assert.IsFalse(String.IsNullOrEmpty(paddingStyle.Value)) - {{endregion}} \ No newline at end of file +```` \ No newline at end of file diff --git a/docs-teststudiodev/code-in-test/html-control-suite/find-and-navigate-elements.md b/docs-teststudiodev/code-in-test/html-control-suite/find-and-navigate-elements.md index 9131b557..b54e7f2c 100644 --- a/docs-teststudiodev/code-in-test/html-control-suite/find-and-navigate-elements.md +++ b/docs-teststudiodev/code-in-test/html-control-suite/find-and-navigate-elements.md @@ -4,15 +4,12 @@ page_title: Find and Navigate Elements - Test Studio Dev Documentation description: Find and Navigate Elements position: 2 --- -#Finding and Navigating HTML Elements# +# Finding and Navigating HTML Elements The example above used just two of the available find methods, the Find.ById<**TControl**> and the Find.AllByTagName<**TControl**> and did not take advantage of the powerful navigation features. Let's look at some other find examples: -#### __[C#]__ - - {{region }} - +````C# // Find the first table on the page. HtmlTable outertable = Find.ByTagIndex("table", 0); @@ -42,13 +39,10 @@ Assert.AreEqual(1, imgCtrls.Count); // Find the
section containing the Eastern US Division sales report HtmlDiv EasternUSDivision = Find.ByContent("Eastern US Division", FindContentType.TextContent); Assert.IsNotNull(EasternUSDivision); -{{endregion}} - - -#### __[VB]__ +```` - {{region }} +````VB ' Find the first table on the page. Dim outertable As HtmlTable = Find.ByTagIndex(Of HtmlTable)("table", 0) Assert.AreEqual(3, outertable.Rows.Count) @@ -79,15 +73,12 @@ Assert.IsNotNull(EasternUSDivision); ' Find the
section containing the Eastern US Division sales report Dim EasternUSDivision As HtmlDiv = Find.ByContent(Of HtmlDiv)("Eastern US Division", FindContentType.TextContent) Assert.IsNotNull(EasternUSDivision) - {{endregion}} +```` The above example demonstrates how to use many of the more useful find methods. There are many more. It would take up too much space to try and document them all here. Refer to the API reference to learn about the others. Let's look at some HTML navigation functions: -#### __[C#]__ - - {{region }} - +````C# // Traverse the control tree upwards too. You can easily // Find the container control of a certain type from its children. @@ -113,14 +104,11 @@ The above example demonstrates how to use many of the more useful find methods. // Find the form this table is contained in. HtmlForm form1 = table2.Parent(); Assert.IsTrue(form1.ID.Equals("form1")); - {{endregion}} +```` -#### __[VB]__ - - {{region }} - +````VB ' Traverse the control tree upwards too. You can easily ' Find the container control of a certain type from its children. @@ -147,4 +135,4 @@ Assert.IsTrue(table2.ID.Equals(outertable.ID)) ' Find the form this table is contained in. Dim form1 As HtmlForm = table2.Parent(Of HtmlForm)() Assert.IsTrue(form1.ID.Equals("form1")) -{{endregion}} \ No newline at end of file +```` \ No newline at end of file diff --git a/docs-teststudiodev/code-in-test/html-control-suite/get-set-properties.md b/docs-teststudiodev/code-in-test/html-control-suite/get-set-properties.md index 23ab10b4..12ca8dae 100644 --- a/docs-teststudiodev/code-in-test/html-control-suite/get-set-properties.md +++ b/docs-teststudiodev/code-in-test/html-control-suite/get-set-properties.md @@ -4,15 +4,12 @@ page_title: Get & Set Properties - Test Studio Dev Documentation description: Get & Set Properties position: 2 --- -#Getting and Setting Properties# +# Getting and Setting Properties We can also get and set the current value of any property of the wrapped element: -#### __[C#]__ - - {{region }} - +````C# // Get whether a checkbox is enabled or disabled. HtmlInputCheckBox cks = Find.ById("checkbox1"); bool disabled = cks.GetValue("disabled"); @@ -36,14 +33,11 @@ string strColor = mySpan.GetStyleValue("color"); // style. HtmlStyle styleMargin = mySpan.GetComputedStyle("margin"); string strMargin = mySpan.GetComputedStyleValue("margin"); -{{endregion}} +```` -#### __[VB]__ - - {{region }} - +````VB ' Get whether a checkbox is enabled or disabled. Dim cks As HtmlInputCheckBox = Find.ById(Of HtmlInputCheckBox)("checkbox1") Dim disabled As Boolean = cks.GetValue(Of Boolean)("disabled") @@ -61,6 +55,6 @@ Dim strColor As String = mySpan.GetStyleValue("color") ' style. Dim styleMargin As HtmlStyle = mySpan.GetComputedStyle("margin") Dim strMargin As String = mySpan.GetComputedStyleValue("margin") -{{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/html-control-suite/html-actions.md b/docs-teststudiodev/code-in-test/html-control-suite/html-actions.md index f4514b8a..e87765b7 100644 --- a/docs-teststudiodev/code-in-test/html-control-suite/html-actions.md +++ b/docs-teststudiodev/code-in-test/html-control-suite/html-actions.md @@ -4,7 +4,7 @@ page_title: HTML Actions - Test Studio Dev Documentation description: HTML Actions position: 2 --- -#Common HTML Control Actions# +# Common HTML Control Actions What are some of the things we can do after finding the element we want to act upon? We can: @@ -22,10 +22,7 @@ What are some of the things we can do after finding the element we want to act u Here are some examples: -#### __[C#]__ - - {{region }} - +````C# // All controls have a Click/MouseClick. The .Click invokes a click from the DOM, // the MouseClick(), moves the mouse to the control and clicks it. @@ -116,13 +113,8 @@ Here are some examples: // Invoke any events on the control link.InvokeEvent(ScriptEventType.OnFocus); - {{endregion}} - - -#### __[VB]__ - - {{region }} - +```` +````VB ' All controls have a Click/MouseClick. The .Click invokes a click from the DOM, ' the MouseClick(), moves the mouse to the control and clicks it. @@ -213,4 +205,4 @@ Here are some examples: ' Invoke any events on the control link.InvokeEvent(ScriptEventType.OnFocus) - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/html-control-suite/html-asserts.md b/docs-teststudiodev/code-in-test/html-control-suite/html-asserts.md index e8848095..7e07366a 100644 --- a/docs-teststudiodev/code-in-test/html-control-suite/html-asserts.md +++ b/docs-teststudiodev/code-in-test/html-control-suite/html-asserts.md @@ -4,7 +4,7 @@ page_title: HTML Asserts - Test Studio Dev Documentation description: position: 2 --- -#HTML Asserts# +# HTML Asserts Telerik Testing Framework has a set of Assert classes to make validation of your HTML controls easier. An 'Assert' basically says "Verify the specified property of the control has the specified value or setting. If it doesn't have that setting/value, then throw an error and stop the test." @@ -142,10 +142,7 @@ For example: AssertCheck.IsTrue() will verify the associated checkbox control is Now let's see how this works in action: -#### __[C#]__ - - {{region }} - +````C# // Attribute checks HtmlSpan span = Find.ById("Warning"); span.AssertAttribute().Exists("style"); @@ -201,12 +198,9 @@ table.AssertTable().RowCount(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts. table.AssertTable().RowRange(ArtOfTest.Common.NumberRangeCompareType.OutsideRange, 1, 2); table.AssertTable().Contains(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Contains, "TD5"); table.AssertTable().Contains(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.NotContain, "TD37"); -{{endregion}} +```` -#### __[VB]__ - - {{region }} - +````VB ' Attribute checks Dim span As HtmlSpan = Find.ById(Of HtmlSpan)("Warning") span.AssertAttribute().Exists("style") @@ -260,7 +254,7 @@ table.AssertTable().RowCount(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts. table.AssertTable().RowRange(ArtOfTest.Common.NumberRangeCompareType.OutsideRange, 1, 2) table.AssertTable().Contains(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Contains, "TD5") table.AssertTable().Contains(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.NotContain, "TD37") -{{endregion}} +```` There are many other possible assert verification combinations built into the framework that you can take advantage of. The above examples are just a small subset of what is possible to help you get started implementing them in your code and crafting the kinds of verification you need for your particular website. Consult the API reference manual to learn about the other combinations. diff --git a/docs-teststudiodev/code-in-test/html-control-suite/html-wait-class.md b/docs-teststudiodev/code-in-test/html-control-suite/html-wait-class.md index ee2f739e..843d250a 100644 --- a/docs-teststudiodev/code-in-test/html-control-suite/html-wait-class.md +++ b/docs-teststudiodev/code-in-test/html-control-suite/html-wait-class.md @@ -4,7 +4,7 @@ page_title: HtmlWait Class - Test Studio Dev Documentation description: HtmlWait Class position: 2 --- -#How to Use the HtmlWait Class# +# How to Use the HtmlWait Class The HtmlWait class extends and enhances the Element.Wait class with some powerful methods that are very useful with the HTML control suite. It adds: @@ -17,10 +17,7 @@ The HtmlWait class extends and enhances the Element.Wait class with some powerfu The HtmlWait.ForVisible and HtmlWait.ForVisibleNot use the HtmlControl.IsVisible function to test whether or not the element is currently visible in the browser. Since IsVisible follows the CSS chain, we get a true reading of whether or not the element actually is visible. For example: -#### __[C#]__ - - {{region }} - +````C# HtmlDiv div = Find.ByTagIndex("div", 0); HtmlWait waitObj = div.Wait; @@ -35,12 +32,8 @@ The HtmlWait.ForVisible and HtmlWait.ForVisibleNot use the HtmlControl.IsVisible waitObj.ForVisible(); // Wait 120 seconds for the div to become invisible waitObj.ForVisibleNot(); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB HtmlDiv div = Find.ByTagIndex("div", 0); HtmlWait waitObj = div.Wait; @@ -55,14 +48,11 @@ The HtmlWait.ForVisible and HtmlWait.ForVisibleNot use the HtmlControl.IsVisible waitObj.ForVisible(); // Wait 120 seconds for the div to become invisible waitObj.ForVisibleNot(); - {{endregion}} +```` Using the HtmlWait.ForStyles and HtmlWait.ForStylesNot methods you can wait for a particular style to be set or removed from the element. For example: -#### __[C#]__ - - {{region }} - +````C# HtmlSpan span = Find.ByTagIndex("span", 0); HtmlWait spanWaitObj = div.Wait; @@ -94,13 +84,8 @@ Using the HtmlWait.ForStyles and HtmlWait.ForStylesNot methods you can wait for // Will continue to wait if either style is still set to the specified value. // Uses the default timeout value from Settings.Current.ExecuteCommandTimeout span.Wait.ForStylesNot("backgroundColor=red", "margin=30px"); - {{endregion}} - - -#### __[VB]__ - - {{region }} - +```` +````VB Dim span As HtmlSpan = Find.ByTagIndex(Of HtmlSpan)("span", 0) Dim spanWaitObj As HtmlWait = div.Wait @@ -132,38 +117,28 @@ Using the HtmlWait.ForStyles and HtmlWait.ForStylesNot methods you can wait for ' Will continue to wait if either style is still set to the specified value. ' Uses the default timeout value from Settings.Current.ExecuteCommandTimeout span.Wait.ForStylesNot("backgroundColor=red", "margin=30px") - {{endregion}} +```` The HtmlWait.ForCondition is an advanced method that calls a user defined function to determine whether or not the wait condition has been satisfied. You, the test automation programmer, may code up any sort of wait condition you can imagine. The only requirement is that your function must return true to indicate that the condition has been satisfied or return false to indicate the condition has not been satisfied. The overloads of the HtmlWait.ForCondition are split into two virtually identical sets of three overloads. The first set operates on basic Element objects. The second set operates on Control objects, which all of the classes contained in the HTML control suite derive from. Except for this difference, they operate identically. The sample below shows only the Control version: -#### __[C#]__ - - {{region }} - +````C# HtmlTextArea textArea = Find.ByTagIndex("textarea", 0); HtmlWait textAreaWaitObj = textArea.Wait; // Wait 30 seconds for the HtmlTextArea element to contain the text "Now is the time" textArea.Wait.ForCondition(textAreaContainsStr, false, "Now is the time", 30000); - {{endregion}} - -#### __[VB]__ - - {{region }} - +```` +````VB Dim textArea As HtmlTextArea = Find.ByTagIndex(Of HtmlTextArea)("textarea", 0) Dim textAreaWaitObj As HtmlWait = textArea.Wait ' Wait 30 seconds for the HtmlTextArea element to contain the text "Now is the time" textArea.Wait.ForCondition(AddressOf textAreaContainsStr, False, "Now is the time", 30000) - {{endregion}} +```` Now we need the definition of the condition function 'textAreaContainsStr': -#### __[C#]__ - - {{region }} - +````C# /// /// Tests whether or not the HtmlTextArea element contains the specified string. /// @@ -185,13 +160,8 @@ Now we need the definition of the condition function 'textAreaContainsStr': HtmlTextArea textArea = (HtmlTextArea)ctl; return textArea.Text.Contains((string)obj); } - {{endregion}} - - -#### __[VB]__ - - {{region }} - +```` +````VB ''' ''' Tests whether or not the HtmlTextArea element contains the specified string. ''' @@ -212,4 +182,4 @@ Now we need the definition of the condition function 'textAreaContainsStr': Return textArea.Text.Contains(CType(obj, String)) End Function - {{endregion}} +```` diff --git a/docs-teststudiodev/code-in-test/html-control-suite/introduction.md b/docs-teststudiodev/code-in-test/html-control-suite/introduction.md index 5c9b159b..7d64b5d8 100644 --- a/docs-teststudiodev/code-in-test/html-control-suite/introduction.md +++ b/docs-teststudiodev/code-in-test/html-control-suite/introduction.md @@ -4,7 +4,7 @@ page_title: Introduction - Test Studio Dev Documentation description: Introduction position: 1 --- -#Intro to Test Studio Devs HTML Control Element Wrappers Suite# +# Intro to Test Studio Devs HTML Control Element Wrappers Suite Telerik Framework includes an extensive suite of strongly typed HTML element wrappers that abstracts out actions and verifications of the controls contained on the webpage. With the classes contained in the control suite you can do things like: @@ -22,7 +22,9 @@ In addition there are many other features that make the abstraction even more po
- + - + - + - + @@ -57,21 +65,27 @@ In addition there are many other features that make the abstraction even more po - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -213,7 +255,9 @@ In addition there are many other features that make the abstraction even more po - + - + - +
HTML ControlDescriptionPropertiesMethodsBase Class
**HtmlAnchor** + +**HtmlAnchor** Wraps access to a HTML \ anchor element. HRef
Name
@@ -32,7 +34,9 @@ In addition there are many other features that make the abstraction even more po
HtmlContainerControl
**HtmlButton** + +**HtmlButton** Wraps access to a HTML \ Disabled Name
@@ -42,14 +46,18 @@ In addition there are many other features that make the abstraction even more po
HtmlContainerControl
**HtmlDefinitionDescription** + +**HtmlDefinitionDescription** Wraps access to a HTML \
element . This control is used by the HtmlDefinitionList control.
Description HtmlContainerControl
**HtmlDefinitionList** + +**HtmlDefinitionList** Wraps access to a HTML \
element.
Descriptions
Terms
HtmlContainerControl
**HtmlDefinitionTerm** + +**HtmlDefinitionTerm** Wraps access to a HTML \
element. This control is used by the HtmlDefinitionList control.
Terms HtmlContainerControl
**HtmlDiv** + +**HtmlDiv** Wraps access to a HTML \
container element.
HtmlContainerControl
**HtmlForm** + +**HtmlForm** Wraps access to a HTML \
element.
EncType
Length
@@ -81,7 +95,9 @@ In addition there are many other features that make the abstraction even more po
HtmlContainerControl
**HtmlImage** + +**HtmlImage** Wraps access to a HTML \ element. Align
Alt
@@ -93,7 +109,9 @@ In addition there are many other features that make the abstraction even more po
HtmlControl
**HtmlInputButton** + +**HtmlInputButton** Wraps access to a HTML \ element. Align
Alt
@@ -105,28 +123,36 @@ In addition there are many other features that make the abstraction even more po
HtmlInputControl
**HtmlInputCheckBox** + +**HtmlInputCheckBox** Wraps access to a HTML \ element. Checked Check HtmlInputControl
**HtmlInputFile** + +**HtmlInputFile** Wraps access to a HTML \ element. FilePath Upload HtmlInputControl
**HtmlInputHidden** + +**HtmlInputHidden** Wraps access to a HTML \ element. HtmlInputControl
**HtmlInputImage** + +**HtmlInputImage** Wraps access to a HTML \ element. Align
Alt
@@ -138,7 +164,9 @@ In addition there are many other features that make the abstraction even more po
HtmlInputControl
**HtmlInputPassword** + +**HtmlInputPassword** Wraps access to a HTML \ element. Disabled Size
@@ -148,14 +176,18 @@ In addition there are many other features that make the abstraction even more po
HtmlInputControl
**HtmlInputRadioButton** + +**HtmlInputRadioButton** Wraps access to a HTML \ element. Cheched Check HtmlInputControl
**HtmlInputReset** + +**HtmlInputReset** Wraps access to a HTML \ element. Align
Alt
@@ -167,7 +199,9 @@ In addition there are many other features that make the abstraction even more po
HtmlInputControl
**HtmlInputSubmit** + +**HtmlInputSubmit** Wraps access to a HTML \ element. Align
Alt
@@ -179,7 +213,9 @@ In addition there are many other features that make the abstraction even more po
HtmlInputControl
**HtmlInputText** + +**HtmlInputText** Wraps access to a HTML \ element. Disabled
Size
@@ -189,14 +225,18 @@ In addition there are many other features that make the abstraction even more po
HtmlInputControl
**HtmlListItem** + +**HtmlListItem** Wraps access to a HTML \
  • element. This control is used by the HtmlOrdererList control and the HtmlUnorderedList control.
  • GetItemOrder HtmlContainerControl
    **HtmlOption** + +**HtmlOption** Wraps access to a HTML \ Selected
    Text
    @@ -205,7 +245,9 @@ In addition there are many other features that make the abstraction even more po
    HtmlControl
    **HtmlOrderedList** + +**HtmlOrderedList** Wraps access to a HTML \
      .
    AllItems
    Itemst
    HtmlContainerControl
    **HtmlSelect** + +**HtmlSelect** Wraps access to a HTML \ Options
    SelectedIndex
    @@ -230,14 +274,18 @@ In addition there are many other features that make the abstraction even more po
    HtmlContainerControl
    **HtmlSpan** + +**HtmlSpan** Wraps access to a HTML \ inline text container element. HtmlContainerControl
    **HtmlTable** + +**HtmlTable** Wraps access to a HTML \ table element containing rows and columns. - + - + element. - +
    AllRows
    BodyRows
    @@ -255,7 +303,9 @@ In addition there are many other features that make the abstraction even more po
    HtmlContainerControl
    **HtmlTableCell** + +**HtmlTableCell** Wraps access to a HTML \ table cell element. Align
    BgColor
    @@ -271,7 +321,9 @@ In addition there are many other features that make the abstraction even more po
    HtmlContainerControl
    **HtmlTableRow** + +**HtmlTableRow** Wraps access to a HTML \
    Align
    BgColor
    @@ -284,7 +336,9 @@ In addition there are many other features that make the abstraction even more po
    HtmlContainerControl
    **HtmlTextArea** + +**HtmlTextArea** Wraps access to a HTML \