Skip to content
GetcuReone edited this page Oct 9, 2019 · 10 revisions

Welcome to the MvvmFrame.Wpf.TestAdapter wiki!

This library is designed to simplify testing applications created using the library MvvmFrame.Wpf. The principle of its work is quite simple. She takes an approach Given-When-Then. Now I will briefly describe how to use it.

  1. You must inherit your class with tests from class FrameTestBase
  2. You must describe your unit given. You will be given a frame to enter the 1st block
public void TestMethod()
{
   Given("your description", frame => { \\ your code given })
}
  1. If necessary, add the number of blocks you need is given through the AND Method.
public void TestMethod()
{
    Given("your description", frame => { \\ your code given })
    .And("your description", () => { \\ your code given })
}

.4 You must describe your block when

public void TestMethod()
{
    Given("your description", frame => { \\ your code given })
    .And("your description", () => { \\ your code given })
    .When("your description", () => { \\ your code when })
}

.5 You must describe your block then

public void TestMethod()
{
    Given("your description", frame => { \\ your code given })
    .And("your description", () => { \\ your code given })
    .When("your description", () => { \\ your code when })
    .Then("your description", () => { \\ your code then })
}
  1. If necessary, add the number of blocks you need is then through the AND Method.
public void TestMethod()
{
    Given("your description", frame => { \\ your code given })
    .And("your description", () => { \\ your code given })
    .When("your description", () => { \\ your code when })
    .Then("your description", () => { \\ your code then })
    .And("your description", () => { \\ your code then })
}
  1. Run Given-When-Then. For this you need to use the run Method. At the entrance to him, pass the tim of your application window WPF and a function that allows you to pull out a frame from this window
public void TestMethod()
{
    Given("your description", frame => { \\ your code given })
    .And("your description", () => { \\ your code given })
    .When("your description", () => { \\ your code when })
    .Then("your description", () => { \\ your code then })
    .And("your description", () => { \\ your code then })
    .Run<TestWindow>(window => window.yourFrame);
}

For asynchronous operations, use methods GivenAsync, WhenAsync, ThenAsync or AndAsync.

To get the current page at runtime Given-When-Then, use the Method CheckTypeAndGetPage. It checks the page type. If it is true then returns the page. If not, fail the test.

The principle of its work is quite simple. She takes an approach Given-When-Then. You can find examples of its use here.

Library performance checked by tests

Clone this wiki locally