1

これが私のシナリオです:

データベースD1のテーブルT1からデータを読み取り、それを処理して、別のデータベースD2の別のテーブルT2に配置するJavaアプリケーションがあります。これはリアルタイムで発生します。つまり、レコードがテーブルT1に挿入または更新されると、アプリケーションはデータを選択して処理し、宛先テーブルにプッシュします。テスト(できればJUnit)やパフォーマンスフレームワークを使用して、このアプリケーションのパフォーマンスを監視したいと思います。私のテストケースでは、次のようにしたいと思います

  • データベースD1のテーブルT1に、一定の間隔で一定数のレコードを一定の間隔で挿入および更新します。
  • 一定時間後、データベースD2のT2に存在するレコードの数を確認するか、特定のレコードの存在を探します。

私が作成したいテストは

  • データベースにとらわれない
  • 傾向を示し、JenkinsなどのCIツールで構成できる結果を提供する

だから、私の質問は、この種のシナリオをテストするための最良の方法は何ですか?これを達成するのに役立つ利用可能なツールはありますか?

4

1 に答える 1

1

Database agnostic

In order to achieve that I would suggest to use simplest possible SQL and some low-level JDBC abstraction layer:

DBUtils

The Commons DbUtils library is a small set of classes designed to make working with JDBC easier. JDBC resource cleanup code is mundane, error prone work so these classes abstract out all of the cleanup tasks from your code leaving you with what you really wanted to do with JDBC in the first place: query and update data.

MyBatis

MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records.

Both will do the trick for you. With good attention to details you'll manage to provide flexible enough solution and test as many databases as you want.

Provide results that can show trends and be configurable with a CI tool like Jenkins

Define several KPIs and make sure you can get all values periodically. For example you can measure a throughput (records per second). Export data periodically (as CSV or properties for example) and use PlotPlugin for visualization:

enter image description here

You can also check relevant question: How do I plot benchmark data in a Jenkins matrix project

Proper testing

Please make sure your testing strategy is well defined and you will not miss anything:

  1. Load testing
  2. Stress testing
于 2013-02-17T23:07:00.647 に答える