Skip to content

Commit

Permalink
[cppcon23] update slides
Browse files Browse the repository at this point in the history
  • Loading branch information
ghorbanzade committed Oct 1, 2023
1 parent 0d41b7f commit 2a303e9
Showing 1 changed file with 79 additions and 14 deletions.
93 changes: 79 additions & 14 deletions slides/cppcon23/pages/03_tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,29 @@ the system we are changing is old and legacy. Touca needs to support this
use-case and support most versions of GCC, Clang, and MSVC with that same logic.
To support older standard versions, the SDK has a few dependencies, listed here,
so we don't provide single-header installation. Instead you can build and
so we don't offer single-header installation. Instead you can build and
install Touca with CMake and pull it as a dependency using FetchContent.
We also have limited support Conan and Bazel.
We also have limited support for Conan and Bazel.
-->

---
slide: Data Capturing API
---

<div class="grid grid-cols-2 gap-2">
<div class="grid wsl-code-h-full">
<div class="grid grid-cols-7 gap-2">
<div class="col-span-5 grid wsl-code-h-full">

```cpp {|3-5}
touca::workflow("students", [](const std::string& username) {
const auto& student = find_student(username);
touca::check("name", student.name);
touca::check("birth_date", student.dob);
touca::check("gpa", student.gpa);
});
```
</div>
<div v-click class="col-span-2 grid wsl-code-h-full">
```cpp
struct Date {
Expand All @@ -107,16 +119,7 @@ struct Date {
```

</div>
<div class="grid wsl-code-h-full">
```cpp
touca::check("name", student.name);
touca::check("birth_date", student.dob);
touca::check("gpa", student.gpa);
```

</div>
<div class="col-span-2">
<div v-click class="col-span-7">

```cpp
template <typename Char, typename Value>
Expand All @@ -129,18 +132,45 @@ void check(Char&& key, const Value& value) {
</div>
</div>
<!--
Now we learned what a simple test workflow looked like with Touca.
Let's now focus on the main data capturing API function used in that sample
test workflow: `touca::check`.
(click)
We want capturing of data points to be easy and developer friendly, so these
functions provides out-of-the-box support for any primitive and standard data
type and is designed to be extensible to support any custom user-defined type.
(click)
Take date of birth for example which could be defined as a Date object with
the structure presented here.
(click)
We implement the high-level user-facing function as shown here, to perfect
forward the type of the given value parameter to a class template serializer
that enables template specialization for any custom type.
-->
---
slide: Data Capturing Internals
---
<div class="space-y-2 wsl-code-p-sm">
<div>
```cpp
void touca::detail::check(const std::string& key, const data_point& value) {
instance.check(key, value);
}
```

</div>
<div v-click>

```cpp
void Client::check(const std::string& key, const data_point& value) {
if (has_last_testcase()) {
Expand All @@ -149,6 +179,9 @@ void Client::check(const std::string& key, const data_point& value) {
}
```
</div>
<div v-click>
```cpp
void Testcase::check(const std::string& key, const data_point& value) {
_resultsMap.emplace(key, ResultEntry{value, ResultCategory::Check});
Expand All @@ -157,6 +190,38 @@ void Testcase::check(const std::string& key, const data_point& value) {
```

</div>
</div>

<!--
But before we focus on serialization, let's review a few key design decisions
behind these data capturing functions:
`touca::check` as well as all other data capturing functions, are designed to
temporarily store a copy of any interesting data point and once the workflow
is executed for a given test case, submit all captured data points to the
Touca server.
To satisfy this use-case, all Touca data capturing functions are stateful,
and are implemented to hold captured data in a good old singleton.
(click)
As you may have noticed, touca:check is also a stand-alone function so we can
call it from anywhere within our code, including from the implementation of
our production code. This design enables tracking important data points that may
not be exposed in the output of our software or accessible from its interface.
But because capturing data points in production environments doesn't make sense,
Touca data capturing functions are implemented to be default no-op unless they
are called from the test framework or explicitly activated via calling the
touca::configure function.
(click)
And the library has a mechanism to avoid submitting captured data points for
test cases that have been submitted before, unless new data is captured
for those data points.
-->

---
section: Data Serialization
Expand Down

0 comments on commit 2a303e9

Please sign in to comment.