天天看點

Business Entities FrameworkBusiness Entity Framework OverviewEntity Class

Business Entity Framework Overview

The Business Entity Framework (BEF) is a test automation library shared by the AX application teams

BEF consists of a list of business entities. A business entity class represents a logical business entity from the ERP world. A business entity is a class designed to communicate with an ERP application (AX) in an interface agnostic way. The entity should be abstracted from the implementation details of AX. This class should support basic CRUD functionality, serialization and deserialization, entity comparison methods and business actions related to the logical entity that it represents.

BEF is based on existing automation frameworks to provide access to AX. The entity methods can be implemented using

a.      UI or Non-UI interfaces (e.g. AxProxies, BC.NET)

b.      Interface specific helpers (BAL)

The basic goals of the framework are to:

1)      Increase maintainability of test code

2)      Increase code share/reuse by application teams

To achieve the maintainability goal BEF

a.      Enables interface agnostic automation. Individuals can write test code which is abstracted from interface implementations and is tolerant to future interface changes or interface replacements

b.      Increases the readability of the code since it provides a level of abstraction that enables individuals to write test code that has the same vocabulary with repro steps. This enables testers to understand test automation without having detailed repro steps or knowing names of tables, forms and controls. Highly readable code facilitates current code reviews, future code modifications and transfers of code ownership.

To achieve the code share/reuse goal BEF

a.      Shares the ownership of Business Entities among application teams according to the business domain that they validate.

b.      Addresses cross team functional dependencies

c.      Supports the collaboration between teams by providing a development process and weekly triage meetings.

Entity Class

The Entity class is the base type that defines the expected behavior of each Business Entity of the framework. For more detailed definition of a Business Entity please look at the Business Entity Framework Overview definition. The Entity base type forces consistency in the behavior of all the Business entities of the library.

Each business entity consists of

1.      A list of properties that define the state of the entity. The identity of the entity is defined by its primary key.

2.      A list of methods that the test author can use to access AX

CRUD operations:

a.      Create () Creates an entry in AX.

b.      Read () Reads from AX and populates the properties of an instance of an entity.

c.      Update () Updates an entry in AX according to the properties of an instance of an entity.

d.      Delete () Deletes an entry in AX.

In the last tree operations, the primary key of the entity needs to be defined.

CRUD methods have a default Non-UI implementation inherited by the Entity. This default implementation is provided by the core classes of the framework. If needed, the entity authors can override this implementation in their business entities.

Serialization / Deserialization:

Every entity can be serialized and deserialized in XML files. This functionality is provided by the core entity classes and uses .Net standard Serialization

                Entity Comparisons:

The properties of entities of the same type can be compared. The user can either ensure that two entities have identical properties or that the defined properties of one entity are identical to the properties of another entity of the same type

                Business Methods:

Each entity provides a list of business methods that are specific to this entity (e.g. Post, Schedule)

A set of core classes in the framework increase the productivity of entity authors when they implement the methods of the entities.

Non-UI data mapping:

BEF supports an attribute based data binding mechanism. The properties of an entity can be decorated with attributes that include information regarding the AX tables and columns that they represent. After the entity properties are attributed with database information, all the CRUD operations are supported by the default implementation of the entity. The non-UI data mapping also provides basic entity querying. One entity can be mapped with columns from more than one table.

                UI data mapping:

Similar mapping mechanism is implemented for UI mapping. In this case the entity is decorated with information regarding the forms/fields that they represent.

                Modeling relationships between entities:

1 : n compositions between entities can be modeled using the Type “ChildEntities”. This class reduces the duplication of code between entities that have a parent-child relationship.

                Access to AX Tables, Classes, UI

During the implementation of entity methods, the entity author will may need to access static/instance methods from AX Classes/Tables or access the UI of AX. BEF provides full access to AX logic with its core classes. Currently BC.Net is used to access the application. BC.Net is abstracted by the core classes of the framework so it can be replaced easily. The UI can be accessed by AXProxies.

The entity methods can be implemented in a headless or headed way. The recommendation for entity authors is to build headless implementation since this makes the solution more robust and faster. When it comes to CRUD and filtering methods, the core classes of the framework should be utilized, in order to reduce the code duplication and the maintenance of the framework. In occasions when a headless implementation would require duplication of application logic, UI should be used. At any point, entity authors are able to switch implementation without having to change any line of test code.

繼續閱讀