torourke
torourke

Reputation: 1989

Using @Before for Selenium Tests in Play Framework

I want to set up my database before performing a Selenium test for my program in Play! Framework. However, the only way according to the documentation is simply deleting the database and loading different YML files one by one, when in actuality many different functions are required. It's easy when writing unit and functional tests, all I need is

@Before

public void setup() {
(new asyncjobs.Bootstrap()).doJob();
}

where BootStrap loads all the necessary data. How can I specify this in Selenium?

Upvotes: 0

Views: 844

Answers (1)

mericano1
mericano1

Reputation: 2913

You can load fixtures in selenium tests as well using the fixture tag

#{fixture delete:'all', load:'data.yml' /}

and if that is not enough you can run queries and jobs in the page using the scripting tags

%{    
    (new asyncjobs.Bootstrap()).doJob();
    // or run a query
    models.Person person = models.Person.find('byAddress', '12 foobar street').first()
}%

Upvotes: 2

Related Questions