Assertions in leanft in C sharp

Assertions can be added in the LeanFT tests using Verify class as shown in below example. Note that Verify class has below methods.
  • AreEqual , AreNotEqual
  • IsTrue, IsFalse
  • StartsWith, Contains, EndsWith
  • LessOrEqual, Less, Greater, GreaterOrEqual
  • IsMatch
  • IsNullOrEmpty, IsNotNullOrEmpty
Below report shows that verification was successful.
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using HP.LFT.SDK;
using HP.LFT.Report;
using System.Diagnostics;
using System.Threading;
using HP.LFT.SDK.Web;
using System.Drawing;
using HP.LFT.Verifications;

namespace LeanFtTestProject1
    public class Assertions
        public void TestAssertions()

            SDK.Init(new SdkConfiguration
                ServerAddress = new Uri("ws://localhost:5095")

            ReportConfiguration r = new ReportConfiguration();
            r.IsOverrideExisting = true;
            r.Title= "My LeanFT Report";

            IBrowser browser = BrowserFactory.Launch(BrowserType.InternetExplorer);

            // Navigate to

            // Find edit box using Xpath
            IEditField firstName = browser.Describe<IEditField>(new EditFieldDescription
                XPath = "//input[@id='fn']"



            Verify.AreEqual("sagar", firstName.Value, 
                "Verifying the editbox value");



Web development and Automation testing

solutions delivered!!