# Functional style
node.add_variable(home,'COURSE') # c++ style
node.add_limit('limitX',10) # c++ style
# Using add(), and Attribute constructors
node.add(Edit(home=COURSE), # Notice that add() allows you adjust the indentation
Limit('limitX',10)) # node.add(<attributes>)
# in place. When create a Node, attributes are
# additional arguments
node = Family('t1', # Add attributes on node creation Task(name,<attributes>), Family(name,Node | <attributes>), Suite(name,Node | <attributes>)
Edit(home=COURSE), # This also allows you adjust indentation to show the structure
Limit('limitX',10),
Task('t1'))
# Using <node> += <attribute> adding a single attribute
node += Edit(home=COURSE)
# Using <node> += [ <attributes> ], add multiple attributes, use list to add multiple attributes
node += [ Edit(home=COURSE), Limit('limitX',10), Event(1) ]
# Using node + <attributes> - A node container(suite | family) must appear on the left hand side. Use brackets to control scope.
node + Edit(home=COURSE) + Limit('limitX',10)
# In this example, variable 'name' is added to suite 's/ and not task 't3'
suite = Suite("s") + Family("f") + Family("f2") + Task("t3") + Edit(name="value")
suite s
edit name 'value'
family f
endfamily
family f2
endfamily
task t3
endsuite
# here we use parentheis to control where the varaible get added
suite = Suite("s") + Family("f") + Family("f2") + (Task("t3") + Edit(name="value"))
suite s
family f
endfamily
family f2
endfamily
task t3
edit name 'value'
endsuite |