Selenium Tests - dynamically generating functions via runtime, which have to be executed afterwards in the same run

Hi guys,

what I want to do is:

Write a Selenium test which:

  • gets some data from a database at first

  • based on the returned objects from database I want to generate an own test case for each row / single object

  • and afterwards all of these functions should run through selenium

The solution I have at the moment is to generate the tests in 1 test function, but this function runs for about 20-40 minutes … so when it crashes … lots of fun looking for the problem :-P.

I know this sounds a bit weird, but this would be the perfect solution for me … never worked with something like that (generating code via runtime, which has to be executed afterwards in the same run).

Thanks for your help in advance,


P.S.: Is it maybe possible to write the generated code in an extra file and afterwards include this file? … but how to solve the error from including a file which doesn’t exist yet :smiley:


my temporary solution for this issue is, that I created 10 functions where each of them handles 10% of the total amount of datasets from the database … but still not the solution I’m looking for.

Maybe anyone has got a better idea?


up … last try :stuck_out_tongue:

Well, since nobody else answered…

Did you try the setUp method for generating data?

Or perhaps something like this (see the PHPUnit manual for examples)

  public function testGenerator()




  * @depends testGenerator


  public function testExec()




Thanks a lot for your reply Tommy - again ;-). I’ll check this out the next days.