Articles in this section
Category / Section

How to perform the programmatic testing in LeanFT for GridDataControl ?

1 min read

HP Lean Functional Testing (LeanFT) is a powerful and lightweight functional testing solution built specifically for continuous testing and continuous integration. GridDataControl do not have a support for interactive testing in LeanFT because it directly derived from ContentControl. However, you can perform code based testing, but this is not an actual LeanFT testing, it’s like our WPF unit testing.  

Steps for creating code based testing in LeanFT:

1. Open visual studio and choose the LeanFT project

Open visual studio and choose the LeanFT project

2. After creating the LeanFT project, you can add the WPF application and add the GridDataControl in it.

WPF application and add the GridDataControl

3. Add the WPF application project under the reference in LeanFT project

4. You can create the test case in LeanFT test class file under the LeanFT project,

[TestMethod]
public void TestMethod1()
{
    var grid = mainWindow.FindElementOfType<GridDataControl>();
    grid.Model.CurrencyManager.CurrentCell.MoveTo(1, 2);
 
    mainWindow.Dispatcher.Invoke(DispatcherPriority.Render, new Action(() => { }));
    Thread.Sleep(200);
 
    var expectedValue = "Cell [1,2]";
    var cell = grid.Model[1, 2];
    cell.CellValue = expectedValue;
    var actualValue = grid.Model[1, 2].CellValue;
    mainWindow.Dispatcher.Invoke(DispatcherPriority.Render, new Action(() => { }));
    Thread.Sleep(200);
    Assert.AreEqual(expectedValue, actualValue);
 
}      

 

5. Run the test cases by right clicking the TestMethod and click the Run Tests option like below,

Run Tests

 

Sample:

LeanFTDemo

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied