Skip to content

Commit

Permalink
language review with Brendan <3
Browse files Browse the repository at this point in the history
  • Loading branch information
samanthacsik committed Apr 30, 2024
1 parent df94c9b commit 7bfab61
Show file tree
Hide file tree
Showing 34 changed files with 138 additions and 183 deletions.
69 changes: 0 additions & 69 deletions .Rhistory

This file was deleted.

2 changes: 1 addition & 1 deletion course-materials/slides/part1.1-shiny-overview-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 1 | January 26^th^, 2024]{.custom-subtitle3}
<!-- [Week 1 | January 26^th^, 2024]{.custom-subtitle3} -->

---

Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part1.2-setup-app-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 1 | January 26^th^, 2024]{.custom-subtitle3}
<!-- [Week 1 | January 26^th^, 2024]{.custom-subtitle3} -->

---

Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part2.1-single-file-app-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 1 | January 26^th^, 2024]{.custom-subtitle3}
<!-- [Week 1 | January 26^th^, 2024]{.custom-subtitle3} -->

---

Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part2.2-two-file-app-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 1 | January 26^th^, 2024]{.custom-subtitle3}
<!-- [Week 1 | January 26^th^, 2024]{.custom-subtitle3} -->

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 1 | January 26^th^, 2024]{.custom-subtitle3}
<!-- [Week 1 | January 26^th^, 2024]{.custom-subtitle3} -->

---

Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part3-shiny-dashboard-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 2 | February 2^nd^, 2024]{.custom-subtitle3}
<!-- [Week 2 | February 2^nd^, 2024]{.custom-subtitle3} -->

---

Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part4.1-bslib-fresh-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 2 | February 2^nd^, 2024]{.custom-subtitle3}
<!-- [Week 2 | February 2^nd^, 2024]{.custom-subtitle3} -->

---

Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part4.2-css-sass-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 2 | February 2^nd^, 2024]{.custom-subtitle3}
<!-- [Week 2 | February 2^nd^, 2024]{.custom-subtitle3} -->

---

Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part5-ux-ui-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 2 | February 2^nd^, 2024]{.custom-subtitle3}
<!-- [Week 2 | February 2^nd^, 2024]{.custom-subtitle3} -->

---

Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part6.1-functions-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 2 | February 2^nd^, 2024]{.custom-subtitle3}
<!-- [Week 2 | February 2^nd^, 2024]{.custom-subtitle3} -->

---

Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part6.2-modules-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 2 | February 2^nd^, 2024]{.custom-subtitle3}
<!-- [Week 2 | February 2^nd^, 2024]{.custom-subtitle3} -->

---

Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part7.1-debugging-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 2 | February 2^nd^, 2024]{.custom-subtitle3}
<!-- [Week 2 | February 2^nd^, 2024]{.custom-subtitle3} -->

---

Expand Down
55 changes: 34 additions & 21 deletions course-materials/slides/part7.2-unit-testing-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 2 | February 2^nd^, 2024]{.custom-subtitle3}
<!-- [Week 2 | February 2^nd^, 2024]{.custom-subtitle3} -->

---

Expand All @@ -46,15 +46,11 @@ editor_options:

. . .

[{{< fa angle-right title="a bullet point" >}}]{.teal-text} have a basic understanding of how to use the `{shinytest2}` package to write unit (regression) tests
[{{< fa angle-right title="a bullet point" >}}]{.teal-text} have a basic understanding of how to use the `{shinytest2}` package to write appropriately scoped unit (regression) tests

. . .

[{{< fa angle-right title="a bullet point" >}}]{.teal-text} know how to rerun and update test as necessary

. . .

[{{< fa angle-right title="a bullet point" >}}]{.teal-text} TBD
[{{< fa angle-right title="a bullet point" >}}]{.teal-text} know how to rerun and update tests as necessary

. . .

Expand Down Expand Up @@ -91,7 +87,7 @@ There are lots of different *types* of testing. To name just a few:
Test can be:

- [**Performed manually**, where a person interacts with different app features to identify bugs, errors, anomalies, etc.]{.body-text-s}
- [**Automated**, where a person sets up frameworks and creates test scripts that automate the user actions required for testing a website or app]{.body-text-s}
- [**Automated**, where a person uses test scripts and programs to automate user interactions and validate assumed behaviorwh]{.body-text-s}

---

Expand Down Expand Up @@ -196,7 +192,9 @@ It's almost inevitable that our app(s) will (at some point) break -- there are l

<hr>

