-
Notifications
You must be signed in to change notification settings - Fork 53
Golem.Purple Technical Information
sethuster edited this page Nov 11, 2014
·
3 revisions
###Features Golem Windows UI Automation framework, otherwise known as Golem.Purple, REQUIRES a reference to the PurpleLib.dll contained in the ProtoTest.Golem\Resources directory. This library contains all the functionality needed to find automation Elements but xPath. The PurpleLib.dll is included in ProtoTest.Golem by default.
#####Golem.Purple.PurpleCore
- Fully configurable programmatically or with an App.Config.
- Test classes should inherit **PurpleTestBase **Class and each function should be marked with the [Test] attribute.
- Built on the Page Object Design Pattern. Page Objects should inherit BaseScreenObject.
- Application elements are set to wait the specified Element Timeout configuration option.
#####MbUnit Integration
-
You can use MbUnit.Framework.Assert to make assertions. These will stop the test on failure.
-
Supports data driven testing through MbUnit attributes.
#####NUnit Integration
-
You can use Nunit.Framework.Assert to make assertions. These will stop the test on failure.
-
Supports data driven testing through NUnit attributes.
#####Windows UI Automation Integration
-
AutomationElement are supported with the respective PurpleElements class. PurpleTextBox, PurpleButton etc.
-
Application Under test can be attached, OR started with each test run
-
Application Element xPath locator support
-
Screenshot on failure is supported
=====
-
Application Path - (key="AppPath") - Path to start the application
-
LaunchApplication - (key="LaunchApp" value="true") - Option to pre-start the application
-
ProcessName - (key="ProcessName") - Option to attach to existing process
-
WindowTitle - (key="Purple_WindowTitle") - Required for finding elements via xPath
-
Blank Value - (key="Purple_BlankValue") - Value to use in place of blanks in xPath locator strings. This is required if there are blank values in xPath locators.
-
Delimiter - (key="Purple_Delimiter") - Value to use to separate application tree hierarchy. Can be configured to any value, but it's recommended to use a one character string to keep xPath locators human readable.
-
Value Delimiter - (Key="Purple_ValueDelimiterStart" and key="Purple_ValueDelimiterEnd") These values can be configured to be used if there is more than one element, in the same level of the hierarchy with the same name. For example, there are multiple buttons with the name 'OK'. The second 'OK' button would be labeled by /OK[1]. All elements are located via a zero based index. Meaning the first Ok button would be at index 0, and the second instance would be OK[1].
-
ElementWaitTime - (Key="Purple_ElementWaitTimeOutSeconds") - Specifies how long ProtoTest.Golem should wait for an element to become available before failing a test.
=====
###Building a new Screen Object
- Look in the Tests/PageObjects directory in the Golem repository for examples
- Screen Objects Inherit BaseScreenObject
- AutomationElement API available through PurpleElement Property.
using System.Windows.Forms;
using ProtoTest.Golem.Purple;
using ProtoTest.Golem.Purple.PurpleElements;
namespace ProtoTest.Golem.Tests.PageObjects.MSPaint
{
public class MSPaint_6 : BaseScreenObject
{
PurpleButton TextButton = new PurpleButton("MSPaintTextButton", "Untitled - Paint/Ribbon/Ribbon/!BLANK!/Ribbon/Lower Ribbon/!BLANK!/Home/Tools/Text");
PurplePanel PaintArea = new PurplePanel("PaintArea", "Untitled - Paint/!BLANK!/!BLANK!");
public void PaintText(string text)
{
TextButton.Click();
PaintArea.MoveCursor(PaintArea.Bounds.TopLeft);
PaintArea.LMB_Down();
SendKeys.SendWait(text);
}
public static MSPaint_6 PaintWindow()
{
return new MSPaint_6();
}
}
}