Skip to content

Web runner should execute tests synchronously #211

@chinigo

Description

@chinigo

I have a bunch of request-to-response integration tests that clear the database, insert fixture data, and make assertions.

It appears that the web runner fires off a request for each test simultaneously. The CLI test runner executes tests sequentially (at least on my setup, which defaults GOMAXPROCS to 1). Here's a simple example to illustrate this behavior:

func (t *IntegrationTest) Before() {
  fmt.Println("Setting up")
  // Reset database by truncating tables
  // Insert some fixture data
}

func (t *IntegrationTest) TestIntegrationTestOne() {
  println("Running test one")
  // Make request
  // Make assertion against response output
}

func (t *IntegrationTest) TestIntegrationTestTwo() {
  println("Running test two")
  // Make request
  // Make assertion against response output
}

Output with CLI invocation:

$ revel test testapp
Setting up
Running test one
Setting up
Running test two

Output with web runner invocation:

Setting up
Setting up
Running test one
Running test two

It looks like the relevant code is in the runner, where the button[all-tests] handler triggers a click event on each button[test] element simultaneously.

I expected the web runner to behave in the same way as the CLI runner, but with this setup I immediately have to address all the problems that come with parallel execution of tests that depend on a shared resource (i.e. the database). Using a queuing mechanism to manage the AJAX requests would accomplish this.

Thanks,
~@chinigo & @rupurt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions