-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
318 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
...ssurance/15. Automated testing with Telerik Testing Framework/HomeworkTTF/HomeworkTTF.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.24720.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TTFTasks", "TTFTasks\TTFTasks.csproj", "{9A1449C1-09D1-4EA5-8C2D-A2D9A05E86FE}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{9A1449C1-09D1-4EA5-8C2D-A2D9A05E86FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9A1449C1-09D1-4EA5-8C2D-A2D9A05E86FE}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9A1449C1-09D1-4EA5-8C2D-A2D9A05E86FE}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9A1449C1-09D1-4EA5-8C2D-A2D9A05E86FE}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
176 changes: 176 additions & 0 deletions
176
...tomated testing with Telerik Testing Framework/HomeworkTTF/TTFTasks/GoogleSearchForTTF.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
namespace TTFTasks | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
using ArtOfTest.WebAii.Controls.HtmlControls; | ||
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts; | ||
using ArtOfTest.WebAii.Core; | ||
using ArtOfTest.WebAii.ObjectModel; | ||
using ArtOfTest.WebAii.TestAttributes; | ||
using ArtOfTest.WebAii.TestTemplates; | ||
using ArtOfTest.WebAii.Win32.Dialogs; | ||
|
||
using ArtOfTest.WebAii.Silverlight; | ||
using ArtOfTest.WebAii.Silverlight.UI; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
/// <summary> | ||
/// Summary description for GoogleSearchForTTF | ||
/// </summary> | ||
[TestClass] | ||
public class GoogleSearchForTTF : BaseTest | ||
{ | ||
|
||
#region [Setup / TearDown] | ||
|
||
private TestContext testContextInstance = null; | ||
/// <summary> | ||
///Gets or sets the VS test context which provides | ||
///information about and functionality for the | ||
///current test run. | ||
///</summary> | ||
public TestContext TestContext | ||
{ | ||
get | ||
{ | ||
return testContextInstance; | ||
} | ||
set | ||
{ | ||
testContextInstance = value; | ||
} | ||
} | ||
|
||
|
||
//Use ClassInitialize to run code before running the first test in the class | ||
[ClassInitialize()] | ||
public static void MyClassInitialize(TestContext testContext) | ||
{ | ||
} | ||
|
||
|
||
// Use TestInitialize to run code before running each test | ||
[TestInitialize()] | ||
public void MyTestInitialize() | ||
{ | ||
#region WebAii Initialization | ||
|
||
// Initializes WebAii manager to be used by the test case. | ||
// If a WebAii configuration section exists, settings will be | ||
// loaded from it. Otherwise, will create a default settings | ||
// object with system defaults. | ||
// | ||
// Note: We are passing in a delegate to the VisualStudio | ||
// testContext.WriteLine() method in addition to the Visual Studio | ||
// TestLogs directory as our log location. This way any logging | ||
// done from WebAii (i.e. Manager.Log.WriteLine()) is | ||
// automatically logged to the VisualStudio test log and | ||
// the WebAii log file is placed in the same location as VS logs. | ||
// | ||
// If you do not care about unifying the log, then you can simply | ||
// initialize the test by calling Initialize() with no parameters; | ||
// that will cause the log location to be picked up from the config | ||
// file if it exists or will use the default system settings (C:\WebAiiLog\) | ||
// You can also use Initialize(LogLocation) to set a specific log | ||
// location for this test. | ||
|
||
// Pass in 'true' to recycle the browser between test methods | ||
Initialize(false, this.TestContext.TestLogsDir, new TestContextWriteLine(this.TestContext.WriteLine)); | ||
|
||
// If you need to override any other settings coming from the | ||
// config section you can comment the 'Initialize' line above and instead | ||
// use the following: | ||
|
||
/* | ||
// This will get a new Settings object. If a configuration | ||
// section exists, then settings from that section will be | ||
// loaded | ||
Settings settings = GetSettings(); | ||
// Override the settings you want. For example: | ||
settings.Web.DefaultBrowser = BrowserType.FireFox; | ||
// Now call Initialize again with your updated settings object | ||
Initialize(settings, new TestContextWriteLine(this.TestContext.WriteLine)); | ||
*/ | ||
|
||
// Set the current test method. This is needed for WebAii to discover | ||
// its custom TestAttributes set on methods and classes. | ||
// This method should always exist in [TestInitialize()] method. | ||
SetTestMethod(this, (string)TestContext.Properties["TestName"]); | ||
|
||
#endregion | ||
|
||
// | ||
// Place any additional initialization here | ||
// | ||
|
||
} | ||
|
||
// Use TestCleanup to run code after each test has run | ||
[TestCleanup()] | ||
public void MyTestCleanup() | ||
{ | ||
|
||
// | ||
// Place any additional cleanup here | ||
// | ||
|
||
#region WebAii CleanUp | ||
|
||
// Shuts down WebAii manager and closes all browsers currently running | ||
// after each test. This call is ignored if recycleBrowser is set | ||
this.CleanUp(); | ||
|
||
#endregion | ||
} | ||
|
||
//Use ClassCleanup to run code after all tests in a class have run | ||
[ClassCleanup()] | ||
public static void MyClassCleanup() | ||
{ | ||
// This will shut down all browsers if | ||
// recycleBrowser is turned on. Else | ||
// will do nothing. | ||
ShutDown(); | ||
} | ||
|
||
#endregion | ||
|
||
private readonly string ttfLink = @"www.telerik.com/teststudio/testing-framework"; | ||
private readonly string downloadPageTitle = "Download Testing Framework"; | ||
|
||
[TestMethod] | ||
public void SearchForTTF() | ||
{ | ||
this.Manager.LaunchNewBrowser(BrowserType.FireFox); | ||
this.ActiveBrowser.NavigateTo(@"http://www.google.com"); | ||
|
||
this.ActiveBrowser.WaitForElement(new HtmlFindExpression("id=lst-ib"), 3000, false); | ||
|
||
Find.ById<HtmlInputText>("lst-ib").Text = "Telerik Testing Framework"; | ||
Find.ByName<HtmlInputSubmit>("btnK").Click(); | ||
|
||
this.ActiveBrowser.WaitForElement(new HtmlFindExpression("tagname=cite"), 3000, false); | ||
|
||
var link = this.Find.ByExpression("tagname=cite").InnerText; | ||
|
||
Assert.AreEqual(link, ttfLink); | ||
|
||
this.ActiveBrowser.NavigateTo(new Uri("http://" + link)); | ||
|
||
HtmlAnchor freeDownloadButton = this.Find.ByExpression<HtmlAnchor>("id=~TryNowHyperLink"); | ||
freeDownloadButton.Click(); | ||
|
||
Assert.AreEqual(this.ActiveBrowser.PageTitle, downloadPageTitle); | ||
} | ||
|
||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...ed testing with Telerik Testing Framework/HomeworkTTF/TTFTasks/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("TTFTasks")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("TTFTasks")] | ||
[assembly: AssemblyCopyright("Copyright © 2015")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("9a1449c1-09d1-4ea5-8c2d-a2d9a05e86fe")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
84 changes: 84 additions & 0 deletions
84
...15. Automated testing with Telerik Testing Framework/HomeworkTTF/TTFTasks/TTFTasks.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{9A1449C1-09D1-4EA5-8C2D-A2D9A05E86FE}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>TTFTasks</RootNamespace> | ||
<AssemblyName>TTFTasks</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> | ||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> | ||
<IsCodedUITest>False</IsCodedUITest> | ||
<TestProjectType>UnitTest</TestProjectType> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="ArtOfTest.WebAii, Version=2015.3.1015.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c, processorArchitecture=MSIL" /> | ||
<Reference Include="System" /> | ||
</ItemGroup> | ||
<Choose> | ||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'"> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | ||
</ItemGroup> | ||
</When> | ||
<Otherwise> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" /> | ||
</ItemGroup> | ||
</Otherwise> | ||
</Choose> | ||
<ItemGroup> | ||
<Compile Include="GoogleSearchForTTF.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Choose> | ||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
</Choose> | ||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |