Dashboard > SharpRobo > Home
Home Log In | Sign Up   View a printable version of the current page.

Added by Barrow Kwan , last edited by Vivek Singh on Sep 10, 2006  (view change)
Labels: 
(None)

SharpRobo is a Functional Testing and Recording tool for WinForm applications written in .NET supported language. It supports all the standard WinForm controls. It is an in-process testing tool. It doesn't work based on window messages.
SharpRobo in testing mode gets hold of the first launched form. Every action in the test is then performed by finding the appropriate control from the form.

Steps to apply SharpRobo on your project

Change in application under test codebase.
1. Extend all the forms in the codebase from BaseForm instead of Form. No need to use MessageBox from SharpRobo, unlike in previous versions. The standard messagebox is supported.
In the test code
1. Implement interface IMainFormCreator. The Create method should return the instance of first form in the application. If you are doing some initializations in the actual application along with it you would need to do that as well. This needs to be done only for the first form.
2. public class FooTester : IMainFormCreator
{
private SharpRoboTester sharpRoboTester;

public FooTester()

Unknown macro: { sharpRoboTester = new SharpRoboTester(this); sharpRoboTester.IdentificationByName = true; }

public SharpRoboTester Tester
{
get

Unknown macro: { return sharpRoboTester; }

}

public BaseForm Create()

Unknown macro: { // Do other initializations and create first form as done in the application return mainForm; // eg. MainForm mainForm = new MainForm(); // return mainForm; }

}

3. Start writing test like this e.g. (NUnit sample, needs the library for same)
[TestFixture]
public class MyFirstTest
{
[Test]
public void First()

Unknown macro: { FooTester fooTester = new FooTester(); SharpRoboTester sharpRoboTester = fooTester.SharpRoboTester; sharpRoboTester.Enter(new SingleNameIdentifier(ControlType.TextBox, "textBox1"), "Something"); sharpRoboTester.Close(); }

}
(Remember to close the forms. Use SharpRoboTester.CloseAll methods if you cannot track how many forms are open)

4. SharpRoboTester contains certain common methods application to more than one type of control. In order to get control specific functions use Test* classes, like TestButton, TestComboBox, TestTextBoxBase, etc. (Use the source code to find out all of these, they all extend TestComponent). The test would look like this in which case.
[Test]
public void First()
{
FooTester fooTester = new FooTester();
SharpRoboTester sharpRoboTester = fooTester.SharpRoboTester;
TestTextBoxBase testTextBoxBase = sharpRoboTester.TestControl<TestTextBoxBase>(ControlType.Button, "textBox1");
testTextBoxBase.Text = "Something";
sharpRoboTester.Close();
}

Download
Powered by a free Atlassian Confluence Open Source Project / Non-profit License granted to ThoughtWorks, Inc.. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators