# Testing Rasa stories

**URL:** <https://forum.rasa.com/t/testing-rasa-stories/46277>\
**Category:** Rasa Open Source\
**Created:** [July 29, 2021, 9:16am UTC](https://forum.rasa.com/t/testing-rasa-stories/46277 "2021-07-29T09:16:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chatbot\_Ra](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chatbot_ra/32/2238_2.png) [@Chatbot\_Ra](https://forum.rasa.com/u/Chatbot_Ra)\
**Post date:** [July 29, 2021, 9:16am UTC](https://forum.rasa.com/t/testing-rasa-stories/46277/1 "2021-07-29T09:16:26Z")

</div>

Hi

This is my story:

```auto
- story: Accept data privacy and customer concern
  steps:
    - intent: affirm
      entities:
      - data_privacy_declaration: "Alright"
    - action: utter_customer_concern

```

I want to test the story with `rasa test`. But first I have written the test-story in `tests/test_stories.yml`:

```auto
- story: test accept data privacy and customer concern
  steps:
    - user: |
        Alright
      intent: affirm
    - slot_was_set:
        - requested_slot: data_privacy_declaration
        - data_privacy_declaration: "Alright" 
    - action: utter_customer_concern

```

Unfortunately, the test failed as shown in `failed_test_stories.yml`:

```auto
  steps:
  - intent: affirm
  - slot_was_set:
    - requested_slot: data_privacy_declaration
  - slot_was_set:
    - data_privacy_declaration: Alright
  - action: utter_customer_concern # predicted: action_reset_slot

```

Any idea why the test is failing?

If I run the bot, everything works perfectly.

---

<div class="post-metadata">

**Author:** ![anca](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/anca/32/14540_2.png) [@anca](https://forum.rasa.com/u/anca)\
**Post date:** [July 29, 2021, 10:30am UTC](https://forum.rasa.com/t/testing-rasa-stories/46277/2 "2021-07-29T10:30:16Z")

</div>

@Chatbot_Ra Is `action_reset_slot` a custom action that you implemented? When is this used, in other stories or rules? And to double-check you’re using slot auto-fill to set the `data_privacy_declaration` slot?

I would suggest adding a `slot_was_set` step in your `stories.yml`, after `intent: affirm`.

---

<div class="post-metadata">

**Author:** ![Chatbot\_Ra](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chatbot_ra/32/2238_2.png) [@Chatbot\_Ra](https://forum.rasa.com/u/Chatbot_Ra)\
**Post date:** [July 29, 2021, 11:23am UTC](https://forum.rasa.com/t/testing-rasa-stories/46277/3 "2021-07-29T11:23:06Z")

</div>

> [@anca](#):
>
> Is `action_reset_slot` a custom action that you implemented?

No, it’s not. It comes from Rasa.

I gues the problem is the way the story gets triggered. Please take a closer look at the story:

```auto
- story: Accept data privacy and customer concern
  steps:
    - intent: affirm
      entities:
      - data_privacy_declaration: "Alright"
    - action: utter_customer_concern

```

It’s triggered with an intent `affirm` and an entity `data_privacy_declaration`. The question which triggers this story is defined in domain file as following:

```auto
  utter_accept_privacy_rules:
  - text: Are you fine with data privacy rules?
    buttons:
    - payload: /affirm{{"data_privacy_declaration":"Alright"}}
      title: Yes
    - payload: /denny{{"data_privacy_declaration":"Nope"}}
      title: No

```

I specified `data_privacy_declaration` as slot and entity in the domain file.

I have the feeling that the way I write the test is not correct.

---

<div class="post-metadata">

**Author:** ![Chatbot\_Ra](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chatbot_ra/32/2238_2.png) [@Chatbot\_Ra](https://forum.rasa.com/u/Chatbot_Ra)\
**Post date:** [July 29, 2021, 12:26pm UTC](https://forum.rasa.com/t/testing-rasa-stories/46277/4 "2021-07-29T12:26:15Z")

</div>

@anca Thank you very much: Your propossed solution was successful 🙂
