public class JDBCPerfTestCase extends BaseJDBCTestCase
// Add a test fixture 'scanAllRows' in ScanCoveredIdxTest
// and to run this test for 100 iterations and to
// repeat the test 4 times.
int iterations = 100;
int repeats = 4;
TestSuite suite = new TestSuite();
suite.addTest(new ScanCoveredIdxTest("scanAllRows",iterations,repeats));
// To add client tests.
TestSuite client = new TestSuite("Client");
client.addTest(new ScanCoveredIdxTest("scanAllRows",iterations,repeats));
client.addTest(new ScanCoveredIdxTest("scanAndRetrieveAllRows",iterations,repeats));
// This will add the server decorator that will start the
// server on setUp of the suite and stop server on tearDown
// of the suite.
suite.addTest(TestConfiguration.clientServerDecorator(client));
Some improvement areas/ideas:
-- Can we use TestResult ,and our own TestRunner to improve on how the
results are reported.
-- write the perf results to a file that can be easily consumed for reporting purposes
and further analysis against different builds.
-- Maybe even write the results out in xml format,and then using xsl the results
could be rendered into html reports| Modifier and Type | Field and Description |
|---|---|
private long |
endTime
store timing information
|
private int |
iterations
Store info on how many times the test fixture should be run
also see runTest() on how iterations is used
|
private int |
repeats
Store info on how many times should the test be repeated
default value is 1
|
private long[] |
runs
store the elapsed time info for the test runs.
|
private long |
startTime
store timing information
|
private int |
testRunNum
Hold the elapsedtime info for the testRun
given by testRunNum
|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE| Constructor and Description |
|---|
JDBCPerfTestCase(java.lang.String name) |
JDBCPerfTestCase(java.lang.String name,
int iterations,
int repeats) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
runBareOverridable()
runBare, do the whole thing - setup, runTest, cleanup
'repeats' times.
|
protected void |
runTest()
Overrides runTest from TestCase, in order to gather
elapsed time information.
|
assertCallError, assertCheckTable, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, emptyStatementCache, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbeddedalarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isJava8, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemProperty, sleep, sleepAtLeastOneTick, traceitassertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, setName, setUp, toStringprivate long startTime
private long endTime
private int iterations
private int repeats
private int testRunNum
private long[] runs
public JDBCPerfTestCase(java.lang.String name)
public JDBCPerfTestCase(java.lang.String name,
int iterations,
int repeats)
name - testnameiterations - iterations of the test to measure at one shot.repeats - is the number of times the entire test be repeatedclass level commentsprotected void runBareOverridable()
throws java.lang.Throwable
runBareOverridable in class BaseJDBCTestCasejava.lang.Throwableprotected void runTest()
throws java.lang.Throwable
runTest in class junit.framework.TestCasejava.lang.ThrowableApache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.