Checkpoints in LeanFT??

Question ID: 106411
1
0

I can’t find any checkpoint methods in LeanFT like we had in UFT. How do I check something using LeanFT??

Marked as spam
Posted by (Questions: 338, Answers: 20)
Asked on September 18, 2015 7:57 pm
21 views
Answers (1)
1
Private answer

In LeanFT you can use an Assert method to check an objects and values.With an Assert method, you can use various functions to check objects and values. Check out the screenshots. I've thrown together a quick example on how to use it below.

![alt text][1] ![alt text][2]

This example will open a Firefox browser and navigate to Google.com. Then it will perform a search on ''eyeontesting'', which Google will promptly assume I'm actually trying to search for ''eye testing''. My assert statement is going to check the ''Showing Results for'' section to ensure it says, ''Showing results for eye testingSearch instead for eyeontesting'' by using Assert.AreEqual method.
(By the way, this code uses an insight object, for details on that see this post: [http://eyeontesting.com/questions/9745/does-leanft-have-an-insight-capability-like-uft-do.html)][3]

[TestInitialize]
public void TestInitialize()
{
//Create a browser object of type FireFox

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

browser.Navigate(''http://www.google.com'');

var searchField = browser.Describe(new EditFieldDescription
{
Type = @''text'',
TagName = @''INPUT'',
Name = @''q''
});

string bitmapFolder = ''Z:\Passport\Development\Visual Studio 2013\Projects\LeanFT\LeanFT_Web_Sandbox\LeanFT_Web_Sandbox\images\googleSearch.png'';

Image image = Image.FromFile(bitmapFolder);
var searchButton = browser.Describe(new InsightDescription(image));

searchField.SetValue(''eyeontesting'');
searchButton.Click();

string searchResultValue = ''Showing results for eye testingSearch instead for eyeontesting'';

var resultText = browser.Describe(new WebElementDescription
{
TagName = @''DIV'',
InnerText = As.RegExp(@''Showing results for .*''),
Index = 1
});

Assert.AreEqual(searchResultValue, resultText.InnerText);
Reporter.ReportEvent(''Result Check'', ''searchResultValue = '' + searchResultValue + '' resultText.InnerText = '' + resultText.InnerText);
}

[1]: /storage/temp/353-asssert1.png
[2]: /storage/temp/354-asssert2.png
[3]: http://eyeontesting.com/questions/9745/does-leanft-have-an-insight-capability-like-uft-do.html)

Marked as spam
Posted by (Questions: 16, Answers: 748)
Answered on September 18, 2015 7:59 pm
OK great, looks very versatile.
( at September 18, 2015 8:04 pm)