0

I have a webapp that recently started to show slowness even when the homepage is loaded in the browser.

Since I'm using Maven to manage it, I thought I could add some simple test to check the load time of the homepage or of a specific page — I never wrote one, so I don't know if this is feasible.

I don't need anything fancy, just something that says: "if load time is greater than X seconds, signal it" (i.e. stop the build process); that way I will be alerted that a recent change is making things worse, so I do not discover them too late.

Is this even possible with the current available tools and / or plugins? What should I look for?

A CI server is not available at this time, so I can only rely on anything that can be automated by Maven.

Beside suggestions about what tool to use to perform the tests, I need help making the test run automatically in my Maven setup (i.e. they should run when I call mvn clean package or some other goal and stop the build if a problem is detected).

watery
  • 5,026
  • 9
  • 52
  • 92
  • This sounds like a job for JMeter. Integrating into a Maven build probably isn't going to be practical; instead, I recommend using a CI server such as Jenkins or Bamboo to run promotion tests after the build. – chrylis -cautiouslyoptimistic- Sep 08 '14 at 07:47
  • @chrylis A CI server is not (yet) available, that's why I need the tests to be at least automatically run by Maven. I'll edit my question. – watery Sep 08 '14 at 08:30
  • If you're not actually deploying the application into a staging area, there's no practical way to measure those performance characteristics. – chrylis -cautiouslyoptimistic- Sep 08 '14 at 12:43
  • @chrylis Yep, I'm starting to figure that out... in fact, even response times are significantly different. – watery Sep 08 '14 at 15:58

1 Answers1

1

You can use Selenium to perform web tests, configuring it to timeout if some part of the web page is not loaded in the specified time

....
WebDriverWait wait = new WebDriverWait(webDriver, 5);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("myxpath")));
....

You can also use JMeter to perform load testing.

Romski
  • 1,912
  • 1
  • 12
  • 27
  • Interesting. But I need guidance on how to integrate it in my Maven build too. I'll edit the question to make it more clear. – watery Sep 08 '14 at 07:46
  • Just make the calls to Selenium from a JUnit class and it will get run as part of your test phase in Maven. The JMeter website has an example of writing JUnit tests – Romski Sep 08 '14 at 07:48
  • I've started looking at Selenium, and it looks very interesting. Thank you for the suggestion. – watery Sep 26 '14 at 08:23