Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/AxaFrance.WebEngine.Doc/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
],
"build": {
"globalMetadata": {
"_appTitle": "AXA WebEngine Test Framework",
"_appFooter": "Copyright ® 2016-2024 AXA France, All rights reserved.",
"_appTitle": "AXA - WebEngine Test Framework",
"_appFooter": "Copyright ® 2016-2025 AXA France, All rights reserved.",
"_appLogoPath": "images/logo.svg"
},
"content": [
Expand Down
53 changes: 28 additions & 25 deletions src/AxaFrance.WebEngine/SharedActionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,26 @@ public abstract class SharedActionBase
/// </summary>
protected ActionReport ActionReport { get; set; }

/// <summary>
/// Test case of which the sharedaction belongs to.
/// </summary>
protected TestCase testCase;


/// <summary>
/// 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.
/// </summary>
/// <param name="sharedActionType">the object type of sharedAction</param>
/// <param name="relatedTestCase">Test case of which the sharedaction belongs to.</param>
/// <param name="Context">The browser object</param>
/// <param name="ContextValues">The stored context content to be shared and be used with other actions.</param>
/// <param name="actionReport">The testaction report to use for generating </param>
/// <param name="parameters">Test parameters</param>
/// <returns>A SharedActionBase object which is created during the execution. this object can be used later to call DoCheckpoint()</returns>

public static SharedActionBase DoAction(Type sharedActionType, TestCase relatedTestCase, object Context, List<Variable> ContextValues, ActionReport actionReport, params Variable[] parameters)
{
Indent += 2;
Expand Down Expand Up @@ -166,26 +184,9 @@ public static SharedActionBase DoAction(Type sharedActionType, TestCase relatedT
return obj;
}

/// <summary>
/// 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.
/// </summary>
/// <param name="sharedActionType">the object type of sharedAction</param>
/// <param name="Context">The browser object</param>
/// <param name="ContextValues">The stored context content to be shared and be used with other actions.</param>
/// <param name="actionReport">The testaction report to use for generating </param>
/// <param name="parameters">Test parameters</param>
/// <returns>A SharedActionBase object which is created during the execution. this object can be used later to call DoCheckpoint()</returns>
public static SharedActionBase DoAction(Type sharedActionType, object Context, List<Variable> ContextValues, ActionReport actionReport, params Variable[] parameters)
{
return DoAction(sharedActionType, null, Context, ContextValues, actionReport, parameters);
}

/// <summary>
/// Funaction to run an sub action from the current one.
/// This action reuses the <see cref="DoAction(Type, object, List{Variable}, ActionReport, Variable[])"/> and generates
/// This action reuses the <see cref="DoAction(Type, TestCase object, List{Variable}, ActionReport, Variable[])"/> and generates
/// a <see cref="ActionReport"/> attached to <see cref="ActionReport.SubActionReports"/>
/// </summary>
/// <param name="sharedActionType">the object type of sharedAction</param>
Expand All @@ -197,7 +198,7 @@ protected SharedActionBase DoAction(Type sharedActionType, object Context, List<
{
ActionReport ar = new ActionReport();
ActionReport.SubActionReports.Add(ar);
var action = DoAction(sharedActionType, Context, ContextValues, ar, parameters);
var action = SharedActionBase.DoAction(sharedActionType, this.testCase, Context, ContextValues, ar, parameters);
return action;
}

Expand All @@ -206,6 +207,7 @@ protected SharedActionBase DoAction(Type sharedActionType, object Context, List<
/// <para>This action calls internally DoAction() and DoCheckpoint() together. it is recommended to call this function within an action.</para>
/// </summary>
/// <param name="sharedActionType">the Type of the SharedAction to run</param>
/// <param name="testCase">TestCase which this action belongs to.</param>
/// <param name="Context">The Browser object</param>
/// <param name="ContextValues">The stored context content to be shared and be used with other actions</param>
/// <param name="actionReport">The report object of the target action to be used.</param>
Expand All @@ -214,15 +216,15 @@ protected SharedActionBase DoAction(Type sharedActionType, object Context, List<
/// <remarks>
/// When calling DoAction, DoCheckpoint or DoActionWithCheckpoint in another action, please consider promote the result to above level.
/// </remarks>
public static bool DoActionWithCheckpoint(Type sharedActionType, object Context, List<Variable> ContextValues, ActionReport actionReport, params Variable[] parameters)
public static bool DoActionWithCheckpoint(Type sharedActionType, TestCase testCase, object Context, List<Variable> ContextValues, ActionReport actionReport, params Variable[] parameters)
{
bool returnvalue = true;
SharedActionBase action = DoAction(sharedActionType, Context, ContextValues, actionReport, parameters);
SharedActionBase action = DoAction(sharedActionType, testCase, Context, ContextValues, actionReport, parameters);
if (action.ActionResult == Result.CriticalError) returnvalue = false;
else returnvalue = action.DoCheckpoint(Context);
if (!returnvalue)
{
action.Screenshot("Auto screenshot for failure");
action.Screenshot("Auto screenshot because DoCheckpoint returns failure");
}
actionReport.ContextValues = action.ContextValues.ToList();
actionReport.EndTime = DateTime.Now;
Expand All @@ -246,9 +248,10 @@ public static bool DoActionWithCheckpoint(Type sharedActionType, object Context,
/// </remarks>
public static bool DoActionWithCheckpoint(Type sharedActionType, object Context, List<Variable> ContextValues, SharedActionBase CallingAction, params Variable[] parameters)
{
ActionReport action = new ActionReport();
CallingAction.ActionReport.SubActionReports.Add(action);
return DoActionWithCheckpoint(sharedActionType, Context, ContextValues, action, parameters);
var tc = CallingAction.testCase;
ActionReport actionReport = new ActionReport();
CallingAction.ActionReport.SubActionReports.Add(actionReport);
return DoActionWithCheckpoint(sharedActionType, tc, Context, ContextValues, actionReport, parameters);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Samples.Gherkin/Samples.Gherkin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="SpecFlow.NUnit" Version="3.9.74" />
<PackageReference Include="nunit" Version="4.4.0" />
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
<PackageReference Include="FluentAssertions" Version="8.6.0" />
<PackageReference Include="FluentAssertions" Version="8.7.0" />
</ItemGroup>

<ItemGroup>
Expand Down