Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Updates docs to explain more usage of test creation

Stefan Krawczyke8ee3665f628
diff --git a/burr/cli/__main__.py b/burr/cli/__main__.py
index 5a148c7b..6a1d5385 100644
--- a/burr/cli/__main__.py
+++ b/burr/cli/__main__.py
@@ -232,8 +232,12 @@ def create_test_case(
):
"""Create a test case from a persisted state.
- Prints a pytest test case to the console.
+ Does two things:
+ 1. Pulls data specified and saves it/prints to console.
+ 2. Prints a pytest test case to the console for you to cut and paste.
+
+ See examples/test-case-creation/notebook.ipynb for example usage.
See examples/test-case-creation/test_application.py for details.
"""
# TODO: make this handle instantiating/using a persister other than local tracker
diff --git a/docs/examples/creating_tests.rst b/docs/examples/creating_tests.rst
index f8138b51..08823967 100644
--- a/docs/examples/creating_tests.rst
+++ b/docs/examples/creating_tests.rst
@@ -7,8 +7,24 @@ for an action involves turning a persister or tracker on and then pulling that s
for a test case. The following example demonstrates how to create a test case
using the `burr-test-case` command.
-
Test Case Creation Example
--------------------------
+Prerequisite:
+
+1. You have built some part of your Burr application.
+2. You have found some state you want to test / iterate on.
+3. Note the project name, partition key, app id, and sequence id for the state you want to test.
+4. Run the following command & cut and paste the test to a test file. This will create a `pytest` test.
+
+```bash
+%%sh
+burr-test-case create \
+ --project-name "SOME_NAME" \
+ --partition-key "SOME_KEY" \
+ --app-id "SOME_ID" \
+ --sequence-id 0 \
+ --target-file-name /tmp/test-case.json
+```
-See `github repository example <https://github.com/DAGWorks-Inc/burr/tree/main/examples/test-case-creation>`_.
+See `github repository example <https://github.com/DAGWorks-Inc/burr/tree/main/examples/test-case-creation>`_
+for an example.
diff --git a/examples/test-case-creation/README.md b/examples/test-case-creation/README.md
index c3297182..0063cf97 100644
--- a/examples/test-case-creation/README.md
+++ b/examples/test-case-creation/README.md
@@ -21,6 +21,18 @@ real-world behavior of your application -- Burr can make this process easier.
6. Iterate on the test case until it is robust and representative of the real-world behavior of your application.
7. Profit.
+For step (5) above, this is the corresponding command:
+```bash
+%%sh
+burr-test-case create \
+ --project-name "SOME_NAME" \
+ --partition-key "SOME_KEY" \
+ --app-id "SOME_ID" \
+ --sequence-id 0 \
+ --target-file-name /tmp/test-case.json
+```
+See [the notebook](./notebook.ipynb) for example usage.
+
## Testing Actions
In `test_application.py` you'll find examples tests for a simple action
that is found in `application.py`.
diff --git a/examples/test-case-creation/notebook.ipynb b/examples/test-case-creation/notebook.ipynb
index 6bdaac53..fd634f45 100644
--- a/examples/test-case-creation/notebook.ipynb
+++ b/examples/test-case-creation/notebook.ipynb
@@ -82,7 +82,7 @@
],
"source": [
"%%sh\n",
- "burr-test-case create --project-name \"oa:determine_params\" --partition-key \"\" --app-id \"3350dd68-bcfd-48a1-85c5-dd72186382ef\" --sequence-id 0 --target-file-name /tmp/test-case.json"
+ "burr-test-case create --project-name \"SOME_PROJECT\" --partition-key \"SOME_KEY\" --app-id \"SOME_ID\" --sequence-id 0 --target-file-name /tmp/test-case.json"
],
"metadata": {
"collapsed": false,