Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/scenario report #21

Merged
merged 1 commit into from
Dec 10, 2023
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
25 changes: 22 additions & 3 deletions .github/workflows/pr-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,27 @@ on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
build-template-presenter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install Dependencies
run: npm install
working-directory: src/nscenario-report-browser/

- name: Build
run: npm run build
working-directory: src/nscenario-report-browser/

build-extension:
runs-on: windows-latest
needs: build-template-presenter
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
Expand All @@ -18,11 +37,11 @@ jobs:
PackageReleaseNotes: 'https://github.com/${{ github.repository }}/releases'
ContinuousIntegrationBuild: true
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core 5
- uses: actions/checkout@v3
- name: Setup .NET Core 8
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0'
dotnet-version: '8.0'
- name: Calculate next version
uses: cezarypiatek/NextVersionGeneratorAction@0.4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
ContinuousIntegrationBuild: true
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core 5
- name: Setup .NET Core 8
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0'
dotnet-version: '8.0'
- name: Calculate next version
uses: cezarypiatek/NextVersionGeneratorAction@0.4
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,6 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
src/.idea/.idea.NScenario/.idea
src/nscenario-report-browser/.idea
.idea
4 changes: 4 additions & 0 deletions src/NScenario.Demo/AllTestsSetup.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Newtonsoft.Json;
using NScenario.OutputWriters;
using NScenario.StepExecutors;
using NUnit.Framework;
Expand Down Expand Up @@ -29,6 +30,9 @@ public void GlobalTearDown()
_reportWriter.Save("Report.md");
//INFO: Export the markdown to HTML file
_reportWriter.ExportToHtml("Report.html");

