Create a setup which will be executed only once when running all Suites, also which will be executed once for each suite executed separately

1,274 views
Skip to first unread message

hanih...@gmail.com

unread,
May 15, 2014, 4:56:04 AM5/15/14
to robotframe...@googlegroups.com
Hello everybody,
This is the structure of my Robot tests:

-->Test directory

  -- Suite01.txt
     ---Test Case 01

  -- Suite02.txt
     ---Test Case 02

  -- Suite03.txt
     ---Test Case 03

  -- keyword_resource.txt
  -- Parameters_resource.txt
  -- __init__.txt

In my Suite0x.txt files, I have Suite Setup and Test Setup.

My problem is that I want to create a setup, which will be executed only once if I run all my suites with "pybot Test directory", and also which will be run once if I execute each Suite separately like " pybot Test directory/Suite02.txt". I thought that adding a settings to my __init__.txt file in Test directory will do this, but it is not the cas. This is what I added to __init__.txt :

*** Settings ***
Suite Setup       setup for all suites to get Nexus versions before tests execution

PS: "setup for all suites to get Nexus versions before tests execution" is a keyword defined in "keyword_resource.txt" which for the moment contains only "Log    Common setup for all Suites"

Please help me.

Laurent Bristiel

unread,
May 16, 2014, 4:04:51 AM5/16/14
to robotframe...@googlegroups.com
Hello,

your stragegy and architecture is all OK.
The setup you want has to be in the __init__.txt file at the main root.
The problem is that when you run pybot Test directory/Suite02.tx your __init__.txt file is not parsed by Robot.
If you want the whole hierarchy of test setup and test teardown to be executed, you should use --suite
so your command line should look like: pybot Test directory --suite Suite02

Explanation is here: http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html#by-test-suite-and-test-case-names
"Using the --suite option is more or less the same as executing only the appropriate test case file or directory. One major benefit is the possibility to select the suite based on its parent suite. The syntax for this is specifying both the parent and child suite names separated with a dot. In this case, the possible setup and teardown of the parent suite are executed."

Hope this helps,
Laurent Bristiel

hanih...@gmail.com

unread,
May 16, 2014, 6:13:26 AM5/16/14
to robotframe...@googlegroups.com
Thank you so much having answering me, but the command you recommended to me is not working. Maybe I write it in a bad way?

pybot CFReleaseValidation --suite Suite02
[ ERROR ] Parsing '--suite' failed: Data source does not exist.

Also:

pybot CFReleaseValidation --suite CFReleaseValidation/Suite02.txt
[ ERROR ] Parsing '--suite' failed: Data source does not exist.

PS: CFReleaseValidation  is my test directory. I usually execute my tests by "pybot CFReleaseValidation/Suite02.txt "

What I'm doing wrong????

hanih...@gmail.com

unread,
May 16, 2014, 8:15:00 AM5/16/14
to robotframe...@googlegroups.com
I finally succeed to run the command after 1 hour of try ;) , it is actually the inverse of what you said :
pybot --suite Suite02  CFReleaseValidation/

which means: pybot --suite [suite_name] [test_directory]

Thank you so much again because the result is exactly what I wanted to do. It's perfect. By the way,
 we started to testing with Robot Framework after one of my colleagues had attended a conference given by you about Robot Framework during last winter
 ;) Itis cool to meet you hear.
Thank again
Hanieh


On Thursday, May 15, 2014 10:56:04 AM UTC+2, hanih...@gmail.com wrote:

Laurent Bristiel

unread,
May 16, 2014, 8:41:00 AM5/16/14
to robotframe...@googlegroups.com
Sorry for the wrong order... I thought it would work anyway.
And I am happy to see that my session motivated you to use Robot Framework.
Come back here if you have other questions.

Cheers,
Laurent
Reply all
Reply to author
Forward
0 new messages