IcuTest

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.

IcuTest
Developer(s)NXS-7 Software Inc.
Stable release
1.0.7 / May 11, 2010 (2010-05-11)
Operating systemMicrosoft Windows
TypeTest automation, unit testing
LicenseProprietary
Websitewww.nxs-7.com/icu

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:

  • IcuTest Scenarios
  • Coded UI automation
  • BDD (Behavior Driven Development) support
  • GWT (Given, When, Then) and AAA (Arrange, Act, Assert) fluency
    [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:

  • Create simple, maintainable GUI Tests
  • Ensure solid, feature complete applications
  • Support TDD and BDD best practices
  • Use with MSTest, NUnit, XUnit, MbUnit, etc...
  • Find bugs quickly and automatically
  • Produce better code coverage
  • Promote confident refactoring
  • Alleviate manual testing and debugging
gollark: I counted that, yes.
gollark: It filters out one guild on which I discuss somewhat real-world things, filters out DMs, removes pings, and reads the messages.csv files, as well as producing a CSV output for aitextgen.
gollark: ```python#!/usr/bin/env python3import os, os.path, json, csv, reOUT = "/tmp/messages.csv"with open(OUT, "w") as g: outwriter = csv.writer(g) DATA_ROOT = "/tmp/messages" for x in os.listdir(DATA_ROOT): dir = os.path.join(DATA_ROOT, x) if os.path.isdir(dir): with open(os.path.join(dir, "channel.json")) as f: meta = json.load(f) if meta["type"] == 0 and ("guild" not in meta or meta["guild"]["id"] != "771081279403065344"): print(x, meta.get("name", "???"), meta.get("guild", "???")) with open(os.path.join(dir, "messages.csv")) as f: r = csv.reader(f) for row in r: channel, timestamp, message, _ = row message = re.sub("<@[0-9]+>", "", message) outwriter.writerow((message, ))```
gollark: And the messages folder → CSV dumper is something like 20 lines of python.
gollark: Why the free time thing though? It's not like looking up how to do this is particularly time consuming.

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: Proceedings of the 28th international conference on Software engineering", 2006.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.