From 773087fceecf46d54f25b73b841272e5408b1e00 Mon Sep 17 00:00:00 2001 From: David Goss Date: Fri, 2 Aug 2024 14:22:11 -0400 Subject: [PATCH] regenerate code --- .../messages/cucumber/messages/all.hpp | 2 + .../messages/cucumber/messages/attachment.hpp | 1 + .../messages/cucumber/messages/envelope.hpp | 4 + .../messages/global_hook_finished.hpp | 40 +++ .../cucumber/messages/global_hook_started.hpp | 38 +++ .../messages/cucumber/messages/test_case.hpp | 1 + .../cucumber/messages/test_run_finished.hpp | 1 + .../cucumber/messages/test_run_started.hpp | 1 + .../messages/cucumber/messages/attachment.cpp | 2 + .../messages/cucumber/messages/envelope.cpp | 4 + .../messages/global_hook_finished.cpp | 54 +++++ .../cucumber/messages/global_hook_started.cpp | 52 ++++ .../messages/cucumber/messages/test_case.cpp | 2 + .../cucumber/messages/test_run_finished.cpp | 2 + .../cucumber/messages/test_run_started.cpp | 2 + .../Cucumber.Messages/generated/Attachment.cs | 11 +- .../Cucumber.Messages/generated/Envelope.cs | 98 ++++++++ .../generated/GlobalHookFinished.cs | 93 +++++++ .../generated/GlobalHookStarted.cs | 85 +++++++ .../Cucumber.Messages/generated/TestCase.cs | 14 +- .../generated/TestRunFinished.cs | 11 +- .../generated/TestRunStarted.cs | 11 +- go/messages.go | 33 ++- .../cucumber/messages/types/Attachment.java | 16 +- .../io/cucumber/messages/types/Envelope.java | 102 ++++++++ .../messages/types/GlobalHookFinished.java | 87 +++++++ .../messages/types/GlobalHookStarted.java | 77 ++++++ .../io/cucumber/messages/types/TestCase.java | 19 +- .../messages/types/TestRunFinished.java | 16 +- .../messages/types/TestRunStarted.java | 16 +- javascript/src/messages.ts | 37 +++ messages.md | 23 ++ perl/lib/Cucumber/Messages.pm | 228 ++++++++++++++++++ php/src-generated/Attachment.php | 13 + php/src-generated/Envelope.php | 26 ++ php/src-generated/GlobalHookFinished.php | 114 +++++++++ php/src-generated/GlobalHookStarted.php | 98 ++++++++ php/src-generated/TestCase.php | 17 ++ php/src-generated/TestRunFinished.php | 13 + php/src-generated/TestRunStarted.php | 13 + ruby/lib/cucumber/messages/attachment.rb | 9 +- ruby/lib/cucumber/messages/envelope.rb | 10 + .../cucumber/messages/global_hook_finished.rb | 57 +++++ .../cucumber/messages/global_hook_started.rb | 52 ++++ ruby/lib/cucumber/messages/test_case.rb | 12 +- .../cucumber/messages/test_run_finished.rb | 9 +- .../lib/cucumber/messages/test_run_started.rb | 9 +- 47 files changed, 1600 insertions(+), 35 deletions(-) create mode 100644 cpp/include/messages/cucumber/messages/global_hook_finished.hpp create mode 100644 cpp/include/messages/cucumber/messages/global_hook_started.hpp create mode 100644 cpp/src/lib/messages/cucumber/messages/global_hook_finished.cpp create mode 100644 cpp/src/lib/messages/cucumber/messages/global_hook_started.cpp create mode 100644 dotnet/Cucumber.Messages/generated/GlobalHookFinished.cs create mode 100644 dotnet/Cucumber.Messages/generated/GlobalHookStarted.cs create mode 100644 java/src/generated/java/io/cucumber/messages/types/GlobalHookFinished.java create mode 100644 java/src/generated/java/io/cucumber/messages/types/GlobalHookStarted.java create mode 100644 php/src-generated/GlobalHookFinished.php create mode 100644 php/src-generated/GlobalHookStarted.php create mode 100644 ruby/lib/cucumber/messages/global_hook_finished.rb create mode 100644 ruby/lib/cucumber/messages/global_hook_started.rb diff --git a/cpp/include/messages/cucumber/messages/all.hpp b/cpp/include/messages/cucumber/messages/all.hpp index 4b4dc10c..a90d728e 100644 --- a/cpp/include/messages/cucumber/messages/all.hpp +++ b/cpp/include/messages/cucumber/messages/all.hpp @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/cpp/include/messages/cucumber/messages/attachment.hpp b/cpp/include/messages/cucumber/messages/attachment.hpp index 3bfcbf0b..3e0cd97a 100644 --- a/cpp/include/messages/cucumber/messages/attachment.hpp +++ b/cpp/include/messages/cucumber/messages/attachment.hpp @@ -41,6 +41,7 @@ struct attachment std::optional test_case_started_id; std::optional test_step_id; std::optional url; + std::optional test_run_started_id; std::string to_string() const; diff --git a/cpp/include/messages/cucumber/messages/envelope.hpp b/cpp/include/messages/cucumber/messages/envelope.hpp index 0528621d..a6c3a236 100644 --- a/cpp/include/messages/cucumber/messages/envelope.hpp +++ b/cpp/include/messages/cucumber/messages/envelope.hpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include namespace cucumber::messages { @@ -59,6 +61,8 @@ struct envelope std::optional test_run_started; std::optional test_step_finished; std::optional test_step_started; + std::optional global_hook_started; + std::optional global_hook_finished; std::optional undefined_parameter_type; std::string to_string() const; diff --git a/cpp/include/messages/cucumber/messages/global_hook_finished.hpp b/cpp/include/messages/cucumber/messages/global_hook_finished.hpp new file mode 100644 index 00000000..b298d620 --- /dev/null +++ b/cpp/include/messages/cucumber/messages/global_hook_finished.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include +#include +#include + +#include + +#include +#include + +namespace cucumber::messages { + +using json = nlohmann::json; + +// +// Represents the GlobalHookFinished message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct global_hook_finished +{ + std::string test_run_started_id; + std::string hook_id; + cucumber::messages::test_step_result result; + cucumber::messages::timestamp timestamp; + + std::string to_string() const; + + void to_json(json& j) const; + std::string to_json() const; +}; + +std::ostream& +operator<<(std::ostream& os, const global_hook_finished& msg); + +void to_json(json& j, const global_hook_finished& m); + +} diff --git a/cpp/include/messages/cucumber/messages/global_hook_started.hpp b/cpp/include/messages/cucumber/messages/global_hook_started.hpp new file mode 100644 index 00000000..5442c80d --- /dev/null +++ b/cpp/include/messages/cucumber/messages/global_hook_started.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include +#include +#include + +#include + +#include + +namespace cucumber::messages { + +using json = nlohmann::json; + +// +// Represents the GlobalHookStarted message in Cucumber's message protocol +// @see Github - Cucumber - Messages +// +// Generated code + +struct global_hook_started +{ + std::string test_run_started_id; + std::string hook_id; + cucumber::messages::timestamp timestamp; + + std::string to_string() const; + + void to_json(json& j) const; + std::string to_json() const; +}; + +std::ostream& +operator<<(std::ostream& os, const global_hook_started& msg); + +void to_json(json& j, const global_hook_started& m); + +} diff --git a/cpp/include/messages/cucumber/messages/test_case.hpp b/cpp/include/messages/cucumber/messages/test_case.hpp index 146c0e6d..a5c726af 100644 --- a/cpp/include/messages/cucumber/messages/test_case.hpp +++ b/cpp/include/messages/cucumber/messages/test_case.hpp @@ -27,6 +27,7 @@ struct test_case std::string id; std::string pickle_id; std::vector test_steps; + std::optional test_run_started_id; std::string to_string() const; diff --git a/cpp/include/messages/cucumber/messages/test_run_finished.hpp b/cpp/include/messages/cucumber/messages/test_run_finished.hpp index d3213792..27cff76c 100644 --- a/cpp/include/messages/cucumber/messages/test_run_finished.hpp +++ b/cpp/include/messages/cucumber/messages/test_run_finished.hpp @@ -25,6 +25,7 @@ struct test_run_finished bool success; cucumber::messages::timestamp timestamp; std::optional exception; + std::optional test_run_started_id; std::string to_string() const; diff --git a/cpp/include/messages/cucumber/messages/test_run_started.hpp b/cpp/include/messages/cucumber/messages/test_run_started.hpp index 24f2fc62..bcf1a30d 100644 --- a/cpp/include/messages/cucumber/messages/test_run_started.hpp +++ b/cpp/include/messages/cucumber/messages/test_run_started.hpp @@ -21,6 +21,7 @@ using json = nlohmann::json; struct test_run_started { cucumber::messages::timestamp timestamp; + std::optional id; std::string to_string() const; diff --git a/cpp/src/lib/messages/cucumber/messages/attachment.cpp b/cpp/src/lib/messages/cucumber/messages/attachment.cpp index d4661e0c..ba133cdb 100644 --- a/cpp/src/lib/messages/cucumber/messages/attachment.cpp +++ b/cpp/src/lib/messages/cucumber/messages/attachment.cpp @@ -18,6 +18,7 @@ attachment::to_string() const cucumber::messages::to_string(oss, ", test_case_started_id=", test_case_started_id); cucumber::messages::to_string(oss, ", test_step_id=", test_step_id); cucumber::messages::to_string(oss, ", url=", url); + cucumber::messages::to_string(oss, ", test_run_started_id=", test_run_started_id); return oss.str(); } @@ -33,6 +34,7 @@ attachment::to_json(json& j) const cucumber::messages::to_json(j, camelize("test_case_started_id"), test_case_started_id); cucumber::messages::to_json(j, camelize("test_step_id"), test_step_id); cucumber::messages::to_json(j, camelize("url"), url); + cucumber::messages::to_json(j, camelize("test_run_started_id"), test_run_started_id); } std::string diff --git a/cpp/src/lib/messages/cucumber/messages/envelope.cpp b/cpp/src/lib/messages/cucumber/messages/envelope.cpp index 88e63702..6884c8a5 100644 --- a/cpp/src/lib/messages/cucumber/messages/envelope.cpp +++ b/cpp/src/lib/messages/cucumber/messages/envelope.cpp @@ -26,6 +26,8 @@ envelope::to_string() const cucumber::messages::to_string(oss, ", test_run_started=", test_run_started); cucumber::messages::to_string(oss, ", test_step_finished=", test_step_finished); cucumber::messages::to_string(oss, ", test_step_started=", test_step_started); + cucumber::messages::to_string(oss, ", global_hook_started=", global_hook_started); + cucumber::messages::to_string(oss, ", global_hook_finished=", global_hook_finished); cucumber::messages::to_string(oss, ", undefined_parameter_type=", undefined_parameter_type); return oss.str(); @@ -50,6 +52,8 @@ envelope::to_json(json& j) const cucumber::messages::to_json(j, camelize("test_run_started"), test_run_started); cucumber::messages::to_json(j, camelize("test_step_finished"), test_step_finished); cucumber::messages::to_json(j, camelize("test_step_started"), test_step_started); + cucumber::messages::to_json(j, camelize("global_hook_started"), global_hook_started); + cucumber::messages::to_json(j, camelize("global_hook_finished"), global_hook_finished); cucumber::messages::to_json(j, camelize("undefined_parameter_type"), undefined_parameter_type); } diff --git a/cpp/src/lib/messages/cucumber/messages/global_hook_finished.cpp b/cpp/src/lib/messages/cucumber/messages/global_hook_finished.cpp new file mode 100644 index 00000000..b7abbc43 --- /dev/null +++ b/cpp/src/lib/messages/cucumber/messages/global_hook_finished.cpp @@ -0,0 +1,54 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +global_hook_finished::to_string() const +{ + std::ostringstream oss; + + cucumber::messages::to_string(oss, "test_run_started_id=", test_run_started_id); + cucumber::messages::to_string(oss, ", hook_id=", hook_id); + cucumber::messages::to_string(oss, ", result=", result); + cucumber::messages::to_string(oss, ", timestamp=", timestamp); + + return oss.str(); +} + +void +global_hook_finished::to_json(json& j) const +{ + cucumber::messages::to_json(j, camelize("test_run_started_id"), test_run_started_id); + cucumber::messages::to_json(j, camelize("hook_id"), hook_id); + cucumber::messages::to_json(j, camelize("result"), result); + cucumber::messages::to_json(j, camelize("timestamp"), timestamp); +} + +std::string +global_hook_finished::to_json() const +{ + std::ostringstream oss; + json j; + + to_json(j); + + oss << j; + + return oss.str(); +} + +std::ostream& +operator<<(std::ostream& os, const global_hook_finished& msg) +{ + os << msg.to_string(); + + return os; +} + +void to_json(json& j, const global_hook_finished& m) +{ m.to_json(j); } + +} diff --git a/cpp/src/lib/messages/cucumber/messages/global_hook_started.cpp b/cpp/src/lib/messages/cucumber/messages/global_hook_started.cpp new file mode 100644 index 00000000..bdf3dac2 --- /dev/null +++ b/cpp/src/lib/messages/cucumber/messages/global_hook_started.cpp @@ -0,0 +1,52 @@ +#include + +#include +#include + +namespace cucumber::messages { + +std::string +global_hook_started::to_string() const +{ + std::ostringstream oss; + + cucumber::messages::to_string(oss, "test_run_started_id=", test_run_started_id); + cucumber::messages::to_string(oss, ", hook_id=", hook_id); + cucumber::messages::to_string(oss, ", timestamp=", timestamp); + + return oss.str(); +} + +void +global_hook_started::to_json(json& j) const +{ + cucumber::messages::to_json(j, camelize("test_run_started_id"), test_run_started_id); + cucumber::messages::to_json(j, camelize("hook_id"), hook_id); + cucumber::messages::to_json(j, camelize("timestamp"), timestamp); +} + +std::string +global_hook_started::to_json() const +{ + std::ostringstream oss; + json j; + + to_json(j); + + oss << j; + + return oss.str(); +} + +std::ostream& +operator<<(std::ostream& os, const global_hook_started& msg) +{ + os << msg.to_string(); + + return os; +} + +void to_json(json& j, const global_hook_started& m) +{ m.to_json(j); } + +} diff --git a/cpp/src/lib/messages/cucumber/messages/test_case.cpp b/cpp/src/lib/messages/cucumber/messages/test_case.cpp index 6a9070f3..c2af5362 100644 --- a/cpp/src/lib/messages/cucumber/messages/test_case.cpp +++ b/cpp/src/lib/messages/cucumber/messages/test_case.cpp @@ -13,6 +13,7 @@ test_case::to_string() const cucumber::messages::to_string(oss, "id=", id); cucumber::messages::to_string(oss, ", pickle_id=", pickle_id); cucumber::messages::to_string(oss, ", test_steps=", test_steps); + cucumber::messages::to_string(oss, ", test_run_started_id=", test_run_started_id); return oss.str(); } @@ -23,6 +24,7 @@ test_case::to_json(json& j) const cucumber::messages::to_json(j, camelize("id"), id); cucumber::messages::to_json(j, camelize("pickle_id"), pickle_id); cucumber::messages::to_json(j, camelize("test_steps"), test_steps); + cucumber::messages::to_json(j, camelize("test_run_started_id"), test_run_started_id); } std::string diff --git a/cpp/src/lib/messages/cucumber/messages/test_run_finished.cpp b/cpp/src/lib/messages/cucumber/messages/test_run_finished.cpp index f2c179e8..ce8ff84d 100644 --- a/cpp/src/lib/messages/cucumber/messages/test_run_finished.cpp +++ b/cpp/src/lib/messages/cucumber/messages/test_run_finished.cpp @@ -14,6 +14,7 @@ test_run_finished::to_string() const cucumber::messages::to_string(oss, ", success=", success); cucumber::messages::to_string(oss, ", timestamp=", timestamp); cucumber::messages::to_string(oss, ", exception=", exception); + cucumber::messages::to_string(oss, ", test_run_started_id=", test_run_started_id); return oss.str(); } @@ -25,6 +26,7 @@ test_run_finished::to_json(json& j) const cucumber::messages::to_json(j, camelize("success"), success); cucumber::messages::to_json(j, camelize("timestamp"), timestamp); cucumber::messages::to_json(j, camelize("exception"), exception); + cucumber::messages::to_json(j, camelize("test_run_started_id"), test_run_started_id); } std::string diff --git a/cpp/src/lib/messages/cucumber/messages/test_run_started.cpp b/cpp/src/lib/messages/cucumber/messages/test_run_started.cpp index 0ce5fdd9..5ef9a001 100644 --- a/cpp/src/lib/messages/cucumber/messages/test_run_started.cpp +++ b/cpp/src/lib/messages/cucumber/messages/test_run_started.cpp @@ -11,6 +11,7 @@ test_run_started::to_string() const std::ostringstream oss; cucumber::messages::to_string(oss, "timestamp=", timestamp); + cucumber::messages::to_string(oss, ", id=", id); return oss.str(); } @@ -19,6 +20,7 @@ void test_run_started::to_json(json& j) const { cucumber::messages::to_json(j, camelize("timestamp"), timestamp); + cucumber::messages::to_json(j, camelize("id"), id); } std::string diff --git a/dotnet/Cucumber.Messages/generated/Attachment.cs b/dotnet/Cucumber.Messages/generated/Attachment.cs index acb11b5d..c81d79be 100644 --- a/dotnet/Cucumber.Messages/generated/Attachment.cs +++ b/dotnet/Cucumber.Messages/generated/Attachment.cs @@ -73,6 +73,7 @@ public sealed class Attachment * separately from reports. */ public string Url { get; private set; } + public string TestRunStartedId { get; private set; } public Attachment( @@ -83,7 +84,8 @@ public Attachment( Source source, string testCaseStartedId, string testStepId, - string url + string url, + string testRunStartedId ) { RequireNonNull(body, "Body", "Attachment.Body cannot be null"); @@ -97,6 +99,7 @@ string url this.TestCaseStartedId = testCaseStartedId; this.TestStepId = testStepId; this.Url = url; + this.TestRunStartedId = testRunStartedId; } public override bool Equals(Object o) @@ -112,7 +115,8 @@ public override bool Equals(Object o) Object.Equals(Source, that.Source) && Object.Equals(TestCaseStartedId, that.TestCaseStartedId) && Object.Equals(TestStepId, that.TestStepId) && - Object.Equals(Url, that.Url); + Object.Equals(Url, that.Url) && + Object.Equals(TestRunStartedId, that.TestRunStartedId); } public override int GetHashCode() @@ -133,6 +137,8 @@ public override int GetHashCode() hash = hash * 31 + TestStepId.GetHashCode(); if (Url != null) hash = hash * 31 + Url.GetHashCode(); + if (TestRunStartedId != null) + hash = hash * 31 + TestRunStartedId.GetHashCode(); return hash; } @@ -147,6 +153,7 @@ public override string ToString() ", testCaseStartedId=" + TestCaseStartedId + ", testStepId=" + TestStepId + ", url=" + Url + + ", testRunStartedId=" + TestRunStartedId + '}'; } diff --git a/dotnet/Cucumber.Messages/generated/Envelope.cs b/dotnet/Cucumber.Messages/generated/Envelope.cs index 8c193a40..aabdcab4 100644 --- a/dotnet/Cucumber.Messages/generated/Envelope.cs +++ b/dotnet/Cucumber.Messages/generated/Envelope.cs @@ -39,6 +39,8 @@ public sealed class Envelope public TestRunStarted TestRunStarted { get; private set; } public TestStepFinished TestStepFinished { get; private set; } public TestStepStarted TestStepStarted { get; private set; } + public GlobalHookStarted GlobalHookStarted { get; private set; } + public GlobalHookFinished GlobalHookFinished { get; private set; } public UndefinedParameterType UndefinedParameterType { get; private set; } @@ -61,6 +63,8 @@ public static Envelope Create(Attachment attachment) null, null, null, + null, + null, null ); } @@ -84,6 +88,8 @@ public static Envelope Create(GherkinDocument gherkinDocument) null, null, null, + null, + null, null ); } @@ -107,6 +113,8 @@ public static Envelope Create(Hook hook) null, null, null, + null, + null, null ); } @@ -130,6 +138,8 @@ public static Envelope Create(Meta meta) null, null, null, + null, + null, null ); } @@ -153,6 +163,8 @@ public static Envelope Create(ParameterType parameterType) null, null, null, + null, + null, null ); } @@ -176,6 +188,8 @@ public static Envelope Create(ParseError parseError) null, null, null, + null, + null, null ); } @@ -199,6 +213,8 @@ public static Envelope Create(Pickle pickle) null, null, null, + null, + null, null ); } @@ -222,6 +238,8 @@ public static Envelope Create(Source source) null, null, null, + null, + null, null ); } @@ -245,6 +263,8 @@ public static Envelope Create(StepDefinition stepDefinition) null, null, null, + null, + null, null ); } @@ -268,6 +288,8 @@ public static Envelope Create(TestCase testCase) null, null, null, + null, + null, null ); } @@ -291,6 +313,8 @@ public static Envelope Create(TestCaseFinished testCaseFinished) null, null, null, + null, + null, null ); } @@ -314,6 +338,8 @@ public static Envelope Create(TestCaseStarted testCaseStarted) null, null, null, + null, + null, null ); } @@ -337,6 +363,8 @@ public static Envelope Create(TestRunFinished testRunFinished) null, null, null, + null, + null, null ); } @@ -360,6 +388,8 @@ public static Envelope Create(TestRunStarted testRunStarted) Require(testRunStarted, "TestRunStarted", "Envelope.TestRunStarted cannot be null"), null, null, + null, + null, null ); } @@ -383,6 +413,8 @@ public static Envelope Create(TestStepFinished testStepFinished) null, Require(testStepFinished, "TestStepFinished", "Envelope.TestStepFinished cannot be null"), null, + null, + null, null ); } @@ -406,6 +438,58 @@ public static Envelope Create(TestStepStarted testStepStarted) null, null, Require(testStepStarted, "TestStepStarted", "Envelope.TestStepStarted cannot be null"), + null, + null, + null + ); + } + + public static Envelope Create(GlobalHookStarted globalHookStarted) + { + return new Envelope( + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + Require(globalHookStarted, "GlobalHookStarted", "Envelope.GlobalHookStarted cannot be null"), + null, + null + ); + } + + public static Envelope Create(GlobalHookFinished globalHookFinished) + { + return new Envelope( + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + Require(globalHookFinished, "GlobalHookFinished", "Envelope.GlobalHookFinished cannot be null"), null ); } @@ -429,6 +513,8 @@ public static Envelope Create(UndefinedParameterType undefinedParameterType) null, null, null, + null, + null, Require(undefinedParameterType, "UndefinedParameterType", "Envelope.UndefinedParameterType cannot be null") ); } @@ -450,6 +536,8 @@ public Envelope( TestRunStarted testRunStarted, TestStepFinished testStepFinished, TestStepStarted testStepStarted, + GlobalHookStarted globalHookStarted, + GlobalHookFinished globalHookFinished, UndefinedParameterType undefinedParameterType ) { @@ -469,6 +557,8 @@ UndefinedParameterType undefinedParameterType this.TestRunStarted = testRunStarted; this.TestStepFinished = testStepFinished; this.TestStepStarted = testStepStarted; + this.GlobalHookStarted = globalHookStarted; + this.GlobalHookFinished = globalHookFinished; this.UndefinedParameterType = undefinedParameterType; } @@ -494,6 +584,8 @@ public override bool Equals(Object o) Object.Equals(TestRunStarted, that.TestRunStarted) && Object.Equals(TestStepFinished, that.TestStepFinished) && Object.Equals(TestStepStarted, that.TestStepStarted) && + Object.Equals(GlobalHookStarted, that.GlobalHookStarted) && + Object.Equals(GlobalHookFinished, that.GlobalHookFinished) && Object.Equals(UndefinedParameterType, that.UndefinedParameterType); } @@ -532,6 +624,10 @@ public override int GetHashCode() hash = hash * 31 + TestStepFinished.GetHashCode(); if (TestStepStarted != null) hash = hash * 31 + TestStepStarted.GetHashCode(); + if (GlobalHookStarted != null) + hash = hash * 31 + GlobalHookStarted.GetHashCode(); + if (GlobalHookFinished != null) + hash = hash * 31 + GlobalHookFinished.GetHashCode(); if (UndefinedParameterType != null) hash = hash * 31 + UndefinedParameterType.GetHashCode(); return hash; @@ -556,6 +652,8 @@ public override string ToString() ", testRunStarted=" + TestRunStarted + ", testStepFinished=" + TestStepFinished + ", testStepStarted=" + TestStepStarted + + ", globalHookStarted=" + GlobalHookStarted + + ", globalHookFinished=" + GlobalHookFinished + ", undefinedParameterType=" + UndefinedParameterType + '}'; } diff --git a/dotnet/Cucumber.Messages/generated/GlobalHookFinished.cs b/dotnet/Cucumber.Messages/generated/GlobalHookFinished.cs new file mode 100644 index 00000000..f4433604 --- /dev/null +++ b/dotnet/Cucumber.Messages/generated/GlobalHookFinished.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; + +// ------------------------------------------------------------------------------ +// This code was generated based on the Cucumber JSON schema +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// ------------------------------------------------------------------------------ + +namespace Io.Cucumber.Messages.Types; + +/** + * Represents the GlobalHookFinished message in Cucumber's message protocol + * @see Github - Cucumber - Messages + */ + +public sealed class GlobalHookFinished +{ + /** + * Identifier for the test run that this hook execution belongs to + */ + public string TestRunStartedId { get; private set; } + /** + * Identifier for the hook that was executed + */ + public string HookId { get; private set; } + public TestStepResult Result { get; private set; } + public Timestamp Timestamp { get; private set; } + + + public GlobalHookFinished( + string testRunStartedId, + string hookId, + TestStepResult result, + Timestamp timestamp + ) + { + RequireNonNull(testRunStartedId, "TestRunStartedId", "GlobalHookFinished.TestRunStartedId cannot be null"); + this.TestRunStartedId = testRunStartedId; + RequireNonNull(hookId, "HookId", "GlobalHookFinished.HookId cannot be null"); + this.HookId = hookId; + RequireNonNull(result, "Result", "GlobalHookFinished.Result cannot be null"); + this.Result = result; + RequireNonNull(timestamp, "Timestamp", "GlobalHookFinished.Timestamp cannot be null"); + this.Timestamp = timestamp; + } + + public override bool Equals(Object o) + { + if (this == o) return true; + if (o == null || this.GetType() != o.GetType()) return false; + GlobalHookFinished that = (GlobalHookFinished) o; + return + TestRunStartedId.Equals(that.TestRunStartedId) && + HookId.Equals(that.HookId) && + Result.Equals(that.Result) && + Timestamp.Equals(that.Timestamp); + } + + public override int GetHashCode() + { + int hash = 17; + if (TestRunStartedId != null) + hash = hash * 31 + TestRunStartedId.GetHashCode(); + if (HookId != null) + hash = hash * 31 + HookId.GetHashCode(); + if (Result != null) + hash = hash * 31 + Result.GetHashCode(); + if (Timestamp != null) + hash = hash * 31 + Timestamp.GetHashCode(); + return hash; + } + + public override string ToString() + { + return "GlobalHookFinished{" + + "testRunStartedId=" + TestRunStartedId + + ", hookId=" + HookId + + ", result=" + Result + + ", timestamp=" + Timestamp + + '}'; + } + + private static T Require(T property, string propertyName, string errorMessage) + { + RequireNonNull(property, propertyName, errorMessage); + return property; + } + private static void RequireNonNull(T property, string propertyName, string errorMessage) + { + if (property == null) throw new ArgumentNullException(propertyName, errorMessage); + } +} diff --git a/dotnet/Cucumber.Messages/generated/GlobalHookStarted.cs b/dotnet/Cucumber.Messages/generated/GlobalHookStarted.cs new file mode 100644 index 00000000..0e5cca1b --- /dev/null +++ b/dotnet/Cucumber.Messages/generated/GlobalHookStarted.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; + +// ------------------------------------------------------------------------------ +// This code was generated based on the Cucumber JSON schema +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// ------------------------------------------------------------------------------ + +namespace Io.Cucumber.Messages.Types; + +/** + * Represents the GlobalHookStarted message in Cucumber's message protocol + * @see Github - Cucumber - Messages + */ + +public sealed class GlobalHookStarted +{ + /** + * Identifier for the test run that this hook execution belongs to + */ + public string TestRunStartedId { get; private set; } + /** + * Identifier for the hook that will be executed + */ + public string HookId { get; private set; } + public Timestamp Timestamp { get; private set; } + + + public GlobalHookStarted( + string testRunStartedId, + string hookId, + Timestamp timestamp + ) + { + RequireNonNull(testRunStartedId, "TestRunStartedId", "GlobalHookStarted.TestRunStartedId cannot be null"); + this.TestRunStartedId = testRunStartedId; + RequireNonNull(hookId, "HookId", "GlobalHookStarted.HookId cannot be null"); + this.HookId = hookId; + RequireNonNull(timestamp, "Timestamp", "GlobalHookStarted.Timestamp cannot be null"); + this.Timestamp = timestamp; + } + + public override bool Equals(Object o) + { + if (this == o) return true; + if (o == null || this.GetType() != o.GetType()) return false; + GlobalHookStarted that = (GlobalHookStarted) o; + return + TestRunStartedId.Equals(that.TestRunStartedId) && + HookId.Equals(that.HookId) && + Timestamp.Equals(that.Timestamp); + } + + public override int GetHashCode() + { + int hash = 17; + if (TestRunStartedId != null) + hash = hash * 31 + TestRunStartedId.GetHashCode(); + if (HookId != null) + hash = hash * 31 + HookId.GetHashCode(); + if (Timestamp != null) + hash = hash * 31 + Timestamp.GetHashCode(); + return hash; + } + + public override string ToString() + { + return "GlobalHookStarted{" + + "testRunStartedId=" + TestRunStartedId + + ", hookId=" + HookId + + ", timestamp=" + Timestamp + + '}'; + } + + private static T Require(T property, string propertyName, string errorMessage) + { + RequireNonNull(property, propertyName, errorMessage); + return property; + } + private static void RequireNonNull(T property, string propertyName, string errorMessage) + { + if (property == null) throw new ArgumentNullException(propertyName, errorMessage); + } +} diff --git a/dotnet/Cucumber.Messages/generated/TestCase.cs b/dotnet/Cucumber.Messages/generated/TestCase.cs index 440457b8..1394061d 100644 --- a/dotnet/Cucumber.Messages/generated/TestCase.cs +++ b/dotnet/Cucumber.Messages/generated/TestCase.cs @@ -26,12 +26,17 @@ public sealed class TestCase */ public string PickleId { get; private set; } public List TestSteps { get; private set; } + /** + * Identifier for the test run that this case belongs to + */ + public string TestRunStartedId { get; private set; } public TestCase( string id, string pickleId, - List testSteps + List testSteps, + string testRunStartedId ) { RequireNonNull(id, "Id", "TestCase.Id cannot be null"); @@ -40,6 +45,7 @@ List testSteps this.PickleId = pickleId; RequireNonNull>(testSteps, "TestSteps", "TestCase.TestSteps cannot be null"); this.TestSteps = new List(testSteps); + this.TestRunStartedId = testRunStartedId; } public override bool Equals(Object o) @@ -50,7 +56,8 @@ public override bool Equals(Object o) return Id.Equals(that.Id) && PickleId.Equals(that.PickleId) && - TestSteps.Equals(that.TestSteps); + TestSteps.Equals(that.TestSteps) && + Object.Equals(TestRunStartedId, that.TestRunStartedId); } public override int GetHashCode() @@ -62,6 +69,8 @@ public override int GetHashCode() hash = hash * 31 + PickleId.GetHashCode(); if (TestSteps != null) hash = hash * 31 + TestSteps.GetHashCode(); + if (TestRunStartedId != null) + hash = hash * 31 + TestRunStartedId.GetHashCode(); return hash; } @@ -71,6 +80,7 @@ public override string ToString() "id=" + Id + ", pickleId=" + PickleId + ", testSteps=" + TestSteps + + ", testRunStartedId=" + TestRunStartedId + '}'; } diff --git a/dotnet/Cucumber.Messages/generated/TestRunFinished.cs b/dotnet/Cucumber.Messages/generated/TestRunFinished.cs index f5d56804..83a9f40e 100644 --- a/dotnet/Cucumber.Messages/generated/TestRunFinished.cs +++ b/dotnet/Cucumber.Messages/generated/TestRunFinished.cs @@ -32,13 +32,15 @@ public sealed class TestRunFinished * Any exception thrown during the test run, if any. Does not include exceptions thrown while executing steps. */ public Exception Exception { get; private set; } + public string TestRunStartedId { get; private set; } public TestRunFinished( string message, bool success, Timestamp timestamp, - Exception exception + Exception exception, + string testRunStartedId ) { this.Message = message; @@ -47,6 +49,7 @@ Exception exception RequireNonNull(timestamp, "Timestamp", "TestRunFinished.Timestamp cannot be null"); this.Timestamp = timestamp; this.Exception = exception; + this.TestRunStartedId = testRunStartedId; } public override bool Equals(Object o) @@ -58,7 +61,8 @@ public override bool Equals(Object o) Object.Equals(Message, that.Message) && Success.Equals(that.Success) && Timestamp.Equals(that.Timestamp) && - Object.Equals(Exception, that.Exception); + Object.Equals(Exception, that.Exception) && + Object.Equals(TestRunStartedId, that.TestRunStartedId); } public override int GetHashCode() @@ -71,6 +75,8 @@ public override int GetHashCode() hash = hash * 31 + Timestamp.GetHashCode(); if (Exception != null) hash = hash * 31 + Exception.GetHashCode(); + if (TestRunStartedId != null) + hash = hash * 31 + TestRunStartedId.GetHashCode(); return hash; } @@ -81,6 +87,7 @@ public override string ToString() ", success=" + Success + ", timestamp=" + Timestamp + ", exception=" + Exception + + ", testRunStartedId=" + TestRunStartedId + '}'; } diff --git a/dotnet/Cucumber.Messages/generated/TestRunStarted.cs b/dotnet/Cucumber.Messages/generated/TestRunStarted.cs index 4cf6ac69..c415a075 100644 --- a/dotnet/Cucumber.Messages/generated/TestRunStarted.cs +++ b/dotnet/Cucumber.Messages/generated/TestRunStarted.cs @@ -17,14 +17,17 @@ namespace Io.Cucumber.Messages.Types; public sealed class TestRunStarted { public Timestamp Timestamp { get; private set; } + public string Id { get; private set; } public TestRunStarted( - Timestamp timestamp + Timestamp timestamp, + string id ) { RequireNonNull(timestamp, "Timestamp", "TestRunStarted.Timestamp cannot be null"); this.Timestamp = timestamp; + this.Id = id; } public override bool Equals(Object o) @@ -33,7 +36,8 @@ public override bool Equals(Object o) if (o == null || this.GetType() != o.GetType()) return false; TestRunStarted that = (TestRunStarted) o; return - Timestamp.Equals(that.Timestamp); + Timestamp.Equals(that.Timestamp) && + Object.Equals(Id, that.Id); } public override int GetHashCode() @@ -41,6 +45,8 @@ public override int GetHashCode() int hash = 17; if (Timestamp != null) hash = hash * 31 + Timestamp.GetHashCode(); + if (Id != null) + hash = hash * 31 + Id.GetHashCode(); return hash; } @@ -48,6 +54,7 @@ public override string ToString() { return "TestRunStarted{" + "timestamp=" + Timestamp + + ", id=" + Id + '}'; } diff --git a/go/messages.go b/go/messages.go index e7dc6169..3e9270e3 100644 --- a/go/messages.go +++ b/go/messages.go @@ -9,6 +9,7 @@ type Attachment struct { TestCaseStartedId string `json:"testCaseStartedId,omitempty"` TestStepId string `json:"testStepId,omitempty"` Url string `json:"url,omitempty"` + TestRunStartedId string `json:"testRunStartedId,omitempty"` } type Duration struct { @@ -33,6 +34,8 @@ type Envelope struct { TestRunStarted *TestRunStarted `json:"testRunStarted,omitempty"` TestStepFinished *TestStepFinished `json:"testStepFinished,omitempty"` TestStepStarted *TestStepStarted `json:"testStepStarted,omitempty"` + GlobalHookStarted *GlobalHookStarted `json:"globalHookStarted,omitempty"` + GlobalHookFinished *GlobalHookFinished `json:"globalHookFinished,omitempty"` UndefinedParameterType *UndefinedParameterType `json:"undefinedParameterType,omitempty"` } @@ -154,6 +157,19 @@ type Tag struct { Id string `json:"id"` } +type GlobalHookFinished struct { + TestRunStartedId string `json:"testRunStartedId"` + HookId string `json:"hookId"` + Result *TestStepResult `json:"result"` + Timestamp *Timestamp `json:"timestamp"` +} + +type GlobalHookStarted struct { + TestRunStartedId string `json:"testRunStartedId"` + HookId string `json:"hookId"` + Timestamp *Timestamp `json:"timestamp"` +} + type Hook struct { Id string `json:"id"` Name string `json:"name,omitempty"` @@ -290,9 +306,10 @@ type StepDefinitionPattern struct { } type TestCase struct { - Id string `json:"id"` - PickleId string `json:"pickleId"` - TestSteps []*TestStep `json:"testSteps"` + Id string `json:"id"` + PickleId string `json:"pickleId"` + TestSteps []*TestStep `json:"testSteps"` + TestRunStartedId string `json:"testRunStartedId,omitempty"` } type Group struct { @@ -333,14 +350,16 @@ type TestCaseStarted struct { } type TestRunFinished struct { - Message string `json:"message,omitempty"` - Success bool `json:"success"` - Timestamp *Timestamp `json:"timestamp"` - Exception *Exception `json:"exception,omitempty"` + Message string `json:"message,omitempty"` + Success bool `json:"success"` + Timestamp *Timestamp `json:"timestamp"` + Exception *Exception `json:"exception,omitempty"` + TestRunStartedId string `json:"testRunStartedId,omitempty"` } type TestRunStarted struct { Timestamp *Timestamp `json:"timestamp"` + Id string `json:"id,omitempty"` } type TestStepFinished struct { diff --git a/java/src/generated/java/io/cucumber/messages/types/Attachment.java b/java/src/generated/java/io/cucumber/messages/types/Attachment.java index 91e3fe25..3bf3401e 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Attachment.java +++ b/java/src/generated/java/io/cucumber/messages/types/Attachment.java @@ -34,6 +34,7 @@ public final class Attachment { private final String testCaseStartedId; private final String testStepId; private final String url; + private final String testRunStartedId; public Attachment( String body, @@ -43,7 +44,8 @@ public Attachment( Source source, String testCaseStartedId, String testStepId, - String url + String url, + String testRunStartedId ) { this.body = requireNonNull(body, "Attachment.body cannot be null"); this.contentEncoding = requireNonNull(contentEncoding, "Attachment.contentEncoding cannot be null"); @@ -53,6 +55,7 @@ public Attachment( this.testCaseStartedId = testCaseStartedId; this.testStepId = testStepId; this.url = url; + this.testRunStartedId = testRunStartedId; } /** @@ -124,6 +127,10 @@ public Optional getUrl() { return Optional.ofNullable(url); } + public Optional getTestRunStartedId() { + return Optional.ofNullable(testRunStartedId); + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -137,7 +144,8 @@ public boolean equals(Object o) { Objects.equals(source, that.source) && Objects.equals(testCaseStartedId, that.testCaseStartedId) && Objects.equals(testStepId, that.testStepId) && - Objects.equals(url, that.url); + Objects.equals(url, that.url) && + Objects.equals(testRunStartedId, that.testRunStartedId); } @Override @@ -150,7 +158,8 @@ public int hashCode() { source, testCaseStartedId, testStepId, - url + url, + testRunStartedId ); } @@ -165,6 +174,7 @@ public String toString() { ", testCaseStartedId=" + testCaseStartedId + ", testStepId=" + testStepId + ", url=" + url + + ", testRunStartedId=" + testRunStartedId + '}'; } } diff --git a/java/src/generated/java/io/cucumber/messages/types/Envelope.java b/java/src/generated/java/io/cucumber/messages/types/Envelope.java index 9b764ba9..c2079898 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Envelope.java +++ b/java/src/generated/java/io/cucumber/messages/types/Envelope.java @@ -37,6 +37,8 @@ public final class Envelope { private final TestRunStarted testRunStarted; private final TestStepFinished testStepFinished; private final TestStepStarted testStepStarted; + private final GlobalHookStarted globalHookStarted; + private final GlobalHookFinished globalHookFinished; private final UndefinedParameterType undefinedParameterType; public static Envelope of(Attachment attachment) { @@ -57,6 +59,8 @@ public static Envelope of(Attachment attachment) { null, null, null, + null, + null, null ); } @@ -79,6 +83,8 @@ public static Envelope of(GherkinDocument gherkinDocument) { null, null, null, + null, + null, null ); } @@ -101,6 +107,8 @@ public static Envelope of(Hook hook) { null, null, null, + null, + null, null ); } @@ -123,6 +131,8 @@ public static Envelope of(Meta meta) { null, null, null, + null, + null, null ); } @@ -145,6 +155,8 @@ public static Envelope of(ParameterType parameterType) { null, null, null, + null, + null, null ); } @@ -167,6 +179,8 @@ public static Envelope of(ParseError parseError) { null, null, null, + null, + null, null ); } @@ -189,6 +203,8 @@ public static Envelope of(Pickle pickle) { null, null, null, + null, + null, null ); } @@ -211,6 +227,8 @@ public static Envelope of(Source source) { null, null, null, + null, + null, null ); } @@ -233,6 +251,8 @@ public static Envelope of(StepDefinition stepDefinition) { null, null, null, + null, + null, null ); } @@ -255,6 +275,8 @@ public static Envelope of(TestCase testCase) { null, null, null, + null, + null, null ); } @@ -277,6 +299,8 @@ public static Envelope of(TestCaseFinished testCaseFinished) { null, null, null, + null, + null, null ); } @@ -299,6 +323,8 @@ public static Envelope of(TestCaseStarted testCaseStarted) { null, null, null, + null, + null, null ); } @@ -321,6 +347,8 @@ public static Envelope of(TestRunFinished testRunFinished) { null, null, null, + null, + null, null ); } @@ -343,6 +371,8 @@ public static Envelope of(TestRunStarted testRunStarted) { requireNonNull(testRunStarted, "Envelope.testRunStarted cannot be null"), null, null, + null, + null, null ); } @@ -365,6 +395,8 @@ public static Envelope of(TestStepFinished testStepFinished) { null, requireNonNull(testStepFinished, "Envelope.testStepFinished cannot be null"), null, + null, + null, null ); } @@ -387,6 +419,56 @@ public static Envelope of(TestStepStarted testStepStarted) { null, null, requireNonNull(testStepStarted, "Envelope.testStepStarted cannot be null"), + null, + null, + null + ); + } + + public static Envelope of(GlobalHookStarted globalHookStarted) { + return new Envelope( + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + requireNonNull(globalHookStarted, "Envelope.globalHookStarted cannot be null"), + null, + null + ); + } + + public static Envelope of(GlobalHookFinished globalHookFinished) { + return new Envelope( + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + requireNonNull(globalHookFinished, "Envelope.globalHookFinished cannot be null"), null ); } @@ -409,6 +491,8 @@ public static Envelope of(UndefinedParameterType undefinedParameterType) { null, null, null, + null, + null, requireNonNull(undefinedParameterType, "Envelope.undefinedParameterType cannot be null") ); } @@ -430,6 +514,8 @@ public Envelope( TestRunStarted testRunStarted, TestStepFinished testStepFinished, TestStepStarted testStepStarted, + GlobalHookStarted globalHookStarted, + GlobalHookFinished globalHookFinished, UndefinedParameterType undefinedParameterType ) { this.attachment = attachment; @@ -448,6 +534,8 @@ public Envelope( this.testRunStarted = testRunStarted; this.testStepFinished = testStepFinished; this.testStepStarted = testStepStarted; + this.globalHookStarted = globalHookStarted; + this.globalHookFinished = globalHookFinished; this.undefinedParameterType = undefinedParameterType; } @@ -515,6 +603,14 @@ public Optional getTestStepStarted() { return Optional.ofNullable(testStepStarted); } + public Optional getGlobalHookStarted() { + return Optional.ofNullable(globalHookStarted); + } + + public Optional getGlobalHookFinished() { + return Optional.ofNullable(globalHookFinished); + } + public Optional getUndefinedParameterType() { return Optional.ofNullable(undefinedParameterType); } @@ -541,6 +637,8 @@ public boolean equals(Object o) { Objects.equals(testRunStarted, that.testRunStarted) && Objects.equals(testStepFinished, that.testStepFinished) && Objects.equals(testStepStarted, that.testStepStarted) && + Objects.equals(globalHookStarted, that.globalHookStarted) && + Objects.equals(globalHookFinished, that.globalHookFinished) && Objects.equals(undefinedParameterType, that.undefinedParameterType); } @@ -563,6 +661,8 @@ public int hashCode() { testRunStarted, testStepFinished, testStepStarted, + globalHookStarted, + globalHookFinished, undefinedParameterType ); } @@ -586,6 +686,8 @@ public String toString() { ", testRunStarted=" + testRunStarted + ", testStepFinished=" + testStepFinished + ", testStepStarted=" + testStepStarted + + ", globalHookStarted=" + globalHookStarted + + ", globalHookFinished=" + globalHookFinished + ", undefinedParameterType=" + undefinedParameterType + '}'; } diff --git a/java/src/generated/java/io/cucumber/messages/types/GlobalHookFinished.java b/java/src/generated/java/io/cucumber/messages/types/GlobalHookFinished.java new file mode 100644 index 00000000..145e0d3a --- /dev/null +++ b/java/src/generated/java/io/cucumber/messages/types/GlobalHookFinished.java @@ -0,0 +1,87 @@ +package io.cucumber.messages.types; + +import java.util.ArrayList; +import java.util.Objects; +import java.util.Optional; + +import static java.util.Collections.unmodifiableList; +import static java.util.Objects.requireNonNull; + +/** + * Represents the GlobalHookFinished message in Cucumber's message protocol + * @see Github - Cucumber - Messages + */ +// Generated code +@SuppressWarnings("unused") +public final class GlobalHookFinished { + private final String testRunStartedId; + private final String hookId; + private final TestStepResult result; + private final Timestamp timestamp; + + public GlobalHookFinished( + String testRunStartedId, + String hookId, + TestStepResult result, + Timestamp timestamp + ) { + this.testRunStartedId = requireNonNull(testRunStartedId, "GlobalHookFinished.testRunStartedId cannot be null"); + this.hookId = requireNonNull(hookId, "GlobalHookFinished.hookId cannot be null"); + this.result = requireNonNull(result, "GlobalHookFinished.result cannot be null"); + this.timestamp = requireNonNull(timestamp, "GlobalHookFinished.timestamp cannot be null"); + } + + /** + * Identifier for the test run that this hook execution belongs to + */ + public String getTestRunStartedId() { + return testRunStartedId; + } + + /** + * Identifier for the hook that was executed + */ + public String getHookId() { + return hookId; + } + + public TestStepResult getResult() { + return result; + } + + public Timestamp getTimestamp() { + return timestamp; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + GlobalHookFinished that = (GlobalHookFinished) o; + return + testRunStartedId.equals(that.testRunStartedId) && + hookId.equals(that.hookId) && + result.equals(that.result) && + timestamp.equals(that.timestamp); + } + + @Override + public int hashCode() { + return Objects.hash( + testRunStartedId, + hookId, + result, + timestamp + ); + } + + @Override + public String toString() { + return "GlobalHookFinished{" + + "testRunStartedId=" + testRunStartedId + + ", hookId=" + hookId + + ", result=" + result + + ", timestamp=" + timestamp + + '}'; + } +} diff --git a/java/src/generated/java/io/cucumber/messages/types/GlobalHookStarted.java b/java/src/generated/java/io/cucumber/messages/types/GlobalHookStarted.java new file mode 100644 index 00000000..cbf73810 --- /dev/null +++ b/java/src/generated/java/io/cucumber/messages/types/GlobalHookStarted.java @@ -0,0 +1,77 @@ +package io.cucumber.messages.types; + +import java.util.ArrayList; +import java.util.Objects; +import java.util.Optional; + +import static java.util.Collections.unmodifiableList; +import static java.util.Objects.requireNonNull; + +/** + * Represents the GlobalHookStarted message in Cucumber's message protocol + * @see Github - Cucumber - Messages + */ +// Generated code +@SuppressWarnings("unused") +public final class GlobalHookStarted { + private final String testRunStartedId; + private final String hookId; + private final Timestamp timestamp; + + public GlobalHookStarted( + String testRunStartedId, + String hookId, + Timestamp timestamp + ) { + this.testRunStartedId = requireNonNull(testRunStartedId, "GlobalHookStarted.testRunStartedId cannot be null"); + this.hookId = requireNonNull(hookId, "GlobalHookStarted.hookId cannot be null"); + this.timestamp = requireNonNull(timestamp, "GlobalHookStarted.timestamp cannot be null"); + } + + /** + * Identifier for the test run that this hook execution belongs to + */ + public String getTestRunStartedId() { + return testRunStartedId; + } + + /** + * Identifier for the hook that will be executed + */ + public String getHookId() { + return hookId; + } + + public Timestamp getTimestamp() { + return timestamp; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + GlobalHookStarted that = (GlobalHookStarted) o; + return + testRunStartedId.equals(that.testRunStartedId) && + hookId.equals(that.hookId) && + timestamp.equals(that.timestamp); + } + + @Override + public int hashCode() { + return Objects.hash( + testRunStartedId, + hookId, + timestamp + ); + } + + @Override + public String toString() { + return "GlobalHookStarted{" + + "testRunStartedId=" + testRunStartedId + + ", hookId=" + hookId + + ", timestamp=" + timestamp + + '}'; + } +} diff --git a/java/src/generated/java/io/cucumber/messages/types/TestCase.java b/java/src/generated/java/io/cucumber/messages/types/TestCase.java index b7f99366..3cd74e3e 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCase.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCase.java @@ -21,15 +21,18 @@ public final class TestCase { private final String id; private final String pickleId; private final java.util.List testSteps; + private final String testRunStartedId; public TestCase( String id, String pickleId, - java.util.List testSteps + java.util.List testSteps, + String testRunStartedId ) { this.id = requireNonNull(id, "TestCase.id cannot be null"); this.pickleId = requireNonNull(pickleId, "TestCase.pickleId cannot be null"); this.testSteps = unmodifiableList(new ArrayList<>(requireNonNull(testSteps, "TestCase.testSteps cannot be null"))); + this.testRunStartedId = testRunStartedId; } public String getId() { @@ -47,6 +50,13 @@ public java.util.List getTestSteps() { return testSteps; } + /** + * Identifier for the test run that this case belongs to + */ + public Optional getTestRunStartedId() { + return Optional.ofNullable(testRunStartedId); + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -55,7 +65,8 @@ public boolean equals(Object o) { return id.equals(that.id) && pickleId.equals(that.pickleId) && - testSteps.equals(that.testSteps); + testSteps.equals(that.testSteps) && + Objects.equals(testRunStartedId, that.testRunStartedId); } @Override @@ -63,7 +74,8 @@ public int hashCode() { return Objects.hash( id, pickleId, - testSteps + testSteps, + testRunStartedId ); } @@ -73,6 +85,7 @@ public String toString() { "id=" + id + ", pickleId=" + pickleId + ", testSteps=" + testSteps + + ", testRunStartedId=" + testRunStartedId + '}'; } } diff --git a/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java b/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java index 845c0f97..562ec42d 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java @@ -18,17 +18,20 @@ public final class TestRunFinished { private final Boolean success; private final Timestamp timestamp; private final Exception exception; + private final String testRunStartedId; public TestRunFinished( String message, Boolean success, Timestamp timestamp, - Exception exception + Exception exception, + String testRunStartedId ) { this.message = message; this.success = requireNonNull(success, "TestRunFinished.success cannot be null"); this.timestamp = requireNonNull(timestamp, "TestRunFinished.timestamp cannot be null"); this.exception = exception; + this.testRunStartedId = testRunStartedId; } /** @@ -59,6 +62,10 @@ public Optional getException() { return Optional.ofNullable(exception); } + public Optional getTestRunStartedId() { + return Optional.ofNullable(testRunStartedId); + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -68,7 +75,8 @@ public boolean equals(Object o) { Objects.equals(message, that.message) && success.equals(that.success) && timestamp.equals(that.timestamp) && - Objects.equals(exception, that.exception); + Objects.equals(exception, that.exception) && + Objects.equals(testRunStartedId, that.testRunStartedId); } @Override @@ -77,7 +85,8 @@ public int hashCode() { message, success, timestamp, - exception + exception, + testRunStartedId ); } @@ -88,6 +97,7 @@ public String toString() { ", success=" + success + ", timestamp=" + timestamp + ", exception=" + exception + + ", testRunStartedId=" + testRunStartedId + '}'; } } diff --git a/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java b/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java index 94be6c1a..bcf2f3a5 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java @@ -15,30 +15,39 @@ @SuppressWarnings("unused") public final class TestRunStarted { private final Timestamp timestamp; + private final String id; public TestRunStarted( - Timestamp timestamp + Timestamp timestamp, + String id ) { this.timestamp = requireNonNull(timestamp, "TestRunStarted.timestamp cannot be null"); + this.id = id; } public Timestamp getTimestamp() { return timestamp; } + public Optional getId() { + return Optional.ofNullable(id); + } + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TestRunStarted that = (TestRunStarted) o; return - timestamp.equals(that.timestamp); + timestamp.equals(that.timestamp) && + Objects.equals(id, that.id); } @Override public int hashCode() { return Objects.hash( - timestamp + timestamp, + id ); } @@ -46,6 +55,7 @@ public int hashCode() { public String toString() { return "TestRunStarted{" + "timestamp=" + timestamp + + ", id=" + id + '}'; } } diff --git a/javascript/src/messages.ts b/javascript/src/messages.ts index ceec6923..f61b5965 100644 --- a/javascript/src/messages.ts +++ b/javascript/src/messages.ts @@ -19,6 +19,8 @@ export class Attachment { testStepId?: string url?: string + + testRunStartedId?: string } export class Duration { @@ -78,6 +80,12 @@ export class Envelope { @Type(() => TestStepStarted) testStepStarted?: TestStepStarted + @Type(() => GlobalHookStarted) + globalHookStarted?: GlobalHookStarted + + @Type(() => GlobalHookFinished) + globalHookFinished?: GlobalHookFinished + @Type(() => UndefinedParameterType) undefinedParameterType?: UndefinedParameterType } @@ -304,6 +312,29 @@ export class Tag { id: string = '' } +export class GlobalHookFinished { + + testRunStartedId: string = '' + + hookId: string = '' + + @Type(() => TestStepResult) + result: TestStepResult = new TestStepResult() + + @Type(() => Timestamp) + timestamp: Timestamp = new Timestamp() +} + +export class GlobalHookStarted { + + testRunStartedId: string = '' + + hookId: string = '' + + @Type(() => Timestamp) + timestamp: Timestamp = new Timestamp() +} + export class Hook { id: string = '' @@ -537,6 +568,8 @@ export class TestCase { @Type(() => TestStep) testSteps: readonly TestStep[] = [] + + testRunStartedId?: string } export class Group { @@ -612,12 +645,16 @@ export class TestRunFinished { @Type(() => Exception) exception?: Exception + + testRunStartedId?: string } export class TestRunStarted { @Type(() => Timestamp) timestamp: Timestamp = new Timestamp() + + id?: string } export class TestStepFinished { diff --git a/messages.md b/messages.md index 8183c829..fad71a2e 100644 --- a/messages.md +++ b/messages.md @@ -15,6 +15,7 @@ will only have one of its fields set, which indicates the payload of the message | `testCaseStartedId` | string | no | | | `testStepId` | string | no | | | `url` | string | no | | +| `testRunStartedId` | string | no | | ## Duration @@ -43,6 +44,8 @@ will only have one of its fields set, which indicates the payload of the message | `testRunStarted` | [TestRunStarted](#testrunstarted) | no | | | `testStepFinished` | [TestStepFinished](#teststepfinished) | no | | | `testStepStarted` | [TestStepStarted](#teststepstarted) | no | | +| `globalHookStarted` | [GlobalHookStarted](#globalhookstarted) | no | | +| `globalHookFinished` | [GlobalHookFinished](#globalhookfinished) | no | | | `undefinedParameterType` | [UndefinedParameterType](#undefinedparametertype) | no | | ## Exception @@ -195,6 +198,23 @@ will only have one of its fields set, which indicates the payload of the message | `name` | string | yes | | | `id` | string | yes | | +## GlobalHookFinished + +| Field | Type | Required | Description | +| ----- | ---- | ----------- | ----------- | +| `testRunStartedId` | string | yes | | +| `hookId` | string | yes | | +| `result` | [TestStepResult](#teststepresult) | yes | | +| `timestamp` | [Timestamp](#timestamp) | yes | | + +## GlobalHookStarted + +| Field | Type | Required | Description | +| ----- | ---- | ----------- | ----------- | +| `testRunStartedId` | string | yes | | +| `hookId` | string | yes | | +| `timestamp` | [Timestamp](#timestamp) | yes | | + ## Hook | Field | Type | Required | Description | @@ -381,6 +401,7 @@ will only have one of its fields set, which indicates the payload of the message | `id` | string | yes | | | `pickleId` | string | yes | | | `testSteps` | [TestStep](#teststep)[] | yes | | +| `testRunStartedId` | string | no | | ## Group @@ -439,12 +460,14 @@ will only have one of its fields set, which indicates the payload of the message | `success` | boolean | yes | | | `timestamp` | [Timestamp](#timestamp) | yes | | | `exception` | [Exception](#exception) | no | | +| `testRunStartedId` | string | no | | ## TestRunStarted | Field | Type | Required | Description | | ----- | ---- | ----------- | ----------- | | `timestamp` | [Timestamp](#timestamp) | yes | | +| `id` | string | no | | ## TestStepFinished diff --git a/perl/lib/Cucumber/Messages.pm b/perl/lib/Cucumber/Messages.pm index 5e5d51e8..09694fd6 100644 --- a/perl/lib/Cucumber/Messages.pm +++ b/perl/lib/Cucumber/Messages.pm @@ -86,6 +86,7 @@ my %types = ( test_case_started_id => 'string', test_step_id => 'string', url => 'string', + test_run_started_id => 'string', ); # This is a work-around for the fact that Moo doesn't have introspection @@ -231,6 +232,16 @@ has url => ); +=head4 test_run_started_id + + +=cut + +has test_run_started_id => + (is => 'ro', + ); + + } package Cucumber::Messages::Duration { @@ -340,6 +351,8 @@ my %types = ( test_run_started => 'Cucumber::Messages::TestRunStarted', test_step_finished => 'Cucumber::Messages::TestStepFinished', test_step_started => 'Cucumber::Messages::TestStepStarted', + global_hook_started => 'Cucumber::Messages::GlobalHookStarted', + global_hook_finished => 'Cucumber::Messages::GlobalHookFinished', undefined_parameter_type => 'Cucumber::Messages::UndefinedParameterType', ); @@ -511,6 +524,26 @@ has test_step_started => ); +=head4 global_hook_started + + +=cut + +has global_hook_started => + (is => 'ro', + ); + + +=head4 global_hook_finished + + +=cut + +has global_hook_finished => + (is => 'ro', + ); + + =head4 undefined_parameter_type @@ -1999,6 +2032,167 @@ has id => ); +} + +package Cucumber::Messages::GlobalHookFinished { + +=head2 Cucumber::Messages::GlobalHookFinished + +=head3 DESCRIPTION + +Represents the GlobalHookFinished message in Cucumber's +L. + + + +=head3 ATTRIBUTES + +=cut + +use Moo; +extends 'Cucumber::Messages::Message'; + +use Scalar::Util qw( blessed ); + +my %types = ( + test_run_started_id => 'string', + hook_id => 'string', + result => 'Cucumber::Messages::TestStepResult', + timestamp => 'Cucumber::Messages::Timestamp', +); + +# This is a work-around for the fact that Moo doesn't have introspection +# and Perl doesn't have boolean values... +sub _types { + return \%types; +} + + + +=head4 test_run_started_id + +Identifier for the test run that this hook execution belongs to + +=cut + +has test_run_started_id => + (is => 'ro', + required => 1, + default => sub { '' }, + ); + + +=head4 hook_id + +Identifier for the hook that was executed + +=cut + +has hook_id => + (is => 'ro', + required => 1, + default => sub { '' }, + ); + + +=head4 result + + +=cut + +has result => + (is => 'ro', + required => 1, + default => sub { Cucumber::Messages::TestStepResult->new() }, + ); + + +=head4 timestamp + + +=cut + +has timestamp => + (is => 'ro', + required => 1, + default => sub { Cucumber::Messages::Timestamp->new() }, + ); + + +} + +package Cucumber::Messages::GlobalHookStarted { + +=head2 Cucumber::Messages::GlobalHookStarted + +=head3 DESCRIPTION + +Represents the GlobalHookStarted message in Cucumber's +L. + + + +=head3 ATTRIBUTES + +=cut + +use Moo; +extends 'Cucumber::Messages::Message'; + +use Scalar::Util qw( blessed ); + +my %types = ( + test_run_started_id => 'string', + hook_id => 'string', + timestamp => 'Cucumber::Messages::Timestamp', +); + +# This is a work-around for the fact that Moo doesn't have introspection +# and Perl doesn't have boolean values... +sub _types { + return \%types; +} + + + +=head4 test_run_started_id + +Identifier for the test run that this hook execution belongs to + +=cut + +has test_run_started_id => + (is => 'ro', + required => 1, + default => sub { '' }, + ); + + +=head4 hook_id + +Identifier for the hook that will be executed + +=cut + +has hook_id => + (is => 'ro', + required => 1, + default => sub { '' }, + ); + + +=head4 timestamp + + +=cut + +has timestamp => + (is => 'ro', + required => 1, + default => sub { Cucumber::Messages::Timestamp->new() }, + ); + + } package Cucumber::Messages::Hook { @@ -3729,6 +3923,7 @@ my %types = ( id => 'string', pickle_id => 'string', test_steps => '[]Cucumber::Messages::TestStep', + test_run_started_id => 'string', ); # This is a work-around for the fact that Moo doesn't have introspection @@ -3776,6 +3971,17 @@ has test_steps => ); +=head4 test_run_started_id + +Identifier for the test run that this case belongs to + +=cut + +has test_run_started_id => + (is => 'ro', + ); + + } package Cucumber::Messages::Group { @@ -4256,6 +4462,7 @@ my %types = ( success => 'boolean', timestamp => 'Cucumber::Messages::Timestamp', exception => 'Cucumber::Messages::Exception', + test_run_started_id => 'string', ); # This is a work-around for the fact that Moo doesn't have introspection @@ -4314,6 +4521,16 @@ has exception => ); +=head4 test_run_started_id + + +=cut + +has test_run_started_id => + (is => 'ro', + ); + + } package Cucumber::Messages::TestRunStarted { @@ -4338,6 +4555,7 @@ use Scalar::Util qw( blessed ); my %types = ( timestamp => 'Cucumber::Messages::Timestamp', + id => 'string', ); # This is a work-around for the fact that Moo doesn't have introspection @@ -4360,6 +4578,16 @@ has timestamp => ); +=head4 id + + +=cut + +has id => + (is => 'ro', + ); + + } package Cucumber::Messages::TestStepFinished { diff --git a/php/src-generated/Attachment.php b/php/src-generated/Attachment.php index 8bf48b2f..564f781d 100644 --- a/php/src-generated/Attachment.php +++ b/php/src-generated/Attachment.php @@ -85,6 +85,7 @@ public function __construct( * separately from reports. */ public readonly ?string $url = null, + public readonly ?string $testRunStartedId = null, ) { } @@ -103,6 +104,7 @@ public static function fromArray(array $arr): self self::ensureTestCaseStartedId($arr); self::ensureTestStepId($arr); self::ensureUrl($arr); + self::ensureTestRunStartedId($arr); return new self( (string) $arr['body'], @@ -113,6 +115,7 @@ public static function fromArray(array $arr): self isset($arr['testCaseStartedId']) ? (string) $arr['testCaseStartedId'] : null, isset($arr['testStepId']) ? (string) $arr['testStepId'] : null, isset($arr['url']) ? (string) $arr['url'] : null, + isset($arr['testRunStartedId']) ? (string) $arr['testRunStartedId'] : null, ); } @@ -204,4 +207,14 @@ private static function ensureUrl(array $arr): void throw new SchemaViolationException('Property \'url\' was array'); } } + + /** + * @psalm-assert array{testRunStartedId?: string|int|bool} $arr + */ + private static function ensureTestRunStartedId(array $arr): void + { + if (array_key_exists('testRunStartedId', $arr) && is_array($arr['testRunStartedId'])) { + throw new SchemaViolationException('Property \'testRunStartedId\' was array'); + } + } } diff --git a/php/src-generated/Envelope.php b/php/src-generated/Envelope.php index 589cdd59..00f4859c 100644 --- a/php/src-generated/Envelope.php +++ b/php/src-generated/Envelope.php @@ -46,6 +46,8 @@ public function __construct( public readonly ?TestRunStarted $testRunStarted = null, public readonly ?TestStepFinished $testStepFinished = null, public readonly ?TestStepStarted $testStepStarted = null, + public readonly ?GlobalHookStarted $globalHookStarted = null, + public readonly ?GlobalHookFinished $globalHookFinished = null, public readonly ?UndefinedParameterType $undefinedParameterType = null, ) { } @@ -73,6 +75,8 @@ public static function fromArray(array $arr): self self::ensureTestRunStarted($arr); self::ensureTestStepFinished($arr); self::ensureTestStepStarted($arr); + self::ensureGlobalHookStarted($arr); + self::ensureGlobalHookFinished($arr); self::ensureUndefinedParameterType($arr); return new self( @@ -92,6 +96,8 @@ public static function fromArray(array $arr): self isset($arr['testRunStarted']) ? TestRunStarted::fromArray($arr['testRunStarted']) : null, isset($arr['testStepFinished']) ? TestStepFinished::fromArray($arr['testStepFinished']) : null, isset($arr['testStepStarted']) ? TestStepStarted::fromArray($arr['testStepStarted']) : null, + isset($arr['globalHookStarted']) ? GlobalHookStarted::fromArray($arr['globalHookStarted']) : null, + isset($arr['globalHookFinished']) ? GlobalHookFinished::fromArray($arr['globalHookFinished']) : null, isset($arr['undefinedParameterType']) ? UndefinedParameterType::fromArray($arr['undefinedParameterType']) : null, ); } @@ -256,6 +262,26 @@ private static function ensureTestStepStarted(array $arr): void } } + /** + * @psalm-assert array{globalHookStarted?: array} $arr + */ + private static function ensureGlobalHookStarted(array $arr): void + { + if (array_key_exists('globalHookStarted', $arr) && !is_array($arr['globalHookStarted'])) { + throw new SchemaViolationException('Property \'globalHookStarted\' was not array'); + } + } + + /** + * @psalm-assert array{globalHookFinished?: array} $arr + */ + private static function ensureGlobalHookFinished(array $arr): void + { + if (array_key_exists('globalHookFinished', $arr) && !is_array($arr['globalHookFinished'])) { + throw new SchemaViolationException('Property \'globalHookFinished\' was not array'); + } + } + /** * @psalm-assert array{undefinedParameterType?: array} $arr */ diff --git a/php/src-generated/GlobalHookFinished.php b/php/src-generated/GlobalHookFinished.php new file mode 100644 index 00000000..4d7871f3 --- /dev/null +++ b/php/src-generated/GlobalHookFinished.php @@ -0,0 +1,114 @@ + TestStep::fromArray($member), $arr['testSteps'])), + isset($arr['testRunStartedId']) ? (string) $arr['testRunStartedId'] : null, ); } @@ -94,4 +101,14 @@ private static function ensureTestSteps(array $arr): void throw new SchemaViolationException('Property \'testSteps\' was not array'); } } + + /** + * @psalm-assert array{testRunStartedId?: string|int|bool} $arr + */ + private static function ensureTestRunStartedId(array $arr): void + { + if (array_key_exists('testRunStartedId', $arr) && is_array($arr['testRunStartedId'])) { + throw new SchemaViolationException('Property \'testRunStartedId\' was array'); + } + } } diff --git a/php/src-generated/TestRunFinished.php b/php/src-generated/TestRunFinished.php index 84eb02ad..70018b42 100644 --- a/php/src-generated/TestRunFinished.php +++ b/php/src-generated/TestRunFinished.php @@ -45,6 +45,7 @@ public function __construct( * Any exception thrown during the test run, if any. Does not include exceptions thrown while executing steps. */ public readonly ?Exception $exception = null, + public readonly ?string $testRunStartedId = null, ) { } @@ -59,12 +60,14 @@ public static function fromArray(array $arr): self self::ensureSuccess($arr); self::ensureTimestamp($arr); self::ensureException($arr); + self::ensureTestRunStartedId($arr); return new self( isset($arr['message']) ? (string) $arr['message'] : null, (bool) $arr['success'], Timestamp::fromArray($arr['timestamp']), isset($arr['exception']) ? Exception::fromArray($arr['exception']) : null, + isset($arr['testRunStartedId']) ? (string) $arr['testRunStartedId'] : null, ); } @@ -113,4 +116,14 @@ private static function ensureException(array $arr): void throw new SchemaViolationException('Property \'exception\' was not array'); } } + + /** + * @psalm-assert array{testRunStartedId?: string|int|bool} $arr + */ + private static function ensureTestRunStartedId(array $arr): void + { + if (array_key_exists('testRunStartedId', $arr) && is_array($arr['testRunStartedId'])) { + throw new SchemaViolationException('Property \'testRunStartedId\' was array'); + } + } } diff --git a/php/src-generated/TestRunStarted.php b/php/src-generated/TestRunStarted.php index 121c1d4f..92d1bd1c 100644 --- a/php/src-generated/TestRunStarted.php +++ b/php/src-generated/TestRunStarted.php @@ -26,6 +26,7 @@ final class TestRunStarted implements JsonSerializable */ public function __construct( public readonly Timestamp $timestamp = new Timestamp(), + public readonly ?string $id = null, ) { } @@ -37,9 +38,11 @@ public function __construct( public static function fromArray(array $arr): self { self::ensureTimestamp($arr); + self::ensureId($arr); return new self( Timestamp::fromArray($arr['timestamp']), + isset($arr['id']) ? (string) $arr['id'] : null, ); } @@ -55,4 +58,14 @@ private static function ensureTimestamp(array $arr): void throw new SchemaViolationException('Property \'timestamp\' was not array'); } } + + /** + * @psalm-assert array{id?: string|int|bool} $arr + */ + private static function ensureId(array $arr): void + { + if (array_key_exists('id', $arr) && is_array($arr['id'])) { + throw new SchemaViolationException('Property \'id\' was array'); + } + } } diff --git a/ruby/lib/cucumber/messages/attachment.rb b/ruby/lib/cucumber/messages/attachment.rb index fae7a75c..df4aebcd 100644 --- a/ruby/lib/cucumber/messages/attachment.rb +++ b/ruby/lib/cucumber/messages/attachment.rb @@ -79,6 +79,8 @@ class Attachment < Message ## attr_reader :url + attr_reader :test_run_started_id + def initialize( body: '', content_encoding: AttachmentContentEncoding::IDENTITY, @@ -87,7 +89,8 @@ def initialize( source: nil, test_case_started_id: nil, test_step_id: nil, - url: nil + url: nil, + test_run_started_id: nil ) @body = body @content_encoding = content_encoding @@ -97,6 +100,7 @@ def initialize( @test_case_started_id = test_case_started_id @test_step_id = test_step_id @url = url + @test_run_started_id = test_run_started_id super() end @@ -118,7 +122,8 @@ def self.from_h(hash) source: Source.from_h(hash[:source]), test_case_started_id: hash[:testCaseStartedId], test_step_id: hash[:testStepId], - url: hash[:url] + url: hash[:url], + test_run_started_id: hash[:testRunStartedId] ) end end diff --git a/ruby/lib/cucumber/messages/envelope.rb b/ruby/lib/cucumber/messages/envelope.rb index 1cc84706..14091e84 100644 --- a/ruby/lib/cucumber/messages/envelope.rb +++ b/ruby/lib/cucumber/messages/envelope.rb @@ -48,6 +48,10 @@ class Envelope < Message attr_reader :test_step_started + attr_reader :global_hook_started + + attr_reader :global_hook_finished + attr_reader :undefined_parameter_type def initialize( @@ -67,6 +71,8 @@ def initialize( test_run_started: nil, test_step_finished: nil, test_step_started: nil, + global_hook_started: nil, + global_hook_finished: nil, undefined_parameter_type: nil ) @attachment = attachment @@ -85,6 +91,8 @@ def initialize( @test_run_started = test_run_started @test_step_finished = test_step_finished @test_step_started = test_step_started + @global_hook_started = global_hook_started + @global_hook_finished = global_hook_finished @undefined_parameter_type = undefined_parameter_type super() end @@ -116,6 +124,8 @@ def self.from_h(hash) test_run_started: TestRunStarted.from_h(hash[:testRunStarted]), test_step_finished: TestStepFinished.from_h(hash[:testStepFinished]), test_step_started: TestStepStarted.from_h(hash[:testStepStarted]), + global_hook_started: GlobalHookStarted.from_h(hash[:globalHookStarted]), + global_hook_finished: GlobalHookFinished.from_h(hash[:globalHookFinished]), undefined_parameter_type: UndefinedParameterType.from_h(hash[:undefinedParameterType]) ) end diff --git a/ruby/lib/cucumber/messages/global_hook_finished.rb b/ruby/lib/cucumber/messages/global_hook_finished.rb new file mode 100644 index 00000000..9b189a04 --- /dev/null +++ b/ruby/lib/cucumber/messages/global_hook_finished.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb] +module Cucumber + module Messages + ## + # Represents the GlobalHookFinished message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. + ## + ## + class GlobalHookFinished < Message + ## + # Identifier for the test run that this hook execution belongs to + ## + attr_reader :test_run_started_id + + ## + # Identifier for the hook that was executed + ## + attr_reader :hook_id + + attr_reader :result + + attr_reader :timestamp + + def initialize( + test_run_started_id: '', + hook_id: '', + result: TestStepResult.new, + timestamp: Timestamp.new + ) + @test_run_started_id = test_run_started_id + @hook_id = hook_id + @result = result + @timestamp = timestamp + super() + end + + ## + # Returns a new GlobalHookFinished from the given hash. + # If the hash keys are camelCased, they are properly assigned to the + # corresponding snake_cased attributes. + # + # Cucumber::Messages::GlobalHookFinished.from_h(some_hash) # => # + ## + def self.from_h(hash) + return nil if hash.nil? + + new( + test_run_started_id: hash[:testRunStartedId], + hook_id: hash[:hookId], + result: TestStepResult.from_h(hash[:result]), + timestamp: Timestamp.from_h(hash[:timestamp]) + ) + end + end + end +end diff --git a/ruby/lib/cucumber/messages/global_hook_started.rb b/ruby/lib/cucumber/messages/global_hook_started.rb new file mode 100644 index 00000000..bd4bc765 --- /dev/null +++ b/ruby/lib/cucumber/messages/global_hook_started.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb] +module Cucumber + module Messages + ## + # Represents the GlobalHookStarted message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. + ## + ## + class GlobalHookStarted < Message + ## + # Identifier for the test run that this hook execution belongs to + ## + attr_reader :test_run_started_id + + ## + # Identifier for the hook that will be executed + ## + attr_reader :hook_id + + attr_reader :timestamp + + def initialize( + test_run_started_id: '', + hook_id: '', + timestamp: Timestamp.new + ) + @test_run_started_id = test_run_started_id + @hook_id = hook_id + @timestamp = timestamp + super() + end + + ## + # Returns a new GlobalHookStarted from the given hash. + # If the hash keys are camelCased, they are properly assigned to the + # corresponding snake_cased attributes. + # + # Cucumber::Messages::GlobalHookStarted.from_h(some_hash) # => # + ## + def self.from_h(hash) + return nil if hash.nil? + + new( + test_run_started_id: hash[:testRunStartedId], + hook_id: hash[:hookId], + timestamp: Timestamp.from_h(hash[:timestamp]) + ) + end + end + end +end diff --git a/ruby/lib/cucumber/messages/test_case.rb b/ruby/lib/cucumber/messages/test_case.rb index d4204735..5398d09d 100644 --- a/ruby/lib/cucumber/messages/test_case.rb +++ b/ruby/lib/cucumber/messages/test_case.rb @@ -22,14 +22,21 @@ class TestCase < Message attr_reader :test_steps + ## + # Identifier for the test run that this case belongs to + ## + attr_reader :test_run_started_id + def initialize( id: '', pickle_id: '', - test_steps: [] + test_steps: [], + test_run_started_id: nil ) @id = id @pickle_id = pickle_id @test_steps = test_steps + @test_run_started_id = test_run_started_id super() end @@ -46,7 +53,8 @@ def self.from_h(hash) new( id: hash[:id], pickle_id: hash[:pickleId], - test_steps: hash[:testSteps]&.map { |item| TestStep.from_h(item) } + test_steps: hash[:testSteps]&.map { |item| TestStep.from_h(item) }, + test_run_started_id: hash[:testRunStartedId] ) end end diff --git a/ruby/lib/cucumber/messages/test_run_finished.rb b/ruby/lib/cucumber/messages/test_run_finished.rb index 6374d4fb..ac6eaffa 100644 --- a/ruby/lib/cucumber/messages/test_run_finished.rb +++ b/ruby/lib/cucumber/messages/test_run_finished.rb @@ -28,16 +28,20 @@ class TestRunFinished < Message ## attr_reader :exception + attr_reader :test_run_started_id + def initialize( message: nil, success: false, timestamp: Timestamp.new, - exception: nil + exception: nil, + test_run_started_id: nil ) @message = message @success = success @timestamp = timestamp @exception = exception + @test_run_started_id = test_run_started_id super() end @@ -55,7 +59,8 @@ def self.from_h(hash) message: hash[:message], success: hash[:success], timestamp: Timestamp.from_h(hash[:timestamp]), - exception: Exception.from_h(hash[:exception]) + exception: Exception.from_h(hash[:exception]), + test_run_started_id: hash[:testRunStartedId] ) end end diff --git a/ruby/lib/cucumber/messages/test_run_started.rb b/ruby/lib/cucumber/messages/test_run_started.rb index dea6be01..fff1581f 100644 --- a/ruby/lib/cucumber/messages/test_run_started.rb +++ b/ruby/lib/cucumber/messages/test_run_started.rb @@ -10,10 +10,14 @@ module Messages class TestRunStarted < Message attr_reader :timestamp + attr_reader :id + def initialize( - timestamp: Timestamp.new + timestamp: Timestamp.new, + id: nil ) @timestamp = timestamp + @id = id super() end @@ -28,7 +32,8 @@ def self.from_h(hash) return nil if hash.nil? new( - timestamp: Timestamp.from_h(hash[:timestamp]) + timestamp: Timestamp.from_h(hash[:timestamp]), + id: hash[:id] ) end end