Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web runner should execute tests synchronously #211

Closed
chinigo opened this issue Jul 8, 2013 · 1 comment
Closed

Web runner should execute tests synchronously #211

chinigo opened this issue Jul 8, 2013 · 1 comment

Comments

@chinigo
Copy link

chinigo commented Jul 8, 2013

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

@robfig
Copy link
Contributor

robfig commented Jul 11, 2013

Fixed by robfig@af568e3

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants