robotframework / robotframework

Generic automation framework for acceptance testing and RPA
http://robotframework.org
Apache License 2.0
9.78k stars 2.33k forks source link

Default Tags, Test Setup, Test Teardown and Test Timeout do not work properly in __init__ files #152

Closed spooning closed 10 years ago

spooning commented 10 years ago

Originally submitted to Google Code by @jrantanen on 19 Nov 2008

When above settings are defined in the init file and again in suite file, every second test gets the value from init file even it should always get the value from suite file.

spooning commented 10 years ago

Originally submitted to Google Code by @pekkaklarck on 19 Nov 2008

This is the weirdest bug ever. Juha, will you take a look at this yourself?

How important it actually is that we allow these settings in init files in the first place? Should we remove them in 2.1?

spooning commented 10 years ago

Originally submitted to Google Code by @pekkaklarck on 19 Nov 2008

The problem is caused by test suite parent data passed to test cases in a list without copying it. Tests then say data.reverse later and thus alter the original list. Simple fix is below, but there's room for some more refactoring related to this.

# Index: src/robot/running/model.py

--- src/robot/running/model.py  (<a href="https://code.google.com/p/robotframework/source/detail?r=995">revision 995</a>)
+++ src/robot/running/model.py  (working copy)
@&#8288;@&#8288; -48,7 +48,7 @&#8288;@&#8288;
         self.teardown = utils.get_not_none(suitedata.suite_teardown, [])
         self.suites = [ RunnableTestSuite(suite, parentdatas) 
                         for suite in suitedata.suites ]
-        self.tests = [ RunnableTestCase(test, parentdatas) 
-        self.tests = [ RunnableTestCase(test, parentdatas[:]) 
                      for test in suitedata.tests ]
       if self.name == '':   # suitedata was multisource suite
           self.name = ' &amp; '.join([suite.name for suite in self.suites])
spooning commented 10 years ago

Originally submitted to Google Code by @jrantanen on 19 Nov 2008

See r996 for fix and r997 for test changes.

Review needed.

spooning commented 10 years ago

Originally submitted to Google Code by @jrantanen on 19 Nov 2008

Made still some refactoring based on the review. See r1003 for final version.

spooning commented 10 years ago

Originally submitted to Google Code by @jrantanen on 16 Mar 2011

This issue was closed by revision 2ac61cc82dfe.

spooning commented 10 years ago

Originally submitted to Google Code by @pekkaklarck on 16 Mar 2011

Issue state was accidentally modified by commit messages during Mercurial transition.