Uploaded image for project: 'Fluid Infusion'
  1. Fluid Infusion
  2. FLUID-6100

It's inconvenient to not be able to use IoC expressions in a "modules" block of a testCaseHolder

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: IoC Testing Framework
    • Labels:
      None

      Description

      At the moment, fluid.test.testCaseHolder declares a mergePolicy of "noexpand" for its "modules" option. Presumably this is because it operates its own custom (late) lifecycle for the contents of the "modules" structure, but it also means that seemingly-innocent IoC expressions fail to work. As a user from the outside, this seems confusingly inconsistent with most other components where IoC expressions can be used freely anywhere within an options structure. If nothing else, this might suggest a documentation opportunity where we could establish a convention for marking regions of a components options that have special mergePolicies.

      Here are a couple of examples of things I tried while learning the IoC Testing framework, which didn't work:

      fluid.defaults("flock.test.lessPointyTester", {
          gradeNames: "fluid.test.testCaseHolder,
      
          testSequence: [
              {
                  func: "QUnit.ok",
                  args: [true]
              }
          ],
      
          modules: [
              {
                  name: "A module",
                  tests: [
                      {
                           name: "Some test",
                           expect: 1,
                           // This fails because the testing framework tries to iterate over the raw string
                           // as if it were an array of sequence specifications.
                           sequence: "{that}.options.testSequence" 
                      }
                  ]
              }
          ]
      });
      
          fluid.defaults("flock.test.bus.tester", {
              gradeNames: "fluid.test.testCaseHolder",
      
              modules: [
                  {
                      // Here, obviously, when I use this a base grade all my modules end up
                      // with the name of the literal string "{that}.options.moduleName"
                      name: "{that}.options.moduleName",
                      tests: [
                          {
                              name: "Acquire too many buses",
                              expect: 3,
                              sequence: [
                                  {
                                      funcName: "flock.test.bus.runTests",
                                      args: [
                                          "{environment}",
                                          "{that}.options.busType",
                                          "{that}.options.numBusesToAcquire",
                                          "{that}.expectedBusIndex"
                                      ]
                                  }
                              ]
                          }
                      ]
                  }
              ],
      
              invokers: {
                  expectedBusIndex: {
                      funcName: "fluid.notImplemented"
                  }
              }
          });
      

        Attachments

          Activity

            People

            Assignee:
            antranig Antranig Basman
            Reporter:
            colin Colin Clark
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: