Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL benchmarking with maven

 
Pavel Kazlou
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I'm using maven 2.2

With it I am able to run code-based tests and get both their success/failure result AND the time of execution in surefire reports. So I can perform a kind of benchmarking for my tests.

Now I'm using maven sql plugin http://mojo.codehaus.org/sql-maven-plugin/
With it I don't have to write any jdbc code and can perform sql queries right from *.sql files. I have a set of queries to create schema, populate tables with data and queries to perform some selects which I want to benchmark. Even though I put sql plugin goal "execute" into "test" phase I don't have any reports being generated, all sql-s are performed without any reports (like they are just used for preparation).

As you may understand there is no java code involved into this test, just plain sql queries. But I want to incorporate database testing into my project, controlled by maven.
So do you know any way to implement time measuring of my sql goals, so I can see that one select query took X seconds and the other Y seconds.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see anything in the properties at http://mojo.codehaus.org/sql-maven-plugin/execute-mojo.html that will give you that information. But it should not be that hard to create a new plugin that extents this plugin and provided the timing information that you want. Or you could modify the plugin directly and submit the changes back to the maven team. Hey, that is what open source is all about.
 
Pavel Kazlou
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Peter.
I think sql plugin is not suited for testing, so I ended up writing test part of my case in classes using jdbc and measuring the time of their execution.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic