Run same test with multiple values - Dart

Viewed 176

I need to run a test with different values, and in C# I would something like this

        [Theory]
        [InlineData("hello")]
        [InlineData("world")]
        public void my_test(string value)
        {
            var myClass = MyClass(value);
            //Assert...
        }

but in Dart I need to do:

    test('MyTest', () {
      var myClass1 = MyClass('hello');
      var myClass2 = MyClass('word');
      //Assert ...
    });

which seems like a little too verbose, I know I could do something like

      var values = ['hello', 'world'];
      values.forEach((value) { /* run test here*/});

but does not seem reliable either.

Is there any other way to run a single test with difference values in Dart?

0 Answers
Related