Show / Hide Table of Contents

Class SharedActionBase

Base class of the shared actions. All shared actions must be derived from this class and implement DoAction, DoCheckpoint method. In order to verify if all parameters are given when calling DoAction() and DoCheckpoint() methods, please specify RequiredParameters Property

Inheritance
Object
SharedActionBase
SharedActionApp
SharedActionWeb
Namespace: AxaFrance.WebEngine
Assembly: AxaFrance.WebEngine.dll
Syntax
public abstract class SharedActionBase

Constructors

| Edit this page View Source

SharedActionBase(Variable[])

Default constructor

Declaration
protected SharedActionBase(Variable[] _parameters)
Parameters
Type Name Description
Variable[] _parameters

the parameters to use during the test

Fields

| Edit this page View Source

testCase

Declaration
protected TestCase testCase
Field Value
Type Description
TestCase

Properties

| Edit this page View Source

ActionReport

Stores the test result for the current action. the information of execution will be updated.

Declaration
protected ActionReport ActionReport { get; set; }
Property Value
Type Description
ActionReport
| Edit this page View Source

ActionResult

The indicator if the current action is correctly executed. it's default value is Passed

Declaration
public Result ActionResult { get; protected set; }
Property Value
Type Description
Result
Remarks

If an actions is Failed the test case runner will continue run following test steps and actions. If critical error have happend and the test case must stop, please use the result CriticalError You can provide more detailed information to Information property.

| Edit this page View Source

ContextValues

Values can be stored and shared with other actions within the same test case.

Declaration
public List<Variable> ContextValues { get; }
Property Value
Type Description
List<Variable>
| Edit this page View Source

Global

The Global level context test values.

Variables in this list will be conserved between different test cases. if necessary you need to clear the list at the beginning of the test

Declaration
public static List<Variable> Global { get; set; }
Property Value
Type Description
List<Variable>
| Edit this page View Source

Information

All the information you want to pass to upper level. the information will be reported in TestStep object and be written in the XML report. Use AppendLine() operator to append information text if necessary.

Declaration
public StringBuilder Information { get; }
Property Value
Type Description
StringBuilder
| Edit this page View Source

Parameters

Given parameters (Test Data) used to run the current test action

Declaration
public Variable[] Parameters { get; set; }
Property Value
Type Description
Variable[]
| Edit this page View Source

RequiredParameters

Provide required parameters for this Action. when provide a Value of a Parameter, it will be considered as its default value. Missing such parameter will lead the usage of default value for the test. when provide a null Value of a Parameter, Missing such parameter will lead NullArgumentException

Declaration
public abstract Variable[] RequiredParameters { get; }
Property Value
Type Description
Variable[]
| Edit this page View Source

Screenshots

The binary of the screenshots taken within this action

Declaration
public List<ScreenshotReport> Screenshots { get; set; }
Property Value
Type Description
List<ScreenshotReport>
| Edit this page View Source

UpdateTime

The DateTime where the last shared action has been executed. This DateTime is considered the time of last operation of test framework. if an test case blocks somewhere and last for more than x minutes, the test framework will terminates a test case.

Declaration
public static DateTime UpdateTime { get; set; }
Property Value
Type Description
DateTime

Methods

| Edit this page View Source

DoAction(Object)

Implement DoAction() method to interact with your application (Click the links, Fill forms, Click buttons, ...) Of course, you can do any actions needed.

Declaration
public abstract void DoAction(object Context)
Parameters
Type Name Description
Object Context

Application Context used for the action, for LeanFT actions, it will be an object of type AppModelBase

| Edit this page View Source

DoAction(Type, TestCase, Object, List<Variable>, ActionReport, Variable[])

Declaration
public static SharedActionBase DoAction(Type sharedActionType, TestCase relatedTestCase, object Context, List<Variable> ContextValues, ActionReport actionReport, params Variable[] parameters)
Parameters
Type Name Description
Type sharedActionType
TestCase relatedTestCase
Object Context
List<Variable> ContextValues
ActionReport actionReport
Variable[] parameters
Returns
Type Description
SharedActionBase
| Edit this page View Source

DoAction(Type, Object, List<Variable>, ActionReport, Variable[])

Static function to run this shared action. the action:

  1. Check if all the required parameters are given, or by default using it's default value.
  2. for all those who the parameter has no default value (Parameter.Value == null), throw exception
  3. Create an instance of the action and run it.
Declaration
public static SharedActionBase DoAction(Type sharedActionType, object Context, List<Variable> ContextValues, ActionReport actionReport, params Variable[] parameters)
Parameters
Type Name Description
Type sharedActionType

the object type of sharedAction

Object Context

The browser object

List<Variable> ContextValues

The stored context content to be shared and be used with other actions.

ActionReport actionReport

The testaction report to use for generating

Variable[] parameters

Test parameters

Returns
Type Description
SharedActionBase

A SharedActionBase object which is created during the execution. this object can be used later to call DoCheckpoint()

| Edit this page View Source

DoAction(Type, Object, List<Variable>, Variable[])

Funaction to run an sub action from the current one. This action reuses the DoAction(Type, Object, List<Variable>, ActionReport, Variable[]) and generates a ActionReport attached to SubActionReports

Declaration
protected SharedActionBase DoAction(Type sharedActionType, object Context, List<Variable> ContextValues, params Variable[] parameters)
Parameters
Type Name Description
Type sharedActionType

the object type of sharedAction

Object Context

The browser object

List<Variable> ContextValues

The stored context content to be shared and be used with other actions.

Variable[] parameters

Test parameters

Returns
Type Description
SharedActionBase

A SharedActionBase object which is created during the execution. this object can be used later to call DoCheckpoint()

| Edit this page View Source

DoActionWithCheckpoint(Type, Object, List<Variable>, ActionReport, Variable[])

Static function to execute and check the Shared Action

This action calls internally DoAction() and DoCheckpoint() together. it is recommended to call this function within an action.

Declaration
public static bool DoActionWithCheckpoint(Type sharedActionType, object Context, List<Variable> ContextValues, ActionReport actionReport, params Variable[] parameters)
Parameters
Type Name Description
Type sharedActionType

the Type of the SharedAction to run

Object Context

The Browser object

List<Variable> ContextValues

The stored context content to be shared and be used with other actions

ActionReport actionReport

The report object of the target action to be used.

Variable[] parameters

Given parameters (test data dedicated to the current test case)

Returns
Type Description
Boolean

Boolean value indicates if the Action runs well and the checkpoint passes.

Remarks

When calling DoAction, DoCheckpoint or DoActionWithCheckpoint in another action, please consider promote the result to above level.

| Edit this page View Source

DoActionWithCheckpoint(Type, Object, List<Variable>, SharedActionBase, Variable[])

Static function to execute and check the Shared Action

This action calls internally DoAction() and DoCheckpoint() together. it is recommended to call this function within an action.

Declaration
public static bool DoActionWithCheckpoint(Type sharedActionType, object Context, List<Variable> ContextValues, SharedActionBase CallingAction, params Variable[] parameters)
Parameters
Type Name Description
Type sharedActionType

the Type of the SharedAction to run

Object Context

The Browser object

List<Variable> ContextValues

The stored context content to be shared and be used with other actions

SharedActionBase CallingAction

The SharedAction object which calls the sub-action to be executed.

Variable[] parameters

Given parameters (test data dedicated to the current test case)

Returns
Type Description
Boolean

Boolean value indicates if the Action runs well and the checkpoint passes.

Remarks

When calling DoAction, DoCheckpoint or DoActionWithCheckpoint in another action, please consider promote the result to above level.

| Edit this page View Source

DoCheckpoint(Object)

This method should be called after calling DoAction() Method in order to check whether the action is correctly running.

Declaration
public abstract bool DoCheckpoint(object Context)
Parameters
Type Name Description
Object Context

Application Context used for the checkpoint, for LeanFT actions, it will be an object of type AppModelBase

Returns
Type Description
Boolean

True if the checkpoint is passed, or False if the checkpoint fails. if the return value is false, the test will be marked as failed.

Remarks

If the return value is True and the ActionResult = Failed or Warning, Test will continue and the Test case will be marked as Failed.

If the checkpoint returns False, test will be stop and will be considered as Failed.

When calling another action from an action, please considering promote errors and result to above level.

| Edit this page View Source

GetParameter(IEnumerable<Variable>, String)

Get the value of the parameter from giving list. The value can be empty, but will never be null (unless it's value is intendedly changed by yourself) If the parameter does not exists, an exception will be thrown, to avoid this make sure the parameter is listed in RequiredParameters.

Declaration
public static string GetParameter(IEnumerable<Variable> source, string name)
Parameters
Type Name Description
IEnumerable<Variable> source

the list of parameter where the parameter is in.

String name

the name of the parameter to find

Returns
Type Description
String

the value of the giving parameter

| Edit this page View Source

GetParameter(String)

Get the value of the parameter from giving list. The value can be empty, but will never be null (unless it's value is intendedly changed by yourself) If the parameter does not exists, an exception will be thrown, to avoid this make sure the parameter is listed in RequiredParameters.

Declaration
public string GetParameter(string name)
Parameters
Type Name Description
String name

the name of the parameter to find

Returns
Type Description
String

the value of the giving parameter

| Edit this page View Source

GetType(String)

Get the Type of an SharedActionBase by its name.

Declaration
public Type GetType(string action)
Parameters
Type Name Description
String action

the name of the shared action

Returns
Type Description
Type

Type object of the action.

| Edit this page View Source

Screenshot(String)

Provide screen-shot in the report

Declaration
protected abstract void Screenshot(string name)
Parameters
Type Name Description
String name
  • Edit this page
  • View Source
In this article
Back to top Copyright ® 2016-2024 AXA France, All rights reserved.