Robot Framework Integrated Development Environment (RIDE)
testcase.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 from robotide.lib.robot.utils import setter
17 
18 from .itemlist import ItemList
19 from .keyword import Keyword, Keywords
20 from .modelobject import ModelObject
21 from .tags import Tags
22 
23 
24 
30  __slots__ = ['parent', 'name', 'doc', 'timeout']
31  keyword_class = Keyword #: Internal usage only
32 
33  def __init__(self, name='', doc='', tags=None, timeout=None):
34  self.parentparent = None #: Parent suite.
35  self.namename = name #: Test case name.
36  self.docdoc = doc #: Test case documentation.
37  self.timeouttimeout = timeout #: Test case timeout.
38  self.tagstagstags = tags
39  self.keywordskeywordskeywords = None
40 
41  @setter
42 
43  def tags(self, tags):
44  return Tags(tags)
45 
46  @setter
47 
51  def keywords(self, keywords):
52  return Keywords(self.keyword_classkeyword_class, self, keywords)
53 
54  @property
55 
60  id = property
61 
62  def id(self):
63  if not self.parentparent:
64  return 't1'
65  return '%s-t%d' % (self.parentparent.id, self.parentparent.tests.index(self)+1)
66 
67  @property
68 
69  longname = property
70 
71  def longname(self):
72  if not self.parentparent:
73  return self.namename
74  return '%s.%s' % (self.parentparent.longname, self.namename)
75 
76 
77  def visit(self, visitor):
78  visitor.visit_test(self)
79 
80 
82  __slots__ = []
83 
84  def __init__(self, test_class=TestCase, parent=None, tests=None):
85  ItemList.__init__(self, test_class, {'parent': parent}, tests)
86 
87  def _check_type_and_set_attrs(self, *tests):
88  tests = ItemList._check_type_and_set_attrs(self, *tests)
89  for test in tests:
90  for visitor in test.parent._visitors:
91  test.visit(visitor)
92  return tests
A list-like object representing keywords in a suite, a test or a keyword.
Definition: keyword.py:135
Base model for a single test case.
Definition: testcase.py:29
longname
Test name prefixed with the long name of the parent suite.
Definition: testcase.py:69
def tags(self, tags)
Test tags as a :class:~.model.tags.Tags object.
Definition: testcase.py:43
def __init__(self, name='', doc='', tags=None, timeout=None)
Definition: testcase.py:33
def visit(self, visitor)
:mod:Visitor interface <robot.model.visitor> entry-point.
Definition: testcase.py:77
id
Test case id in format like s1-t3.
Definition: testcase.py:60
def keywords(self, keywords)
Keywords as a :class:~.Keywords object.
Definition: testcase.py:51
def __init__(self, test_class=TestCase, parent=None, tests=None)
Definition: testcase.py:84