PrerunModifier disable specific keywords in setup or teardown using tags

353 views
Skip to first unread message

ashok s

unread,
Nov 24, 2017, 1:20:51 AM11/24/17
to robotframework-users
Hi all, 

I recently joined this group. I use Robot Framework for test automation in our team.
I came across this feature wherein we can disable Test Setup, Test Teardown etc using prerunmodifier and disable.py script. 
This disables the whole Setup/Teardown. Say if I have multiple keywords under a single master test setup keyword.
Is it possible to ignore specific keywords in the setup or teardown based on keyword tag.



Thanks
Ashok

Pekka Klärck

unread,
Nov 24, 2017, 3:50:31 AM11/24/17
to samrat....@gmail.com, robotframework-users
Hello,

This isn't possible using pre-run modifiers. The keyword to actually
run is resolved only when it is executed and only then you could
modify it. You could have different setups/teardowns available and
pre-run modifier could select the one to use, though. Notice that in
general it's best to just set them directly in the test data.

Cheers,
.peke
> --
> You received this message because you are subscribed to the Google Groups
> "robotframework-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to robotframework-u...@googlegroups.com.
> To post to this group, send email to robotframe...@googlegroups.com.
> Visit this group at https://groups.google.com/group/robotframework-users.
> For more options, visit https://groups.google.com/d/optout.



--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

ashok s

unread,
Nov 24, 2017, 4:09:39 AM11/24/17
to robotframework-users
Hi , 

 > This isn't possible using pre-run modifiers. The keyword to actually 
>   run is resolved only when it is executed and only then you could 
>    modify it. 

Thank you for the response. My requirement is at the suite level we have the setup keyword.
This setup keyword contains a bunch of keywords in turn and doing various things like Login to UI, Opening SSH etc.
I want this steps to always happen, but other setup keywords like performing certain configuration which I want to skip if we already have the configuration.
Hence I wanted a way to programmatically skip it. Is there anyother option other than having some sort of flag variable like ${CONFIG_REQUIRED} if its False just skip the configuration ? 

Thanks
Ashok

Hélio Guilherme

unread,
Nov 24, 2017, 9:04:38 AM11/24/17
to robotframework-users
You can use Tags keywords to set and detect tags (and returning from setup early).

My Favorite Open Source Projects
awsome-lists gretl meld robotframework wxPython
(sponsored/patrocinado) Recomendo servidores e alojamento Web em:
http://www.proalojamento.com/clientes/aff.php?aff=258

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.

Tatu Aalto

unread,
Nov 24, 2017, 10:29:42 AM11/24/17
to samrat....@gmail.com, robotframework-users
Ugh

Is it that you want to run the suite setup only if has not been run already? If yes, you could move the suite setup in a init file [1]. The init file suite setup is run once per folder and then you could have common setup for all suites in the (sub) folders. The down side is that one can not anymore run a pybot by running a single file, instead one run folder and including and excluding test must be done by example tags.

-Tatu
Send from my mobile

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages