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;
BaseTestSuite suite = new BaseTestSuite();
suite.addTest(new ScanCoveredIdxTest("scanAllRows",iterations,repeats));
// To add client tests.
BaseTestSuite client = new BaseTestSuite("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 reportsModifier 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, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeast
assertEquals, 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, toString
private 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 comments
protected void runBareOverridable() throws java.lang.Throwable
runBareOverridable
in class BaseJDBCTestCase
java.lang.Throwable
protected void runTest() throws java.lang.Throwable
runTest
in class junit.framework.TestCase
java.lang.Throwable
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.