Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-121556

As a user of QTestLib, I'd like to use Catch2-style hierarchical SCENARIO/GIVEN/WHEN/THEN tests

    XMLWordPrintable

Details

    • User Story
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • None
    • Testing: qtestlib
    • None

    Description

      In Catch2, I can share common setup code like this:

      SCENARIO("....") {
          ~~~ setup ~~~~
          GIVEN(".....") {
               ~~~ setup ~~~~
               WHEN("....") {
                   ~~~~ action ~~~~
                   THEN("....") {
                       ~~~~ checks ~~~~
                    }
                }
                ~~~ more WHEN ~~~~
          }
          ~~~~ more GIVEN ~~~~
      }
      ~~~~ more SCENARIOs ~~~~
      

      I'd like to do the same with QTestLib instead of having to write JUnit-like test functions.

      Like in Catch2, these dynamic section should not only be used in error reporting, but also in test subset selection.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              cnn Qt Core & Network
              mmutz Marc Mutz
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes