IcuTest

IcuTest
Developer(s) NXS-7 Software Inc.
Stable release 1.0.7 / May 11, 2010
Development status Active
Operating system Microsoft Windows
Type Test automation, Unit testing
License Proprietary
Website IcuTest website

IcuTest is a unit testing framework for GUIs. The current version supports Windows Presentation Foundation applications. GUI verification is done primarily using image comparisons. Test suites can run interactively or fully automated.

Philosophy

IcuTest is not a record-and-playback system. Such systems can produce test scripts that are difficult to maintain.[1][2] Rather, IcuTest believes that the most effective place to test is within the unit test. Hence, IcuTest forgoes any recording mechanism and, like typical unit tests, relies on the programmer to define the scope and parameters of the test.

Usage

A typical IcuTest provides direct control of the app under test. Here is an example that ensures that the ViewModel is correct.

    [TestMethod]
    public void TestMyWindow_WithDataContext()
    {
        ICU.Invoke(() => {
            var w = new MyWindow();
            w.Show();
            ICU.CheckView(w, "MyWindowTest");
 
            w.DataContext = new MyViewModel();
            ICU.CheckView(w, "MyWindowTest_with_ViewModel");
 
            w.Close();
        });
    }

ICU.CheckView is the main testing (or Assert) mechanism in IcuTest. It performs a fast bitmap comparison between the current UI snapshot and a previously stored snapshot. Like an Assert, CheckView throws an exception when a test fails.

IcuTest offers higher level tools specifically designed to help GUI testing. Here is an example that illustrates:

    [TestMethod]
    public void cannot_login_with_invalid_password()
    {
        var context = new WindowScenario<ExampleLoginWindow>();
        ICU.Given(context)
 
            // Optional BDD specs 
            .AsA("MyApp User")
            .IWant("a login window")
            .SoThat("I have secure access to MyApp data")
 
            .When(() => {
                // set wrong password using GUI automation
                set_login(context.Window, "myname", "wrong password");
            })
            .Then(() => { 
                // window should display "invalid login" message
                ICU.CheckView(context.Window, "login_with_invalid_pass");
            })
            .Test();
    }
 
    void set_login(ExampleLoginWindow w, string user, string pass)
    {
        var userBox = guiHelper.Find<TextBox>(w, "userBox");
        var passBox = guiHelper.Find<PasswordBox>(w, "passwordBox");
        var loginBtn = guiHelper.Find<Button>(w, "LoginButton");
        userBox.Text = user;
        passBox.Password = pass;
        guiHelper.Click(loginBtn);
    }

Features

With IcuTest, you can:

References

  1. Memon, A: GUI testing: Pitfalls and process, "IEEE Computer", 2002.
  2. Xie,Q: Developing cost-effective model-based techniques for GUI testing, "ICSE ’06: Proceeding of the 28th international conference on Software engineering", 2006.