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 <cstdlib>
12#include <xtd/optional>
13
15namespace xtd {
17 namespace tunit {
21 class unit_test;
23
30 class tunit_export_ settings final {
31 public:
33
59 settings() = default;
61
63
67 bool also_run_ignored_tests() const noexcept;
68
72
75 bool break_on_failure() const noexcept;
76
80
83 bool brief() const noexcept;
84
87 void brief(bool brief) noexcept;
88
91 bool count_tests() const noexcept;
92
95 void count_tests(bool count_tests) noexcept;
96
100 bool enable_stack_trace() const noexcept;
101
106
109 const xtd::date_time& end_time() const noexcept;
110
114 int32 exit_status() const noexcept;
115
120
123 const xtd::array<string>& filter_tests() const noexcept;
124
127 void filter_tests(const xtd::array<string>& filter_tests) noexcept;
128
131 bool gtest_compatibility() const noexcept;
132
136
139 bool is_match_test_name(const xtd::string& test_class_name, const xtd::string& test_name) const noexcept;
140
143 bool list_tests() const noexcept;
144
147 void list_tests(bool list_tests) noexcept;
148
151 bool output_color() const noexcept;
152
155 void output_color(bool output_color) noexcept;
156
159 bool output_json() const noexcept;
160
163 void output_json(bool output_json) noexcept;
164
167 xtd::string output_json_path() const noexcept;
168
171 void output_json_path(const xtd::string& output_json_path) noexcept;
172
175 bool output_xml() const noexcept;
176
179 void output_xml(bool output_xml) noexcept;
180
183 xtd::string output_xml_path() const noexcept;
184
187 void output_xml_path(const xtd::string& output_xml_path) noexcept;
188
191 uint32 random_seed() const noexcept;
192
196
199 int32 repeat_test() const noexcept;
200
204
207 bool show_duration() const noexcept;
208
211 void show_duration(bool show_duration) noexcept;
212
215 bool shuffle_test() const noexcept;
216
219 void shuffle_test(bool shuffle_test) noexcept;
220
223 const xtd::date_time& start_time() const noexcept;
224
227 bool throw_on_failure() const noexcept;
228
233
235
262 static xtd::tunit::settings& default_settings() noexcept;
264
265 private:
266 friend class xtd::tunit::ostream_event_listener;
267 friend class xtd::tunit::ostream_unit_test;
268 friend class xtd::tunit::unit_test;
269
270 void end_time(const xtd::date_time& end_time) noexcept;
271 void start_time(const xtd::date_time& start_time) noexcept;
272
273 bool also_run_ignored_tests_ = false;
274 bool break_on_failure_ = false;
275 bool brief_ = false;
276 bool count_tests_ = false;
277 bool enable_stack_trace_ = false;
278 xtd::date_time end_time_;
279 int32 exit_status_ = EXIT_SUCCESS;
280 xtd::string file_name_ = xtd::io::path::get_full_path(xtd::reflection::assembly::get_executing_assembly().location());
281 xtd::array<string> filter_tests_ = {"*.*"};
282 bool gtest_compatibility_ = false;
283 bool list_tests_ = false;
284 bool output_color_ = true;
285 bool output_json_ = false;
286 std::optional<xtd::string> output_json_path_;
287 bool output_xml_ = false;
288 std::optional<xtd::string> output_xml_path_;
289 uint32 random_seed_ = 0;
290 int32 repeat_tests_ = 1;
291 bool show_duration_ = true;
292 bool shuffle_tests_ = false;
293 xtd::date_time start_time_;
294 bool throw_on_failure_ = false;
295 };
296 }
297}
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:23
@ path
The xtd::uri::local_path data.
Definition uri_components.hpp:27
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.