How to handle results from action words?


#1

I have action words that do some processing and return a result. This is when I don’t want to use a static parameter but rather it could be any dynamic value defined at runtime of the test. I then want to use this result in the following steps. Here is a very short example

Call Find a item with status OK in QA enviroment
Call Create a new ticket for the above item

What is the best way to handle this? I could create a parameter for the first action word but it is not an input. Rather it’s an output from that step.

Thanks
Jim Barton


#2

Hi Jim,

What is the language / framework you are using?


#3

Hi
Thanks for your reply. I have only just started but plan to use Python. It would be nice to know the best approach to cover both manual and automated testing.
Thanks
Jim


#4

There is many way to handle this kind of problem.

The one I suggest (maybe there is a better one, depends of your needs and stack), is firstly to write in a declarative style.

By writing in a declarative style, your spec are only describing the usage of the feature.

The imperative way is more or less a description of what your code do. This mean that you will need to fix your steps code everytime little piece of your UI or code are changed.

Here is a link that explain that : https://automationpanda.com/2017/01/30/bdd-101-writing-good-gherkin/
The goal here is to make steps as independent as possible from others and ‘high-level’ enough to be not impacted by minor changes.

Sometimes variables needs to be accessible from steps.(Most of the time, given steps are used to create your scenario context so context may need to be accessible from all steps) If you are using Python with Behave framework, a “context” object is passed between hooks and steps. You can use it to put some variable in it.
(https://behave.readthedocs.io/en/latest/context_attributes.html)

And finally, in my opinion, manual and automated spec should have no differences. They have to be readable and describe feature aspects of your application.


#5

Hi
Many thanks for your answer. There are certainly some good things to take away from it. I will see how I progress and come back if I have any more questions
Thanks
Jim