vendredi 21 février 2020

Apart from the need to inject 'test' and 'fixture' as globals, does TestCafe really need to compile test code itself?

Just curious from a technical perspective: what is TestCafe doing in the compilation step apart from injecting the test and fixture functionality into the module? How much re-architecting would need to be done to allow the user to pass in tests as real live code, instead of needing there to be a text file of it that TestCafe will pick up and compile. For example:

testcafe
  .createRunner()
  .fixtures([{
    name: "log in",
    beforeEach: setUp,
    tests: [{
      name: "happy path",
      async body(t){
        await t.navigateTo() // ...
      }   
    }]
  }])

I ask this because it's something we've run into at work a handful of times, where we'd like to be able to do things a particular way (run tests according to very specific logic, modify tests at runtime, etc), but this requirement of TestCafe's makes it messier than it might be if you could simply pass in tests as javascript objects.

Aucun commentaire:

Enregistrer un commentaire