-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add global hooks, global attachments, hook types (#102)
- Loading branch information
1 parent
8b91a8d
commit a204309
Showing
77 changed files
with
2,050 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
#include <string_view> | ||
|
||
namespace cucumber::messages { | ||
|
||
enum class hook_type | ||
{ | ||
BEFORE_TEST_RUN, | ||
AFTER_TEST_RUN, | ||
BEFORE_TEST_CASE, | ||
AFTER_TEST_CASE, | ||
BEFORE_TEST_STEP, | ||
AFTER_TEST_STEP | ||
}; | ||
|
||
std::string_view | ||
to_string(hook_type v); | ||
|
||
std::ostream& | ||
operator<<(std::ostream& os, hook_type v); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
cpp/include/messages/cucumber/messages/test_run_hook_finished.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include <string> | ||
#include <optional> | ||
|
||
#include <nlohmann/json.hpp> | ||
|
||
#include <cucumber/messages/test_step_result.hpp> | ||
#include <cucumber/messages/timestamp.hpp> | ||
|
||
namespace cucumber::messages { | ||
|
||
using json = nlohmann::json; | ||
|
||
// | ||
// Represents the TestRunHookFinished message in Cucumber's message protocol | ||
// @see <a href=https://github.com/cucumber/messages>Github - Cucumber - Messages</a> | ||
// | ||
// Generated code | ||
|
||
struct test_run_hook_finished | ||
{ | ||
std::string test_run_hook_started_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 test_run_hook_finished& msg); | ||
|
||
void to_json(json& j, const test_run_hook_finished& m); | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
cpp/include/messages/cucumber/messages/test_run_hook_started.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include <string> | ||
#include <optional> | ||
|
||
#include <nlohmann/json.hpp> | ||
|
||
#include <cucumber/messages/timestamp.hpp> | ||
|
||
namespace cucumber::messages { | ||
|
||
using json = nlohmann::json; | ||
|
||
// | ||
// Represents the TestRunHookStarted message in Cucumber's message protocol | ||
// @see <a href=https://github.com/cucumber/messages>Github - Cucumber - Messages</a> | ||
// | ||
// Generated code | ||
|
||
struct test_run_hook_started | ||
{ | ||
std::string id; | ||
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 test_run_hook_started& msg); | ||
|
||
void to_json(json& j, const test_run_hook_started& m); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <iostream> | ||
#include <unordered_map> | ||
|
||
#include <cucumber/messages/hook_type.hpp> | ||
|
||
namespace cucumber::messages { | ||
|
||
std::string_view | ||
to_string(hook_type v) | ||
{ | ||
using map_type = std::unordered_map<hook_type, std::string_view>; | ||
|
||
static const map_type m = { | ||
{ hook_type::BEFORE_TEST_RUN, "BEFORE_TEST_RUN" }, | ||
{ hook_type::AFTER_TEST_RUN, "AFTER_TEST_RUN" }, | ||
{ hook_type::BEFORE_TEST_CASE, "BEFORE_TEST_CASE" }, | ||
{ hook_type::AFTER_TEST_CASE, "AFTER_TEST_CASE" }, | ||
{ hook_type::BEFORE_TEST_STEP, "BEFORE_TEST_STEP" }, | ||
{ hook_type::AFTER_TEST_STEP, "AFTER_TEST_STEP" } | ||
}; | ||
|
||
return m.at(v); | ||
} | ||
|
||
std::ostream& | ||
operator<<(std::ostream& os, hook_type v) | ||
{ | ||
os << to_string(v); | ||
|
||
return os; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
cpp/src/lib/messages/cucumber/messages/test_run_hook_finished.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include <sstream> | ||
|
||
#include <cucumber/messages/utils.hpp> | ||
#include <cucumber/messages/test_run_hook_finished.hpp> | ||
|
||
namespace cucumber::messages { | ||
|
||
std::string | ||
test_run_hook_finished::to_string() const | ||
{ | ||
std::ostringstream oss; | ||
|
||
cucumber::messages::to_string(oss, "test_run_hook_started_id=", test_run_hook_started_id); | ||
cucumber::messages::to_string(oss, ", result=", result); | ||
cucumber::messages::to_string(oss, ", timestamp=", timestamp); | ||
|
||
return oss.str(); | ||
} | ||
|
||
void | ||
test_run_hook_finished::to_json(json& j) const | ||
{ | ||
cucumber::messages::to_json(j, camelize("test_run_hook_started_id"), test_run_hook_started_id); | ||
cucumber::messages::to_json(j, camelize("result"), result); | ||
cucumber::messages::to_json(j, camelize("timestamp"), timestamp); | ||
} | ||
|
||
std::string | ||
test_run_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 test_run_hook_finished& msg) | ||
{ | ||
os << msg.to_string(); | ||
|
||
return os; | ||
} | ||
|
||
void to_json(json& j, const test_run_hook_finished& m) | ||
{ m.to_json(j); } | ||
|
||
} |
Oops, something went wrong.