Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-1326

Common Test: empty groups should not fail

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Help Wanted
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: OTP 23
    • Fix Version/s: None
    • Component/s: common_test
    • Labels:
      None

      Description

      Sample code

      -module(example_SUITE).
      -include_lib("stdlib/include/assert.hrl").
      
      -compile(export_all).
      
      all() -> [{group, g1}, {group, g2}].
      
      groups() -> [{g1, [t1]}, {g2, []}].
      
      t1(_Config) ->
        ok.
      

      Current functionality

      ct_run -suite example_SUITE

      At present, running this command will cause ct to fail with error "Invalid reference to group g2 in example_SUITE:all/0"

      Improvement suggestion

      This example should not generate an error. An empty list of tests is a valid list. It could be silently skipped instead.

      Motivation

      If you evaluate [length(X) || X <- [[1, 2], [], [3]]]., you do not expect an error.

      A group could be temporarily empty, and it's inconvenient when tests fail based on that.

        Attachments

          Activity

            People

            Assignee:
            otp_team_ps Team PS
            Reporter:
            threejane Jane Olszewska
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: