Skip to content

Commit 11ec381

Browse files
committed
RF 4.0 notes: Explain model changes better
1 parent d38ab3c commit 11ec381

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

doc/releasenotes/rf-4.0rc1.rst

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,61 @@ changes are backwards incompatible:
511511

512512
__ `Argument conversion enhancements`_
513513

514+
Running and result models have been changed
515+
-------------------------------------------
516+
517+
Prior to Robot Framework 4.0 running and result models contained only keywords.
518+
Although FOR loop syntax existed, internally FOR related objects were represented
519+
as special kind of keywords. Introduction of the new IF/ELSE syntax made it clear
520+
that this approach did not work anymore, and separate FOR and IF objects were
521+
introduced. At the same time, some other changes were done to make these models
522+
easier to use externally.
523+
524+
These changes do not affect normal Robot Framework usage at all, but tools using
525+
the running and result models are likely to be affected. These include tools
526+
modifying tests before execution (using e.g. pre-run modifier or listeners) as
527+
well as tools inspecting and especially modifying results. Changes most likely
528+
to cause problems are listed below and issue `#3749`_ contains more details:
529+
530+
- `TestSuite`, `TestCase` and `Keyword` objects used to have `keywords` attribute
531+
containing keywords used in them. This name is misleading now when they also
532+
have FOR and IF objects. With `TestCase` and `Keyword` the attribute was
533+
renamed to `body` and with `TestSuite` it was removed altogether. The `keywords`
534+
attribute still exists but it is read-only and deprecated.
535+
536+
- The new `body` does not have `create()` method for creating keywords, like the old
537+
`keywords` had, but instead it has separate `create_keyword()`, `create_for()` and
538+
`create_if()` methods. This means that old usages like `test.keywords.create()`
539+
need to be changed to `test.body.create_keyword()`.
540+
541+
- `TestSuite` and `TestCase` object nowadays have `setup` and `teardown` directly
542+
when earlier they needed to be accessed via `keywords`. This means that, for
543+
example, suite setup is accessed like `suite.setup` instead of `suite.keywords.setup`.
544+
545+
- `setup` and `teardown` are never `None` like they earlier could be. Instead they
546+
are always represented as `Keyword` objects that are just considered inactive
547+
(and untrue) when not set. They can be activated by setting `name` and other needed
548+
attributes either independently or by calling the `config()` method. If they
549+
need to be disabled, the easiest solution is setting them to `None` like
550+
`test.setup = None` which will automatically recreate an inactive setup (or
551+
teardown) object.
552+
553+
- Result side got separate `For` and `If` objects instead of using `Keyword` with
554+
`type` attribute separating normal keywords from other structures. For backwards
555+
compatibility reasons the new objects still have `Keyword` specific attributes
556+
like `args`.
557+
558+
- On the running side `For` and `If` objects do not anymore extend `Keyword`.
559+
560+
- Earlier result side `Keyword` had `messages` and `keywords` separately, but
561+
nowadays also messages are stored in `body` along with executed keywords as
562+
well as FOR and IF objects. The old `messages` is preserved as a property
563+
getting messages from `body`.
564+
565+
- Visitor interface has got separate entry points for visiting FOR loops and
566+
IF/ELSE structures. Nowadays `visit_keyword()`, `start_keyword()` and
567+
`end_keyword()` are called only with actual keyword objects.
568+
514569
Generated output.xml has been changed
515570
-------------------------------------
516571

@@ -573,7 +628,6 @@ Other backwards incompatible changes
573628
- Python 3.4 is not anymore supported. (`#3577`_)
574629
- Keyword types passed to listeners have changed. (`#3851`_)
575630
- Parsing model has been changed slightly. (`#3776`_)
576-
- Result and running models have been changed (`#3749`_)
577631
- Space after a literal newline is not ignored anymore. (`#3746`_)
578632
- Small changes to importing listeners and model modifiers from the command line. (`#3809`_)
579633
- Deprecated `ConnectionCache._resolve_alias_or_index` method has been removed. (`#3858`_)

0 commit comments

Comments
 (0)