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/Cucumber Messages #233

Open
wants to merge 224 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
224 commits
Select commit Hold shift + click to select a range
d9e3dc2
Add TimeStamp to all ExecutionEvents. These will be used when seriali…
clrudolphi Aug 5, 2024
73e48e2
Experiment: Threading.Channel used to pump Messages from TestThreadEx…
clrudolphi Aug 6, 2024
63e95fc
Experimental: plumbed the instantiation and intialization of the Cucu…
clrudolphi Aug 7, 2024
57b21d0
Exploratory: Extended System Tests to create a CucumberCompatibilityT…
clrudolphi Aug 7, 2024
80af263
Plugin stucture complete; test case runs, but no output.
clrudolphi Aug 9, 2024
a686657
Made pulling of registered sinks to be dynamic; eliminated Publisher …
clrudolphi Aug 9, 2024
d85764a
Refactored Publisher into an internally loaded PlugIn. Separated the …
clrudolphi Aug 9, 2024
63d23df
Simplified by eliminating use of Threading.Channels; substituting in …
clrudolphi Aug 10, 2024
18923fe
TestRunStarted and TestRunFinished Cucumber Messages supported.
clrudolphi Aug 10, 2024
0842f1c
Proof of Concept working for the generation and emit of the static Cu…
clrudolphi Aug 13, 2024
4fa4441
Added CucumberMessageFactory as a draft method of converting Reqnroll…
clrudolphi Aug 14, 2024
76b6bca
Fixed a bug in how the cucumber messages were created by the UnitTest…
clrudolphi Aug 14, 2024
e679f04
Fixed bug that was causing a namespace conflict with the Specs project.
clrudolphi Aug 15, 2024
8eb0df9
When Pickles can't be created (such as with ExternalData), suspend su…
clrudolphi Aug 15, 2024
4321f34
Messages are cached until the last thread is finished with the Featur…
clrudolphi Aug 17, 2024
514b558
Slight change to handling of FeatureFiinished event for thread safety.
clrudolphi Aug 18, 2024
3180353
Initial setup of ScenarioStart and Finish.
clrudolphi Aug 18, 2024
351efa1
Refactored Message creation to Factory class. FeatureState and Scenar…
clrudolphi Aug 19, 2024
e7f7e08
Refactor: deferred processing of all Scenario and step events until a…
clrudolphi Aug 19, 2024
ff358d0
Completed structure of event processors and state tracker objects for…
clrudolphi Aug 19, 2024
380bff5
Basic structure in place.
clrudolphi Aug 20, 2024
0220a77
All CCK examples loaded, except for markdown, retry, and stack-traces…
clrudolphi Aug 20, 2024
0209bfe
Added Attachments and Hooks bindings. Needs additional work to proper…
clrudolphi Aug 21, 2024
1bea51e
Added Hook support.
clrudolphi Aug 22, 2024
704a7dd
Fixed how Undefined steps are handled in the StepEventProcessor and i…
clrudolphi Aug 22, 2024
3aa4cef
Moved NDJSON serialization into Reqnroll from the File Plugin making …
clrudolphi Aug 22, 2024
15cb91a
Configuration of File output driven by a json configuration file.
clrudolphi Aug 23, 2024
f7302db
Eliminated some tracing that is no longer useful for debugging.
clrudolphi Aug 23, 2024
d010db0
Upgrade CucumberMessages nuget package to 26.0.0
clrudolphi Aug 23, 2024
98a17a9
Added FileExtension to MIMEType map for the attachment Added handling…
clrudolphi Aug 23, 2024
132dcb3
AddAttachment and OutputHelper.WriteLine added with Message output as…
clrudolphi Aug 26, 2024
0c32654
Support for generating ParameterType Messages from StepArgumentTransf…
clrudolphi Aug 29, 2024
c9e1a22
Working except for the TestStepStarted/Finished for the hook that thr…
clrudolphi Aug 29, 2024
34a1b8a
Hardcode ParameterType Message properties of useForSnippets and prefe…
clrudolphi Aug 30, 2024
a6b547c
First draft of obtaining Product infos from Analytics Provider.
clrudolphi Sep 1, 2024
b621d34
Refactored Meta, CI and Git creation to the MessageFactory.
clrudolphi Sep 3, 2024
cd6d304
Exceptions in steps produce Exception Messages.
clrudolphi Aug 30, 2024
3dd8f1d
Moved back to using HookBindingFinished; eliminated use of HookFinish…
clrudolphi Aug 31, 2024
77dafde
Hooks now working per CCK pending outcome of bug analysis of TEE.
clrudolphi Sep 1, 2024
024cb20
Given default Gherkin.Ast.Locations of (0,0) to generated Table eleme…
clrudolphi Sep 1, 2024
03d1589
Added a smoke test to prove that ExternalData generated Example table…
clrudolphi Sep 3, 2024
593cdc8
Ensure that CucumberMessages doesn't run when no Sink is registered.
clrudolphi Sep 4, 2024
d1dbcdc
Refactored Environment Info away from EnvironmentWrapper
clrudolphi Sep 4, 2024
367a595
Update nuget dependencies to match Main
clrudolphi Sep 4, 2024
d808f27
Establishes cross-reference data structures to find Messages by type …
clrudolphi Sep 5, 2024
8815995
Reorganization - fixed namespace naming mistake;
clrudolphi Sep 6, 2024
15e52ae
The Validator fully builds out cross-reference tables using the visit…
clrudolphi Sep 6, 2024
bb446ba
Flushing out validator tests.
clrudolphi Sep 7, 2024
545f991
Source and GherkinDoc now using FA.
clrudolphi Sep 9, 2024
31b2513
Minimal and Hooks now passing Content and GD checks.
clrudolphi Sep 9, 2024
d6fa627
Source, GD, Pickle, StepDefinition and TestCase now working for Minimal.
clrudolphi Sep 10, 2024
25f1a21
All Envelope comparisons working for Minimal. Partial for Hooks.
clrudolphi Sep 10, 2024
a8de646
Refactoring and minor improvements
clrudolphi Sep 11, 2024
b06135a
Hooks now working. Fixed BASE64 encoding of svg file in CCK.
clrudolphi Sep 12, 2024
bfcfe76
Added stack-traces scenario from CCK.
clrudolphi Sep 12, 2024
0ddb463
Added Ambiguous scenario and corrected error in the Factory in how te…
clrudolphi Sep 13, 2024
7d0491c
Added referential integrity validations on Actuals.
clrudolphi Sep 13, 2024
65faa43
Validation test suite functionally complete.
clrudolphi Sep 13, 2024
2648b5c
Revert "Given default Gherkin.Ast.Locations of (0,0) to generated Tab…
clrudolphi Sep 16, 2024
4e923df
Modified CucumberMessagesConverter to include transformation of the A…
clrudolphi Sep 16, 2024
8fb61c4
Fixed: HookTestStep should have argument properties that are null.
clrudolphi Sep 17, 2024
d9b5d1e
Enhanced BindingException with sub-class AmbiguousBindingException to…
clrudolphi Sep 17, 2024
3c6e111
Modified how step arguments are handled to prevent step DataTable and…
clrudolphi Sep 18, 2024
f4f4a0b
Large (partial) refactor. Modified code gen so that pickleID is provi…
clrudolphi Sep 20, 2024
147b345
Refactored scenario tracking into TestCase tracking
clrudolphi Sep 24, 2024
ca14714
Most tests passing. Need to clean up Specs.
clrudolphi Sep 24, 2024
ced75d6
Added support for Background steps.
clrudolphi Sep 24, 2024
cde5c36
Moved FileSink to be a built-in plug-in
clrudolphi Sep 25, 2024
52d5e10
FileSink Configuration supports environment variable overrides for th…
clrudolphi Sep 25, 2024
d10accb
FileSink now waits to register as a Sink until it is confirmed that i…
clrudolphi Sep 25, 2024
ce8376e
Removed local nuget location from nuget.config
clrudolphi Sep 25, 2024
b005f26
Refactored configuration to use Profiles.
clrudolphi Sep 25, 2024
330be60
Fixed ReqnrollOutputHelperTest
clrudolphi Sep 25, 2024
feddbef
Simplified File Plug In handling of configuration.
clrudolphi Sep 26, 2024
6a97d91
Modified Generator to globalize references to Reqnroll types related …
clrudolphi Sep 26, 2024
0fc4ae1
Updated GeneratorTests to include now required RnRDocumentLocation el…
clrudolphi Sep 28, 2024
55154cf
Fixed bug in LocationPatcher that was obliterating Rule Backgrounds.
clrudolphi Sep 28, 2024
9582c8c
Fix Publisher to subscribe to TestThreadPublisher on CustomizeTestThr…
clrudolphi Sep 28, 2024
4ccd7ae
Added the Empty scenario from the CCK; adjusted test validation to ac…
clrudolphi Sep 28, 2024
0f37bc7
Removing the Messages FileSink Plugin directory as it is no longer ne…
clrudolphi Sep 29, 2024
a45e83c
Moved the assignment of a pickle step ID from inline generated code t…
clrudolphi Sep 30, 2024
cea66b8
Refactored Configuration into distinct subsystem.
clrudolphi Oct 2, 2024
b7929f9
Add Explicit Text.Json assembly dependencies to MSBuild.Generation
clrudolphi Oct 2, 2024
6081e22
Improved PickleJar's handling of edge-case in which we have no Pickle…
clrudolphi Oct 2, 2024
6eed6e9
Add TimeStamp to all ExecutionEvents. These will be used when seriali…
clrudolphi Aug 5, 2024
1bb4822
Experiment: Threading.Channel used to pump Messages from TestThreadEx…
clrudolphi Aug 6, 2024
558e12b
Experimental: plumbed the instantiation and intialization of the Cucu…
clrudolphi Aug 7, 2024
b2265af
Exploratory: Extended System Tests to create a CucumberCompatibilityT…
clrudolphi Aug 7, 2024
8ab0c24
Plugin stucture complete; test case runs, but no output.
clrudolphi Aug 9, 2024
67f7096
Made pulling of registered sinks to be dynamic; eliminated Publisher …
clrudolphi Aug 9, 2024
7751a24
Refactored Publisher into an internally loaded PlugIn. Separated the …
clrudolphi Aug 9, 2024
b43f05f
Simplified by eliminating use of Threading.Channels; substituting in …
clrudolphi Aug 10, 2024
bf9beb9
TestRunStarted and TestRunFinished Cucumber Messages supported.
clrudolphi Aug 10, 2024
d053088
Proof of Concept working for the generation and emit of the static Cu…
clrudolphi Aug 13, 2024
5d42632
Added CucumberMessageFactory as a draft method of converting Reqnroll…
clrudolphi Aug 14, 2024
21a44ae
Fixed a bug in how the cucumber messages were created by the UnitTest…
clrudolphi Aug 14, 2024
1a63998
Fixed bug that was causing a namespace conflict with the Specs project.
clrudolphi Aug 15, 2024
751c315
When Pickles can't be created (such as with ExternalData), suspend su…
clrudolphi Aug 15, 2024
0478bb0
Messages are cached until the last thread is finished with the Featur…
clrudolphi Aug 17, 2024
3cf686b
Slight change to handling of FeatureFiinished event for thread safety.
clrudolphi Aug 18, 2024
f79ea6e
Initial setup of ScenarioStart and Finish.
clrudolphi Aug 18, 2024
0d89be1
Refactored Message creation to Factory class. FeatureState and Scenar…
clrudolphi Aug 19, 2024
c877eb2
Refactor: deferred processing of all Scenario and step events until a…
clrudolphi Aug 19, 2024
0d9d70a
Completed structure of event processors and state tracker objects for…
clrudolphi Aug 19, 2024
5c87654
Basic structure in place.
clrudolphi Aug 20, 2024
24fdc10
All CCK examples loaded, except for markdown, retry, and stack-traces…
clrudolphi Aug 20, 2024
66b7037
Added Attachments and Hooks bindings. Needs additional work to proper…
clrudolphi Aug 21, 2024
63e073e
Added Hook support.
clrudolphi Aug 22, 2024
5b2940c
Fixed how Undefined steps are handled in the StepEventProcessor and i…
clrudolphi Aug 22, 2024
5b6eb3c
Moved NDJSON serialization into Reqnroll from the File Plugin making …
clrudolphi Aug 22, 2024
6b7bf9f
Configuration of File output driven by a json configuration file.
clrudolphi Aug 23, 2024
494684f
Eliminated some tracing that is no longer useful for debugging.
clrudolphi Aug 23, 2024
b86ee1b
Upgrade CucumberMessages nuget package to 26.0.0
clrudolphi Aug 23, 2024
e934f8f
Added FileExtension to MIMEType map for the attachment Added handling…
clrudolphi Aug 23, 2024
c1a42e1
AddAttachment and OutputHelper.WriteLine added with Message output as…
clrudolphi Aug 26, 2024
de40f1f
Support for generating ParameterType Messages from StepArgumentTransf…
clrudolphi Aug 29, 2024
5db57d5
Working except for the TestStepStarted/Finished for the hook that thr…
clrudolphi Aug 29, 2024
6704d41
Hardcode ParameterType Message properties of useForSnippets and prefe…
clrudolphi Aug 30, 2024
66c6654
First draft of obtaining Product infos from Analytics Provider.
clrudolphi Sep 1, 2024
bb4eb4d
Refactored Meta, CI and Git creation to the MessageFactory.
clrudolphi Sep 3, 2024
f7b6c39
Exceptions in steps produce Exception Messages.
clrudolphi Aug 30, 2024
18a3d01
Moved back to using HookBindingFinished; eliminated use of HookFinish…
clrudolphi Aug 31, 2024
b96aff1
Hooks now working per CCK pending outcome of bug analysis of TEE.
clrudolphi Sep 1, 2024
6f88cd0
Given default Gherkin.Ast.Locations of (0,0) to generated Table eleme…
clrudolphi Sep 1, 2024
5532d9f
Added a smoke test to prove that ExternalData generated Example table…
clrudolphi Sep 3, 2024
6359f4c
Ensure that CucumberMessages doesn't run when no Sink is registered.
clrudolphi Sep 4, 2024
e154a37
Refactored Environment Info away from EnvironmentWrapper
clrudolphi Sep 4, 2024
fda9d61
Update nuget dependencies to match Main
clrudolphi Sep 4, 2024
3cf8a8d
Establishes cross-reference data structures to find Messages by type …
clrudolphi Sep 5, 2024
6b3debd
Reorganization - fixed namespace naming mistake;
clrudolphi Sep 6, 2024
6a16c0a
The Validator fully builds out cross-reference tables using the visit…
clrudolphi Sep 6, 2024
689d790
Flushing out validator tests.
clrudolphi Sep 7, 2024
60f3ccf
Source and GherkinDoc now using FA.
clrudolphi Sep 9, 2024
633bba5
Minimal and Hooks now passing Content and GD checks.
clrudolphi Sep 9, 2024
0ed450f
Source, GD, Pickle, StepDefinition and TestCase now working for Minimal.
clrudolphi Sep 10, 2024
113d248
All Envelope comparisons working for Minimal. Partial for Hooks.
clrudolphi Sep 10, 2024
3fa200e
Refactoring and minor improvements
clrudolphi Sep 11, 2024
6944c49
Hooks now working. Fixed BASE64 encoding of svg file in CCK.
clrudolphi Sep 12, 2024
4ee7e5b
Added stack-traces scenario from CCK.
clrudolphi Sep 12, 2024
4435fc3
Added Ambiguous scenario and corrected error in the Factory in how te…
clrudolphi Sep 13, 2024
e903535
Added referential integrity validations on Actuals.
clrudolphi Sep 13, 2024
1fdcebb
Validation test suite functionally complete.
clrudolphi Sep 13, 2024
2c7fc60
Revert "Given default Gherkin.Ast.Locations of (0,0) to generated Tab…
clrudolphi Sep 16, 2024
e33fd77
Modified CucumberMessagesConverter to include transformation of the A…
clrudolphi Sep 16, 2024
febac6b
Fixed: HookTestStep should have argument properties that are null.
clrudolphi Sep 17, 2024
d23c076
Enhanced BindingException with sub-class AmbiguousBindingException to…
clrudolphi Sep 17, 2024
b573151
Modified how step arguments are handled to prevent step DataTable and…
clrudolphi Sep 18, 2024
87fce65
Large (partial) refactor. Modified code gen so that pickleID is provi…
clrudolphi Sep 20, 2024
6358e8e
Refactored scenario tracking into TestCase tracking
clrudolphi Sep 24, 2024
458ac5a
Most tests passing. Need to clean up Specs.
clrudolphi Sep 24, 2024
1b8c80f
Added support for Background steps.
clrudolphi Sep 24, 2024
c6dba89
Moved FileSink to be a built-in plug-in
clrudolphi Sep 25, 2024
88cd3ee
FileSink Configuration supports environment variable overrides for th…
clrudolphi Sep 25, 2024
1b87adc
FileSink now waits to register as a Sink until it is confirmed that i…
clrudolphi Sep 25, 2024
b608f81
Removed local nuget location from nuget.config
clrudolphi Sep 25, 2024
2246253
Refactored configuration to use Profiles.
clrudolphi Sep 25, 2024
e85996c
Fixed ReqnrollOutputHelperTest
clrudolphi Sep 25, 2024
c0400e8
Simplified File Plug In handling of configuration.
clrudolphi Sep 26, 2024
35181e4
Modified Generator to globalize references to Reqnroll types related …
clrudolphi Sep 26, 2024
75e8a8a
Updated GeneratorTests to include now required RnRDocumentLocation el…
clrudolphi Sep 28, 2024
93fd111
Fixed bug in LocationPatcher that was obliterating Rule Backgrounds.
clrudolphi Sep 28, 2024
96bd3a8
Fix Publisher to subscribe to TestThreadPublisher on CustomizeTestThr…
clrudolphi Sep 28, 2024
2d20806
Added the Empty scenario from the CCK; adjusted test validation to ac…
clrudolphi Sep 28, 2024
042cc2c
Removing the Messages FileSink Plugin directory as it is no longer ne…
clrudolphi Sep 29, 2024
6b8775b
Moved the assignment of a pickle step ID from inline generated code t…
clrudolphi Sep 30, 2024
98ac315
Refactored Configuration into distinct subsystem.
clrudolphi Oct 2, 2024
a28a08d
Add Explicit Text.Json assembly dependencies to MSBuild.Generation
clrudolphi Oct 2, 2024
8c0e8e7
Improved PickleJar's handling of edge-case in which we have no Pickle…
clrudolphi Oct 2, 2024
2ea4808
Merge branch 'feature-CucumberMessages' of https://github.com/reqnrol…
clrudolphi Oct 2, 2024
25bcc59
Fix GeneratorTests to match the new constructor signature of the Unit…
clrudolphi Oct 2, 2024
c7eda77
Refactored namespaces and put classes into Solution Folders.
clrudolphi Oct 2, 2024
ff753ef
Fix bug with creation of ParameterType messages when StepArgumentTran…
clrudolphi Oct 3, 2024
d232bbe
Fix VB Generation error caused by illegal character in method paramet…
clrudolphi Oct 3, 2024
40a97d5
Modified configuration system to contain setting for ID Generation St…
clrudolphi Oct 3, 2024
3052fe7
Refactored project structure and namespaces to better group Cucumber …
clrudolphi Oct 4, 2024
3a11a31
Generation is now aware of configured IDGeneratorStyle.
clrudolphi Oct 4, 2024
44924c7
UUID id generation now working.
clrudolphi Oct 4, 2024
5f7dccb
Comments added to most classes.
clrudolphi Oct 6, 2024
f86db0f
Removed progress tracing. Left in trace output of Warnings related to…
clrudolphi Oct 7, 2024
bcba147
Generate Messages As CodeDom Expressions
clrudolphi Oct 8, 2024
91ab857
Publishes only a single TestRunStartedMessage per run (not per Feature).
clrudolphi Oct 10, 2024
19dea3c
Modifications to make generation of events in a multi-Feature test as…
clrudolphi Oct 10, 2024
abcc181
Default Config is now OFF.
clrudolphi Oct 11, 2024
7a1abfc
Merge branch 'main' into feature-CucumberMessages
clrudolphi Oct 11, 2024
74a01ef
Documentation first draft. Lacking navigation from main docs.
clrudolphi Oct 12, 2024
bb64225
Added ability to override the configuration file's name by use of an …
clrudolphi Oct 15, 2024
b508dac
Correcting namespace.
clrudolphi Oct 16, 2024
6058a92
Simplified the File Sink to run on the main thread. The serializer wa…
clrudolphi Oct 16, 2024
772bbaf
Fix using in tests.
clrudolphi Oct 16, 2024
4722564
Fixed bug in overriding Enable flag in config files.
clrudolphi Oct 16, 2024
eaace73
Rename CCK directory to Samples
clrudolphi Oct 16, 2024
5236e47
Improved codegen to make all references to Messages types as global::
clrudolphi Oct 16, 2024
7dd4358
Building up the static message object trees are deferred until the Fe…
clrudolphi Oct 16, 2024
1d08a7c
ExternalBindings: initial set up of a test harness.
clrudolphi Oct 16, 2024
05061ce
Modified Publisher to subscribed to the TestThreadEventPublisher as a…
clrudolphi Oct 16, 2024
a17237a
Added test to confirm that External Binding Assembly's step definitio…
clrudolphi Oct 17, 2024
39a7967
Merge branch 'ProveBindingAssembliesWorkWithMessages' into feature-Cu…
clrudolphi Oct 17, 2024
c4cc0b7
Testing: configured Multi-Feature smoke test to be parallel (by Featu…
clrudolphi Oct 18, 2024
e1cace2
FileSinkPlugin refactored to again use a BlockingCollection as a queu…
clrudolphi Oct 18, 2024
a78dca6
Minor fix to the Factory that emits Meta messages to get the Reqnroll…
clrudolphi Oct 18, 2024
7237a40
Fix Cucumber Test problem caused by code reorg
clrudolphi Oct 18, 2024
a24a277
Async Await support added to TestThreadExecutionEventPublisher and (m…
clrudolphi Oct 20, 2024
92b43e4
Revised async implementation so that only the outer API is async (Pub…
clrudolphi Oct 21, 2024
7feaa08
Fix to the NDJSONSerializer so that '+' sign in Messages enums is cor…
clrudolphi Oct 21, 2024
f96fde9
Fix to FeatureFinished in the FeatureTracker so that if it happens th…
clrudolphi Oct 21, 2024
f42771e
Update to Microsoft.Extensions.DependencyModel version
clrudolphi Oct 21, 2024
c931a33
Merge branch 'main' into feature-CucumberMessages
clrudolphi Oct 21, 2024
186ab24
Updated code comments to reflect design considerations for running sc…
clrudolphi Oct 22, 2024
919b819
Link Cucumber docs to main docs
clrudolphi Oct 22, 2024
88facf1
Fix multithreading bug in Gherkin Document rewriter that would occur …
clrudolphi Oct 22, 2024
0fb0ddc
Code Adapted to Messages v27; support for TestRunStartedId, HookType …
clrudolphi Oct 30, 2024
cc5b709
Marked the older constructors for HookBinding, OutputAdded, and Attac…
clrudolphi Oct 31, 2024
77d8333
Merge branch 'main' into MainMergeTestBranch
clrudolphi Nov 7, 2024
452ac85
Refactored Test Class generation to match Reqnroll v2.2 changes in Fe…
clrudolphi Nov 7, 2024
41897a7
Fixed an issue in which the FeatureLevelCucumberMessages constructor …
clrudolphi Nov 7, 2024
7bceb80
Experimental commit - enhance BoDi to include the name of the Interfa…
clrudolphi Nov 7, 2024
2b8ef3d
Fix threading bug that allowed a second Scenario to start before the …
clrudolphi Nov 9, 2024
23ad537
Minor refactor to Publisher
clrudolphi Nov 9, 2024
5d06ba2
Clarified comments on FeatureTracker regarding interdependencies for …
clrudolphi Nov 11, 2024
95860cf
Updated ndjson expected results from CCK
clrudolphi Nov 12, 2024
3e47ddd
Updated ndjson serializer to support new HookType enum.
clrudolphi Nov 12, 2024
dbd80b5
Merge branch 'Messagesv27' into feature-CucumberMessages
clrudolphi Nov 13, 2024
db3219f
Add check for Enabled in Hook event handlers to bail early. This fixe…
clrudolphi Nov 13, 2024
01972bf
Modified Configuration's use of ITraceListener to defer resolution of…
clrudolphi Nov 13, 2024
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
6 changes: 6 additions & 0 deletions Reqnroll.Generator/DefaultDependencyProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Reqnroll.BoDi;
using Reqnroll.Configuration;
using Reqnroll.CucumberMessages.Configuration;
using Reqnroll.EnvironmentAccess;
using Reqnroll.Generator.Configuration;
using Reqnroll.Generator.Generation;
using Reqnroll.Generator.Interfaces;
Expand All @@ -10,6 +12,7 @@
using Reqnroll.Plugins;
using Reqnroll.Tracing;
using Reqnroll.Utils;
using System.IO;

namespace Reqnroll.Generator
{
Expand Down Expand Up @@ -46,6 +49,9 @@ public virtual void RegisterDefaults(ObjectContainer container)

container.RegisterTypeAs<ConfigurationLoader, IConfigurationLoader>();

container.RegisterTypeAs<EnvironmentWrapper, IEnvironmentWrapper>();
container.RegisterTypeAs<CucumberConfiguration, ICucumberConfiguration>();

container.RegisterTypeAs<ReqnrollGherkinParserFactory, IGherkinParserFactory>();

container.RegisterTypeAs<ReqnrollJsonLocator, IReqnrollJsonLocator>();
Expand Down

Large diffs are not rendered by default.

187 changes: 187 additions & 0 deletions Reqnroll.Generator/Generation/CucumberPicklesExpressionGenerator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
using Io.Cucumber.Messages.Types;
using Reqnroll.CucumberMessages.PayloadProcessing.Cucumber;
using Reqnroll.Generator.CodeDom;
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Reqnroll.Generator.Generation
{
/// <summary>
/// Generates a CodeDom expression to create a list of Cucumber Pickles
/// </summary>
internal class CucumberPicklesExpressionGenerator : CucumberMessage_TraversalVisitorBase
{
private CodeDomHelper _codeDomHelper;
private List<CodeExpression> _PickleList;
private List<CodeExpression> _PickleSteps;
private List<CodeExpression> _PickleTags;
CodeExpression _PickleStepArgument;
CodeExpression _PickleDocString;
CodeExpression _PickleTable;
private List<CodeExpression> _TableRows;
private List<CodeExpression> _PickleCells;

private static readonly string GENERICLIST = typeof(List<>).FullName;


public CucumberPicklesExpressionGenerator(CodeDomHelper codeDomHelper)
{
_codeDomHelper = codeDomHelper;
}

private void Reset()
{
_PickleList = new List<CodeExpression>();
_PickleSteps = new List<CodeExpression>();
_PickleTags = new List<CodeExpression>();
_PickleStepArgument = null;
_PickleDocString = null;
_PickleTable = null;
}

public CodeExpression GeneratePicklesExpression(IEnumerable<Pickle> pickles)
{
Reset();
foreach (var pickle in pickles)
{
Visit(pickle);
}

var pickleCodeTypeRef = new CodeTypeReference(typeof(Pickle), CodeTypeReferenceOptions.GlobalReference);
var commentsListExpr = new CodeTypeReference(GENERICLIST, pickleCodeTypeRef);
var initializer = new CodeArrayCreateExpression(pickleCodeTypeRef, _PickleList.ToArray());

return new CodeObjectCreateExpression(commentsListExpr, initializer);
}

public override void Visit(Pickle pickle)
{
var steps = _PickleSteps;
_PickleSteps = new List<CodeExpression>();

var tags = _PickleTags;
_PickleTags = new List<CodeExpression>();

base.Visit(pickle);

var pStepTypeRef = new CodeTypeReference(typeof(PickleStep), CodeTypeReferenceOptions.GlobalReference);
var stepsExpr = new CodeTypeReference(GENERICLIST, pStepTypeRef);
var stepsinitializer = new CodeArrayCreateExpression(pStepTypeRef, _PickleSteps.ToArray());

var tagsTypeRef = new CodeTypeReference(typeof(PickleTag), CodeTypeReferenceOptions.GlobalReference);
var tagsExpr = new CodeTypeReference(GENERICLIST, tagsTypeRef);
var tagsinitializer = new CodeArrayCreateExpression(tagsTypeRef, _PickleTags.ToArray());

var astIdsExpr = new CodeTypeReference(typeof(List<string>));
var astIdsInitializer = new CodeArrayCreateExpression(typeof(string), pickle.AstNodeIds.Select(s => new CodePrimitiveExpression(s)).ToArray());

_PickleList.Add(new CodeObjectCreateExpression(new CodeTypeReference(typeof(Pickle), CodeTypeReferenceOptions.GlobalReference),
new CodePrimitiveExpression(pickle.Id),
new CodePrimitiveExpression(pickle.Uri),
new CodePrimitiveExpression(pickle.Name),
new CodePrimitiveExpression(pickle.Language),
new CodeObjectCreateExpression(stepsExpr, stepsinitializer),
new CodeObjectCreateExpression(tagsExpr, tagsinitializer),
new CodeObjectCreateExpression(astIdsExpr, astIdsInitializer)
));

_PickleSteps = steps;
_PickleTags = tags;
}

public override void Visit(PickleStep step)
{
var arg = _PickleStepArgument;
_PickleStepArgument = null;

base.Visit(step);

var astIdsExpr = new CodeTypeReference(typeof(List<string>));
var astIdsInitializer = new CodeArrayCreateExpression(typeof(string), step.AstNodeIds.Select(s => new CodePrimitiveExpression(s)).ToArray());

_PickleSteps.Add(new CodeObjectCreateExpression(new CodeTypeReference(typeof(PickleStep), CodeTypeReferenceOptions.GlobalReference),
_PickleStepArgument ?? new CodePrimitiveExpression(null),
new CodeObjectCreateExpression(astIdsExpr, astIdsInitializer),
new CodePrimitiveExpression(step.Id),
new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(new CodeTypeReference(typeof(PickleStepType), CodeTypeReferenceOptions.GlobalReference)), step.Type.ToString()),
new CodePrimitiveExpression(step.Text)));

_PickleStepArgument = arg;
}

public override void Visit(PickleDocString docString)
{
_PickleDocString = new CodeObjectCreateExpression(new CodeTypeReference(typeof(PickleDocString), CodeTypeReferenceOptions.GlobalReference),
new CodePrimitiveExpression(docString.MediaType),
new CodePrimitiveExpression(docString.Content));
}

public override void Visit(PickleStepArgument argument)
{
var docString = _PickleDocString;
var table = _PickleTable;

_PickleDocString = null;
_PickleTable = null;

base.Visit(argument);

_PickleStepArgument = new CodeObjectCreateExpression(new CodeTypeReference(typeof(PickleStepArgument), CodeTypeReferenceOptions.GlobalReference),
_PickleDocString ?? new CodePrimitiveExpression(null),
_PickleTable ?? new CodePrimitiveExpression(null));

_PickleDocString = docString;
_PickleTable = table;
}

public override void Visit(PickleTable pickleTable)
{
var rows = _TableRows;
_TableRows = new List<CodeExpression>();

base.Visit(pickleTable);

var pickleTableRowTypeRef = new CodeTypeReference(typeof(PickleTableRow), CodeTypeReferenceOptions.GlobalReference);
var rowsExpr = new CodeTypeReference(GENERICLIST, pickleTableRowTypeRef);
var rowsInitializer = new CodeArrayCreateExpression(pickleTableRowTypeRef, _TableRows.ToArray());

_PickleTable = new CodeObjectCreateExpression(new CodeTypeReference(typeof(PickleTable), CodeTypeReferenceOptions.GlobalReference),
new CodeObjectCreateExpression(rowsExpr, rowsInitializer));

_TableRows = rows;
}

public override void Visit(PickleTableRow row)
{
var cells = _PickleCells;
_PickleCells = new List<CodeExpression>();

base.Visit(row);

var pickleTableCellTypeRef = new CodeTypeReference(typeof(PickleTableCell), CodeTypeReferenceOptions.GlobalReference);
var cellsExpr = new CodeTypeReference(GENERICLIST, pickleTableCellTypeRef);
var cellsInitializer = new CodeArrayCreateExpression(pickleTableCellTypeRef, _PickleCells.ToArray());

_TableRows.Add(new CodeObjectCreateExpression(new CodeTypeReference(typeof(PickleTableRow), CodeTypeReferenceOptions.GlobalReference),
new CodeObjectCreateExpression(cellsExpr, cellsInitializer)));

_PickleCells = cells;
}

public override void Visit(PickleTableCell cell)
{
_PickleCells.Add(new CodeObjectCreateExpression(new CodeTypeReference(typeof(PickleTableCell), CodeTypeReferenceOptions.GlobalReference),
new CodePrimitiveExpression(cell.Value)));
}

public override void Visit(PickleTag tag)
{
_PickleTags.Add(new CodeObjectCreateExpression(new CodeTypeReference(typeof(PickleTag), CodeTypeReferenceOptions.GlobalReference),
new CodePrimitiveExpression(tag.Name),
new CodePrimitiveExpression(tag.AstNodeId)));
}
}
}
2 changes: 2 additions & 0 deletions Reqnroll.Generator/Generation/GeneratorConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ public class GeneratorConstants
public const string SCENARIO_TAGS_VARIABLE_NAME = "tagsOfScenario";
public const string SCENARIO_ARGUMENTS_VARIABLE_NAME = "argumentsOfScenario";
public const string FEATURE_TAGS_VARIABLE_NAME = "featureTags";
public const string PICKLEINDEX_PARAMETER_NAME = "__pickleIndex";
public const string PICKLEINDEX_VARIABLE_NAME = "m_pickleIndex";
}
}
17 changes: 14 additions & 3 deletions Reqnroll.Generator/Generation/ScenarioPartHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text.RegularExpressions;
using Gherkin.Ast;
using Reqnroll.Configuration;
using Reqnroll.CucumberMessages.RuntimeSupport;
using Reqnroll.Generator.CodeDom;
using Reqnroll.Parser;

Expand Down Expand Up @@ -47,7 +48,7 @@ public void SetupFeatureBackground(TestClassGenerationContext generationContext)
GenerateStep(generationContext, statements, step, null);
}
backgroundMethod.Statements.AddRange(statements.ToArray());

}
#region Rule Background Support

