Code Generator¶
Code Generator for Producing Automation API Page Objects as Source Code.
Description¶
The Code Generator is responsible for converting the XML based Object Repository into page objects representing an automation API. The conversion will be executed as a flush producing all page objects specified in the Object Repository in one single operation.
Output¶
Following snippet shows an example of a generated page object class...
using OpenQA.Selenium; using Testware.Logger; using Rojabo.Web.API.Models; namespace Rojabo.Web.API { public partial class EventsNewPage : BaseEventsNewPage { static ILogger logger = LoggerFactory.Create(typeof(EventsNewPage)); public EventsNewPage(IWebDriver driver) : base(driver) { } #region Property Methods public string GetEventName() { return txtEventName.Value; } public string GetEventYear() { return cboEventYear.Value; } public string GetEventMonth() { return cboEventMonth.Value; } public string GetEventDay() { return cboEventDay.Value; } public string GetEventType() { return cboEventType.Value; } public EventsNewPage SetEventName(string value) { txtEventName.Enter(value); return this; } public EventsNewPage SetEventYear(string value) { cboEventYear.Enter(value); return this; } public EventsNewPage SetEventMonth(string value) { cboEventMonth.Enter(value); return this; } public EventsNewPage SetEventDay(string value) { cboEventDay.Enter(value); return this; } public EventsNewPage SetEventType(string value) { cboEventType.Enter(value); return this; } #endregion public EventsNewPage FillForm(EventsNewPageModel data) { if (data.EventName != null) SetEventName(data.EventName); if (data.EventYear != null) SetEventYear(data.EventYear); if (data.EventMonth != null) SetEventMonth(data.EventMonth); if (data.EventDay != null) SetEventDay(data.EventDay); if (data.EventType != null) SetEventType(data.EventType); return this; } public EventsPage ActivateButtonSave() { logger.Action("ActivateButtonSave()"); this.btnSave.Click(); return new EventsPage(this.Driver); } } }