xtd 0.2.0
Loading...
Searching...
No Matches
settings.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../tunit_export.hpp"
6#include <xtd/reflection/assembly>
7#include <xtd/io/path>
8#include <xtd/date_time>
9#include <xtd/string>
10#include <cstdint>
11#include <xtd/optional>
12
14namespace xtd {
16 namespace tunit {
20 class unit_test;
22
29 class tunit_export_ settings final {
30 public:
32
58 settings() = default;
60
62
66 bool also_run_ignored_tests() const noexcept;
67
71
74 bool break_on_failure() const noexcept;
75
79
82 bool brief() const noexcept;
83
86 void brief(bool brief) noexcept;
87
90 bool count_tests() const noexcept;
91
94 void count_tests(bool count_tests) noexcept;
95
99 bool enable_stack_trace() const noexcept;
100
105
108 const xtd::date_time& end_time() const noexcept;
109
113 int32 exit_status() const noexcept;
114
119
122 const xtd::array<string>& filter_tests() const noexcept;
123
126 void filter_tests(const xtd::array<string>& filter_tests) noexcept;
127
130 bool gtest_compatibility() const noexcept;
131
135
138 bool is_match_test_name(const xtd::string& test_class_name, const xtd::string& test_name) const noexcept;
139
142 bool list_tests() const noexcept;
143
146 void list_tests(bool list_tests) noexcept;
147
150 bool output_color() const noexcept;
151
154 void output_color(bool output_color) noexcept;
155
158 bool output_json() const noexcept;
159
162 void output_json(bool output_json) noexcept;
163
166 xtd::string output_json_path() const noexcept;
167
170 void output_json_path(const xtd::string& output_json_path) noexcept;
171
174 bool output_xml() const noexcept;
175
178 void output_xml(bool output_xml) noexcept;
179
182 xtd::string output_xml_path() const noexcept;
183
186 void output_xml_path(const xtd::string& output_xml_path) noexcept;
187
190 uint32 random_seed() const noexcept;
191
195
198 int32 repeat_test() const noexcept;
199
203
206 bool show_duration() const noexcept;
207
210 void show_duration(bool show_duration) noexcept;
211
214 bool shuffle_test() const noexcept;
215
218 void shuffle_test(bool shuffle_test) noexcept;
219
222 const xtd::date_time& start_time() const noexcept;
223
226 bool throw_on_failure() const noexcept;
227
232
234
261 static xtd::tunit::settings& default_settings() noexcept;
263
264 private:
265 friend class xtd::tunit::ostream_event_listener;
266 friend class xtd::tunit::ostream_unit_test;
267 friend class xtd::tunit::unit_test;
268
269 void end_time(const xtd::date_time& end_time) noexcept;
270 void start_time(const xtd::date_time& start_time) noexcept;
271
272 bool also_run_ignored_tests_ = false;
273 bool break_on_failure_ = false;
274 bool brief_ = false;
275 bool count_tests_ = false;
276 bool enable_stack_trace_ = false;
277 xtd::date_time end_time_;
278 int32 exit_status_ = 0;
279 xtd::string file_name_ = xtd::io::path::get_full_path(xtd::reflection::assembly::get_executing_assembly().location());
280 xtd::array<string> filter_tests_ = {"*.*"};
281 bool gtest_compatibility_ = false;
282 bool list_tests_ = false;
283 bool output_color_ = true;
284 bool output_json_ = false;
285 std::optional<xtd::string> output_json_path_;
286 bool output_xml_ = false;
287 std::optional<xtd::string> output_xml_path_;
288 uint32 random_seed_ = 0;
289 int32 repeat_tests_ = 1;
290 bool show_duration_ = true;
291 bool shuffle_tests_ = false;
292 xtd::date_time start_time_;
293 bool throw_on_failure_ = false;
294 };
295 }
296}
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.hpp:83
The ostream_unit_test class is a specialisation of event_listener class for writing events in std::os...
Definition ostream_event_listener.hpp:23
The ostream_unit_test class is ostream unit test interface.
Definition ostream_unit_test.hpp:22
int32 exit_status() const noexcept
Gets exit status.
bool brief() const noexcept
Gets brief.
int32 repeat_test() const noexcept
Gets repeat tests count.
const xtd::date_time & end_time() const noexcept
Gets unit test end time.
bool break_on_failure() const noexcept
Gets break immediatly on failure.
xtd::string output_json_path() const noexcept
Gets output json path.
bool also_run_ignored_tests() const noexcept
Gets also run ignored test.
bool shuffle_test() const noexcept
Gets shuffle tests.
settings()=default
Creates new instance of settings.
bool output_xml() const noexcept
Gets output xml.
uint32 random_seed() const noexcept
Gets random seed value.
bool show_duration() const noexcept
Gets if show duration for each test.
static xtd::tunit::settings & default_settings() noexcept
Gets default settings instance.
bool output_color() const noexcept
Gets output color.
void repeat_tests(int32 repeat_tests) noexcept
Sets repeat tests count.
bool is_match_test_name(const xtd::string &test_class_name, const xtd::string &test_name) const noexcept
Return true if a specified test class name and specified test name match with the current filter test...
xtd::string output_xml_path() const noexcept
Gets output xml path.
bool enable_stack_trace() const noexcept
Gets stack trace enabled.
bool throw_on_failure() const noexcept
Gets throw on failure.
const xtd::array< string > & filter_tests() const noexcept
Gets filter tests.
bool output_json() const noexcept
Gets output xml.
const xtd::date_time & start_time() const noexcept
Gets unit test start time.
bool count_tests() const noexcept
Gets count tests.
bool gtest_compatibility() const noexcept
Gets google test comaptibility.
bool list_tests() const noexcept
Gets list tests.
The unit_test class is unit test base interface.
Definition unit_test.hpp:30
#define tunit_export_
Define shared library export.
Definition tunit_export.hpp:13
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.hpp:17
The xtd::reflection namespace contains types that retrieve information about assemblies,...
Definition assembly.hpp:11
The tunit namespace contains a unit test library.
Definition abort_error.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains tunit_export_ keyword.