Expand Down Expand Up @@ -91,7 +92,7 @@ public void GenerateStep(TestClassGenerationContext generationContext, List<Code
GetTableArgExpression(scenarioStep.Argument as Gherkin.Ast.DataTable, statements, paramToIdentifier),
new CodePrimitiveExpression(scenarioStep.Keyword)
};

using (new SourceLineScope(_reqnrollConfiguration, _codeDomHelper, statements, generationContext.Document.SourceFilePath, gherkinStep.Location))
{
var expression = new CodeMethodInvokeExpression(
Expand Down Expand Up @@ -215,13 +216,23 @@ private CodeExpression GetSubstitutedString(string text, ParameterSubstitution p
return new CodePrimitiveExpression(text);
}

var formatArguments = new List<CodeExpression> {new CodePrimitiveExpression(formatText)};
var formatArguments = new List<CodeExpression> {new CodePrimitiveExpression(formatText) };
formatArguments.AddRange(arguments.Select(id => new CodeVariableReferenceExpression(id)));

return new CodeMethodInvokeExpression(
new CodeTypeReferenceExpression(typeof(string)),
"Format",
formatArguments.ToArray());
}
public void AddVariableForPickleIndex(CodeMemberMethod testMethod, bool pickleIdIncludedInParameters, int pickleIndex)
{
// string m_pickleId = pickleJar.CurrentPickleId; or
// string m_pickleId = @pickleId;
var pickleIdVariable = new CodeVariableDeclarationStatement(typeof(string), GeneratorConstants.PICKLEINDEX_VARIABLE_NAME,
pickleIdIncludedInParameters ?
new CodeVariableReferenceExpression(GeneratorConstants.PICKLEINDEX_PARAMETER_NAME) :
new CodePrimitiveExpression(pickleIndex.ToString()));
testMethod.Statements.Add(pickleIdVariable);
}
}
}
Loading