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 .NetSpecflow in leanft in C sharp
We can integrate the LeanFT tests with SpecFlow very easily. Please follow below steps.- Install SpecFlow extension for Visual Studio.
- Add SpecFlow and SpecFlow Runner nuget packages in LeanFT project references.
- Add feature files and step definitions.
- Execute the scenarios.
Feature: Notepad feature
@mytag
Scenario: Verify Notepad title
Given NotePad is open
Then I verify that title contains "Notepad" word
Then here is the step definition file for above feature file. Note that we have added LeanFT code in the steps.
using HP.LFT.Report;
using HP.LFT.SDK;
using HP.LFT.SDK.StdWin;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using TechTalk.SpecFlow;
namespace LeanFtTestProject1
{
[Binding]
public class NotepadFeatureSteps
{
IWindow notepadWindow;
[Given(@"NotePad is open")]
public void GivenNotePadIsOpen()
{
SDK.Init(new SdkConfiguration
{
ServerAddress = new Uri("ws://localhost:5095")
});
ReportConfiguration r = new ReportConfiguration();
r.IsOverrideExisting = true;
r.Title = "My LeanFT Report";
Reporter.Init(r);
Process appProcess = new Process
{
StartInfo = { FileName = @"C:WindowsSystem32
otepad.exe" }
};
appProcess.Start();
notepadWindow = Desktop.Describe<IWindow>(new WindowDescription
{
WindowClassRegExp = "Notepad",
Index = 0
});
}
[Then(@"I verify that title contains ""(.*)"" word")]
public void ThenIVerifyThatTitleContainsWord(string p0)
{
String title = notepadWindow.WindowTitleRegExp;
Assert.IsTrue(title.ToLower().Contains(p0.ToLower()));
notepadWindow.Close();
SDK.Cleanup();
}
}
}
Web development and Automation testing
solutions delivered!!