LeanFT with C#.net
LeanFT Introduction Supported applications Installation of LeanFT Installing the browser extensions Setting up LeanFT project in Visual Studio LeanFT Settings Types of Licenses in LeanFT Object identification center Understanding LeanFT API in C#.Net LeanFT plugin in Visual StudioAutomating windows application Running first test Integrating LeanFT with Visual Studio Unit testing framework Viewing the results of the test Description programming in LeanFT application models regular expressions in LeanFT Web application testing using LeanFT Identifying the elements using xpath and css Firing events Executing JavaScript Calculator automation using LeanFT Notepad Automation using LeanFT Automation of Java Applications Automation of SAP Applications Automation of .Net Applications Visual Relational Identifier Synchronization in LeanFT in C#.Net Assertions in LeanFT Generating reports with screenshots and recordings Converting UFT object repository into application model Keyword driven frameworks Data Driven Frameworks SpecFlowNative objects LeanFT common issues and solutions Comparison of LeanFT with Selenium and Ranorex Difference between HP UFT and LeanFT. LeanFT references and Resources for .NetFirst test in leanft in C sharp
Now we are going to write one test to verify the calculator functionality using LeanFT. We want to do below things.- Launch calculator application.
- Check the title of the calculator window.
- Click 8 button and Verify the result.
- Close the calculator.
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using HP.LFT.SDK.Descriptions;
using HP.LFT.UnitTesting;
using HP.LFT.Common;
using HP.LFT.SDK.Web;
using HP.LFT.SDK;
using HP.LFT.Report;
using HP.LFT.SDK.StdWin;
using System.Diagnostics;
namespace leanFT
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestCalculator()
{
SDK.Init(new SdkConfiguration());
Reporter.Init(new ReportConfiguration());
Process.Start(@"d:WindowsSystem32calc.exe");
IWindow win = Desktop.Describe<IWindow>(new WindowDescription
{
IsOwnedWindow = false,
IsChildWindow = false,
WindowClassRegExp = @"CalcFrame",
WindowTitleRegExp = @"Calculator"
});
Trace.WriteLine("Calculator window title is " + win.WindowTitleRegExp);
var button8 = win.Describe<HP.LFT.SDK.StdWin.IButton>(new HP.LFT.SDK.StdWin.ButtonDescription
{
Text = string.Empty,
WindowId = 138,
NativeClass = @"Button"
});
button8.Click();
var result = win.Describe<IStatic>(new StaticDescription
{
WindowId = 150,
NativeClass = @"Static"
});
Trace.WriteLine("Result text contains " + result.Text);
win.Close();
Reporter.GenerateReport();
SDK.Cleanup();
}
}
}
Web development and Automation testing
solutions delivered!!