The [`{shinytest2}` package](https://rstudio.github.io/shinytest2/articles/shinytest2.html) provides useful tools for **unit testing** Shiny apps. This process is also known as [**regression testing**](https://en.wikipedia.org/wiki/Regression_testing), since we'll be testing existing app behavior for consistency over time (we don't want app behavior to regress).
The [`{shinytest2}` package](https://rstudio.github.io/shinytest2/articles/shinytest2.html) provides useful tools for **unit testing** Shiny apps. We'll use these unit tests to ensure that desired app behavior remains consistent, even after changes to the app's code.

<!-- This process is also known as [**regression testing**](https://en.wikipedia.org/wiki/Regression_testing), since we'll be testing existing app behavior for consistency over time (we don't want app behavior to regress). -->

:::: {.columns}

Expand All @@ -222,7 +220,11 @@ knitr::include_graphics("images/part6/shinytest2-hex.png")

::::

[With `{shinytest2}`, we can interact with our app via the "app recorder" and our test code will be automatically generated for us. We can then rerun tests to check for consistency as we iterate on our app.]{.body-text-s}
. . .

::: {.center-text .body-text-s}
*With `{shinytest2}`, we can interact with our app via the "app recorder" and our test code will be automatically generated for us. We can then rerun tests to check for consistency as we iterate on our app.*
:::

::: {.footer}
`{shinytest2}` uses [`{chromote}`](https://rstudio.github.io/chromote/) to render your app in a headless [Chromium browser](https://www.chromium.org/chromium-projects/) -- by default, it uses Google Chrome, so make sure you have that installed on your OS!
Expand Down Expand Up @@ -348,7 +350,7 @@ Let's say that you are satisfied with your work (yay!) and are now ready to writ

<hr>

[Before we dive into writing any tests, it's super helpful to inspect your app and, *importantly* jot down (in your own words) any **assertions**. [Test assertions](https://en.wikipedia.org/wiki/Test_assertion) are expressions that contain testable logic to evaluate whether an actual result / behavior is as expected.]{.body-text-s}
Before we dive into writing any tests, it's super helpful to inspect your app and *importantly*, **jot down (in your own words) the expected behaviors of your application**. These will form the basis of the assertions made in your test.

<br>

Expand All @@ -358,6 +360,8 @@ I find it helpful to frame assertions as: (1) what **actions** can be taken? and

<br>

. . .

```{r}
# countdown::countdown(
# minutes = 2,
Expand Down Expand Up @@ -424,7 +428,7 @@ Over time, **your ability to identify both how users will interact with your app

## {#testing-procedure data-menu-title="Testing procedure"}

[Turn written assertions into actual tests using the `{shinytest2}` workflow]{.slide-title3}
[Turn "plain language" assertions into actual tests using the `{shinytest2}` workflow]{.slide-title3}

<hr>

Expand Down Expand Up @@ -633,7 +637,7 @@ test_that("{shinytest2} recording: one-name-greeting", {
# click the actionButton (with Id `greeting_button_input`)
app$click("greeting_button_input")
# save the expected input, output, and export values to a JSON snapshot and generates a debug screenshot of the app
# save the expected input, output, and export values to a JSON snapshot and generates a screenshot of the app
app$expect_values()
})
```
Expand Down Expand Up @@ -1673,23 +1677,23 @@ knitr::include_graphics("images/part6/new.png")
<br>

::: {.center-text}
**Our test failed, despite the consistent (expected) behavior of our test subject** (in other words, our test failed, even though the expected output, "Hello Sam!" stayed the same.)
**Our test failed, despite the behavior of our test subject *not* changing** (in other words, our test failed, even though the expected output, "Hello Sam!" stayed the same.)
:::

. . .

<!-- <br> -->

<!-- ::: {.center-text} -->
<!-- Therefore, our test failed due to changes outside of the test subject's (i.e. greeting's) behavior. -->
<!-- ::: -->
<br>

<!-- . . . -->
::: {.center-text}
A good test is able to isolate the behavior of it's subject so that you can trust the result of the test. In this case, our tests failed when they shouldn't have...
:::

<br>

. . .

::: {.center-text}
Because our test failed due to changes outside of the test subject's (i.e. greeting's) behavior, **we need to modify our tests so that they capture a *targeted value expectation*, rather than the state of our entire application**. For example:
Therefore, **we need to modify our tests so that they capture a *targeted value expectation*, rather than the state of our entire application**. For example:
:::

:::: {.columns}
Expand Down Expand Up @@ -2732,6 +2736,15 @@ Should our app's default state change (e.g. if we add a new feature, we update e

[{{< fa angle-right title="a bullet point" >}}]{.teal-text} **Use `record_test()` fairly often** -- make a test recording for each feature of your app (many little recordings are encouraged!)

. . .

<br>

[{{< fa angle-right title="a bullet point" >}}]{.teal-text} **Think of both the most common *and* uncommon pathways that your user may take when interacting with your app.**
E.g. your user types in a name, then deletes everything, then clicks the "Greet" button...would you app handle that use case?

. . .

<br>

[{{< fa angle-right title="a bullet point" >}}]{.teal-text} **Limit testing to objects under your control.** For example, let's say you have a reactive data frame that you then send to a `DT::datatable` -- if package maintainers update `{DT}`, your output might change which could lead to false positive failed tests. Instead, test just your data frame that gets sent to `{DT}`.
Expand Down
2 changes: 1 addition & 1 deletion course-materials/slides/part8-wrap-up-slides.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ editor_options:

<hr class="hr-teal">

[Week 2 | February 2^nd^, 2024]{.custom-subtitle3}
<!-- [Week 2 | February 2^nd^, 2024]{.custom-subtitle3} -->

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ <h2></h2>
<p><span class="custom-title">EDS 430: Part 1.1</span></p>
<p><span class="custom-subtitle"><em>What is Shiny?</em></span></p>
<hr class="hr-teal">
<p><span class="custom-subtitle3">Week 1 | January 26<sup>th</sup>, 2024</span></p>
<!-- [Week 1 | January 26^th^, 2024]{.custom-subtitle3} -->
</section>
<section id="what-is-shiny" class="slide level2" data-menu-title="~~~ What is Shiny? ~~~" data-background="#047C90">
<h2></h2>
Expand Down Expand Up @@ -602,7 +602,7 @@ <h2></h2>
</div>
<div class="cell">
<div class="cell-output-display">
<div class="countdown" id="timer_fc730b8c" data-update-every="1" tabindex="0" style="right:0;bottom:0;font-size:2em;">
<div class="countdown" id="timer_23d67755" data-update-every="1" tabindex="0" style="right:0;bottom:0;font-size:2em;">
<div class="countdown-controls"><button class="countdown-bump-down"></button><button class="countdown-bump-up">+</button></div>
<code class="countdown-time"><span class="countdown-digits minutes">05</span><span class="countdown-digits colon">:</span><span class="countdown-digits seconds">00</span></code>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/course-materials/slides/part1.2-setup-app-slides.html
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ <h2></h2>
<p><span class="custom-title">EDS 430: Part 1.2</span></p>
<p><span class="custom-subtitle"><em>Setting up a Shiny app</em></span></p>
<hr class="hr-teal">
<p><span class="custom-subtitle3">Week 1 | January 26<sup>th</sup>, 2024</span></p>
<!-- [Week 1 | January 26^th^, 2024]{.custom-subtitle3} -->
</section>
<section id="setup" class="slide level2" data-menu-title="~~~ Setup ~~~" data-background="#047C90">
<h2></h2>
Expand Down Expand Up @@ -586,7 +586,7 @@ <h2></h2>
</div>
<div class="cell">
<div class="cell-output-display">
<div class="countdown" id="timer_df48db33" data-update-every="1" tabindex="0" style="right:0;bottom:0;font-size:2em;">
<div class="countdown" id="timer_06369831" data-update-every="1" tabindex="0" style="right:0;bottom:0;font-size:2em;">
<div class="countdown-controls"><button class="countdown-bump-down"></button><button class="countdown-bump-up">+</button></div>
<code class="countdown-time"><span class="countdown-digits minutes">05</span><span class="countdown-digits colon">:</span><span class="countdown-digits seconds">00</span></code>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ <h2></h2>
<p><span class="custom-title">EDS 430: Part 2.1</span></p>
<p><span class="custom-subtitle"><em>Building a single-file app</em></span></p>
<hr class="hr-teal">
<p><span class="custom-subtitle3">Week 1 | January 26<sup>th</sup>, 2024</span></p>
<!-- [Week 1 | January 26^th^, 2024]{.custom-subtitle3} -->
</section>
<section id="build-app1" class="slide level2" data-menu-title="~~~ Building App #1 ~~~" data-background="#047C90">
<h2></h2>
Expand Down Expand Up @@ -1494,7 +1494,7 @@ <h2></h2>
</div>
<div class="cell">
<div class="cell-output-display">
<div class="countdown" id="timer_76368d87" data-update-every="1" tabindex="0" style="right:0;bottom:0;font-size:2em;">
<div class="countdown" id="timer_81e77fde" data-update-every="1" tabindex="0" style="right:0;bottom:0;font-size:2em;">
<div class="countdown-controls"><button class="countdown-bump-down"></button><button class="countdown-bump-up">+</button></div>
<code class="countdown-time"><span class="countdown-digits minutes">05</span><span class="countdown-digits colon">:</span><span class="countdown-digits seconds">00</span></code>
</div>
Expand Down
Loading

0 comments on commit 7bfab61

Please sign in to comment.