Skip to content

Instantly share code, notes, and snippets.

@quietguyproductions
Created January 30, 2023 10:54
Show Gist options
  • Save quietguyproductions/c0b9091a4caea080145fe598e1580944 to your computer and use it in GitHub Desktop.
Save quietguyproductions/c0b9091a4caea080145fe598e1580944 to your computer and use it in GitHub Desktop.
GPT designed todolist App using Behavior Driven Development
def create_features_of_todolist() -> List[Feature]:
"""
Creates a list of `Feature` objects that describe how a todolist app functions.
"""
return [
Feature(
FEATURE_NAME="Todolist",
DESCRIPTION="""
In order to remember things
As a forgetful person
I want to store my tasks in a todolist
""",
BACKGROUND=Background(
BACKGROUND_TEXT="""
Given the following tasks:
| title | description |
| Task1 | Task1 desc |
| Task2 | Task2 desc |
| Task3 | Task3 desc |
"""
),
SCENARIOS=[
Scenario(
SCENARIO_NAME="Add a task",
GIVENS=[
Given(GIVEN_TEXT="I am on the homepage"),
Given(GIVEN_TEXT="I click on the 'Add task' button"),
Given(GIVEN_TEXT="I fill in the 'Title' field with 'Task4'"),
Given(GIVEN_TEXT="I fill in the 'Description' field with 'Task4 desc'"),
Given(GIVEN_TEXT="I click on the 'Save' button")
],
WHENS=[],
THENS=[
Then(THEN_TEXT="I should see 'Task4' in the list of tasks"),
Then(THEN_TEXT="I should see 'Task4 desc' in the list of tasks")
],
EXAMPLES=Examples(
EXAMPLE_TEXT="""
| title | description |
| Task4 | Task4 desc |
"""
)
),
Scenario(
SCENARIO_NAME="Edit a task",
GIVENS=[
Given(GIVEN_TEXT="I am on the homepage"),
Given(GIVEN_TEXT="I click on the 'Edit' button for 'Task1'"),
Given(GIVEN_TEXT="I fill in the 'Title' field with 'Task1 edited'"),
Given(GIVEN_TEXT="I fill in the 'Description' field with 'Task1 desc edited'"),
Given(GIVEN_TEXT="I click on the 'Save' button")
],
WHENS=[],
THENS=[
Then(THEN_TEXT="I should see 'Task1 edited' in the list of tasks"),
Then(THEN_TEXT="I should see 'Task1 desc edited' in the list of tasks")
],
EXAMPLES=Examples(
EXAMPLE_TEXT="""
| title | description |
| Task1 | Task1 desc |
"""
)
),
Scenario(
SCENARIO_NAME="Delete a task",
GIVENS=[
Given(GIVEN_TEXT="I am on the homepage"),
Given(GIVEN_TEXT="I click on the 'Delete' button for 'Task2'")
],
WHENS=[],
THENS=[
Then(THEN_TEXT="I should not see 'Task2' in the list of tasks"),
Then(THEN_TEXT="I should not see 'Task2 desc' in the list of tasks")
],
EXAMPLES=Examples(
EXAMPLE_TEXT="""
| title | description |
| Task2 | Task2 desc |
"""
)
)
]
)
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment