Skip to content

Commit 49b9b23

Browse files
authored
Merge pull request DataDog#11017 from DataDog/margot.lepizzera/or_guide
Create or-logic-api-tests-assertions.md
2 parents f40f3c2 + 7643bef commit 49b9b23

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

content/en/synthetics/guide/_index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ private: true
1212
{{< nextlink href="synthetics/guide/synthetic-tests-caching" >}}Avoiding cache issues in Synthetic tests{{< /nextlink >}}
1313
{{< /whatsnext >}}
1414

15+
{{< whatsnext desc="API Tests:" >}}
16+
{{< nextlink href="synthetics/guide/or-logic-api-tests-assertions" >}}Perform OR logic in API test assertions{{< /nextlink >}}
17+
{{< /whatsnext >}}
18+
1519
{{< whatsnext desc="Browser Tests:" >}}
1620
{{< nextlink href="synthetics/guide/browser-test-self-maintenance/" >}}Why are browser tests self-maintaining?{{< /nextlink >}}
1721
{{< nextlink href="synthetics/guide/app-that-requires-login/" >}}Monitor an application that requires authentication{{< /nextlink >}}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Perform OR logic in API tests assertions
3+
kind: guide
4+
further_reading:
5+
- link: '/synthetics/api_tests'
6+
tag: 'Documentation'
7+
text: 'Create an API Test'
8+
- link: '/synthetics/multistep'
9+
tag: 'Documentation'
10+
text: 'Create a Multistep API Test'
11+
- link: "/getting_started/synthetics/api_test"
12+
tag: "Documentation"
13+
text: "Get started with HTTP tests"
14+
---
15+
16+
You can perform `OR` logic on your [API test][1] assertions to define several different expected values for the same assertion type. For example, you may want your [HTTP test][2] `status code` assertion to succeed in case your server responds with a `200` **or** with a `302`.
17+
18+
To do this, you can use the [`matches regex` comparator][3] and define a regex like `(200|302)`. With such an assertion, your test result is successful if the status code returned by the server is 200 **or** 302.
19+
20+
## Further Reading
21+
22+
{{< partial name="whats-next/whats-next.html" >}}
23+
24+
[1]: /synthetics/api_tests/
25+
[2]: /synthetics/api_tests/http_tests/
26+
[3]: /synthetics/api_tests/http_tests/?tab=requestoptions#define-assertions

0 commit comments

Comments
 (0)