This project is read-only.

White doesn't work with NUnit

May 6, 2011 at 5:59 PM
Edited May 6, 2011 at 6:00 PM


I want to do UI Testing for a winform by using White. And I need to work with NUnit as well. I made a very simple winform program and try to use white to test it. The codes as following. The problem is, when I try to test inside NUnit, white can launch the program and the asserts is working, I can see the cursor switch between the textbox, but didn't type 10 or 20 to textboxes. Am I missing something? Thanks you very much!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using White.NUnit;
using White.Core;
using White.Core.UIItems;
using White.Core.UIItems.WindowItems;
using NUnit.Framework;
using Bricks;
using Bricks.RuntimeFramework;

namespace DemoCalculatorWinForm.Test
    public class Class1
        public void DemoTest()
            Application Demo = Application.Launch(@"Z:\DemoCalculatorWinForm.exe");
            Window window = Demo.GetWindow("Form1");
            TextBox text1 = window.Get<TextBox>("textBox1");
            TextBox text2 = window.Get<TextBox>("textBox2");
            TextBox text3 = window.Get<TextBox>("textBox3");
            Button addButton = window.Get<Button>("button1");
            Button subButton = window.Get<Button>("button2");
            Button mulButton = window.Get<Button>("button3");
            Button divButton = window.Get<Button>("button4");

            text1.Text = "10";
            text2.Text = "20";
            Assert.AreEqual("30", text3.Text);


May 9, 2011 at 5:34 PM

I solved this problem by myself. The problem is I am using 64bit Windows 7. And the White.NUnit seems doesn't work well with 64bit system. The solution is when you are using 64bit Windows 7, use nunit-x86.exe to test instead of nunit.exe which is the default one. And in any 32bit systems, use the default one is fine.