// INFO: Export nice html report
TestScenarioFactory.GetAllExecutedScenarios().SaveAsReport("AllReports.html");
}
}
}
8 changes: 5 additions & 3 deletions src/NScenario.Demo/NScenario.Demo.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="SmartAnalyzers.ApprovalTestsExtensions" Version="2.8.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
ScenarioTitle: should collect info about exceptions,
MethodName: should_collect_info_about_exceptions,
FilePath: {ProjectDirectory}UnitTest1.cs,
LineNumber: 138,
Status: Failed,
Steps: [
{
Description: This is the first step,
LineNumber: 142,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0190945,
Status: Failed,
SubSteps: [
{
Description: This is the first sub-step of first step,
LineNumber: 144,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0011362,
Status: Success
},
{
Description: This is the second sub-step of first step,
LineNumber: 148,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0100732,
Status: Failed,
SubSteps: [
{
Description: Yet another nesting level p1,
LineNumber: 150,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0090506,
Status: Failed,
Exception:
System.InvalidOperationException: Something wrong
at NScenario.Demo.Tests.<>c.<should_collect_info_about_exceptions>b__5_4() in {ProjectDirectory}UnitTest1.cs:line 152
at NScenario.StepExecutors.OutputScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext) in {SolutionDirectory}NScenario\StepExecutors\OutputScenarioStepExecutor.cs:line 31
at NScenario.StepExecutors.LevelTrackingScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext) in {SolutionDirectory}NScenario\StepExecutors\LevelTrackingScenarioStepExecutor.cs:line 21
at NScenario.StepExecutors.LevelTrackingScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext) in {SolutionDirectory}NScenario\StepExecutors\LevelTrackingScenarioStepExecutor.cs:line 21
at NScenario.ScenarioInfoCollectorExecutor.Step(String scenarioName, String stepDescription, MaybeAsyncAction action, StepContext stepContext) in {SolutionDirectory}NScenario\ScenarioInfoCollectorExecutor.cs:line 61
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
ScenarioTitle: should collect info about exceptions,
MethodName: should_collect_info_about_exceptions,
FilePath: {ProjectDirectory}UnitTest1.cs,
LineNumber: 138,
Status: Failed,
Steps: [
{
Description: This is the first step,
LineNumber: 142,
FilePath: {ProjectDirectory}UnitTest1.cs,
Status: Failed,
SubSteps: [
{
Description: This is the first sub-step of first step,
LineNumber: 144,
FilePath: {ProjectDirectory}UnitTest1.cs,
Status: Success
},
{
Description: This is the second sub-step of first step,
LineNumber: 148,
FilePath: {ProjectDirectory}UnitTest1.cs,
Status: Failed,
SubSteps: [
{
Description: Yet another nesting level p1,
LineNumber: 150,
FilePath: {ProjectDirectory}UnitTest1.cs,
Status: Failed,
Exception: {
$type: InvalidOperationException,
Type: InvalidOperationException,
Message: Something wrong,
Data: {
NScenarioHandled: true
},
StackTrace:
at NScenario.Demo.Tests.<>c.<should_collect_info_about_exceptions>b__5_4()
at NScenario.StepExecutors.OutputScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.StepExecutors.LevelTrackingScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.StepExecutors.LevelTrackingScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.ScenarioInfoCollectorExecutor.Step(String scenarioName, String stepDescription, MaybeAsyncAction action, StepContext stepContext)
at NScenario.ScenarioInfoCollectorExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.TestScenario.Step(String description, Func`1 action, String filePath, String methodName, Int32 lineNumber)
--- End of stack trace from previous location ---
at NScenario.StepExecutors.OutputScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.StepExecutors.LevelTrackingScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.StepExecutors.LevelTrackingScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.ScenarioInfoCollectorExecutor.Step(String scenarioName, String stepDescription, MaybeAsyncAction action, StepContext stepContext)
at NScenario.ScenarioInfoCollectorExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.TestScenario.Step(String description, Func`1 action, String filePath, String methodName, Int32 lineNumber)
--- End of stack trace from previous location ---
at NScenario.StepExecutors.OutputScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.StepExecutors.LevelTrackingScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.StepExecutors.LevelTrackingScenarioStepExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.ScenarioInfoCollectorExecutor.Step(String scenarioName, String stepDescription, MaybeAsyncAction action, StepContext stepContext)
at NScenario.ScenarioInfoCollectorExecutor.Step(String scenarioName, String stepDescription, Func`1 action, StepContext stepContext)
at NScenario.TestScenario.Step(String description, Func`1 action, String filePath, String methodName, Int32 lineNumber)
at NScenario.Demo.Tests.should_collect_info_about_exceptions()
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
ScenarioTitle: should present scenario with sub steps,
MethodName: should_present_scenario_with_sub_steps,
FilePath: {ProjectDirectory}UnitTest1.cs,
LineNumber: 104,
Steps: [
{
Description: This is the first step,
LineNumber: 106,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0025073,
Status: Success,
SubSteps: [
{
Description: This is the first sub-step of first step,
LineNumber: 108,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0001351,
Status: Success
},
{
Description: This is the second sub-step of first step,
LineNumber: 112,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0012006,
Status: Success,
SubSteps: [
{
Description: Yet another nesting level p1,
LineNumber: 114,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0001024,
Status: Success
},
{
Description: Yet another nesting level p2,
LineNumber: 118,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0000864,
Status: Success
}
]
}
]
},
{
Description: This is the second step,
LineNumber: 175,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0010105,
Status: Success,
SubSteps: [
{
Description: This is the first sub-step of second step,
LineNumber: 177,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0000875,
Status: Success
},
{
Description: This is the second sub-step of second step,
LineNumber: 181,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0000664,
Status: Success
}
]
},
{
Description: This is the third step,
LineNumber: 127,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0000586,
Status: Success
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
ScenarioTitle: should present scenario with sub steps,
MethodName: should_present_scenario_with_sub_steps,
FilePath: {ProjectDirectory}UnitTest1.cs,
LineNumber: 104,
Steps: [
{
Description: This is the first step,
LineNumber: 106,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0014539,
Status: Success,
SubSteps: [
{
Description: This is the first sub-step of first step,
LineNumber: 108,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0000699,
Status: Success
},
{
Description: This is the second sub-step of first step,
LineNumber: 112,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0007161,
Status: Success,
SubSteps: [
{
Description: Yet another nesting level p1,
LineNumber: 114,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0000587,
Status: Success
},
{
Description: Yet another nesting level p2,
LineNumber: 118,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0000733,
Status: Success
}
]
}
]
},
{
Description: This is the second step,
LineNumber: 175,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0008702,
Status: Success,
SubSteps: [
{
Description: This is the first sub-step of second step,
LineNumber: 177,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0000749,
Status: Success
},
{
Description: This is the second sub-step of second step,
LineNumber: 181,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0000440,
Status: Success
}
]
},
{
Description: This is the third step,
LineNumber: 127,
FilePath: {ProjectDirectory}UnitTest1.cs,
ExecutionTime: 00:00:00.0000508,
Status: Success
}
]
}
Loading
Loading