java.lang.Object
junit.framework.Assert
junit.framework.TestCase
performance.SpeedTest
- All Implemented Interfaces:
- junit.framework.Test
- public class SpeedTest
- extends junit.framework.TestCase
Junit test to measure some simple performance statistics.
It times a number of iterations of getPort, createOperation,
and executeRequestResponseOperation for each provider. The
results are stored in a properties file to allow each run
to test if the performance has changed since the last run.
The number of iterations to do is determined by the time
each test takes and the TIME_PER_TEST constant. You need
to run it atleast 3 times to get the iterations calculation
to settle on a good value; The MARGIN_OF_ERROR constant
defines how mush variation between run times is ignored
when determining if the performance has changed.
You may need to change the TIME_PER_TEST and MARGIN_OF_ERROR
constants for your machine speed.
For testing you can add futher timing points to the internal
WSIF classes which this test will then monitor and report on.
For example, to time the axis provider invoke method, at the
start of the invoke method add:
Monitor.start( "axisInvoke" );
followed by a stop call at the end of the invoke method:
Monitor.stop( "axisInvoke" );
Monitor points can be paused around unwanted code. For example
with the above monitors in the invoke method, you could exclude
the SOAP call time with:
Monitor.pause( "axisInvoke" );
resp = call.invoke(locationUri, getSoapActionURI());
Monitor.resume( "axisInvoke" );
| Fields inherited from class junit.framework.TestCase |
|
| Methods inherited from class junit.framework.Assert |
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, fail, fail |
TIME_PER_TEST
static final float TIME_PER_TEST
- See Also:
- Constant Field Values
MARGIN_OF_ERROR
static final float MARGIN_OF_ERROR
- See Also:
- Constant Field Values
UPDATE_STATS
static final boolean UPDATE_STATS
- See Also:
- Constant Field Values
propFile
static final java.io.File propFile
DEFAULT_ITERATIONS
static final int DEFAULT_ITERATIONS
- See Also:
- Constant Field Values
TEST_GETPORT
static final boolean TEST_GETPORT
- See Also:
- Constant Field Values
TEST_CREATEOP
static final boolean TEST_CREATEOP
- See Also:
- Constant Field Values
TEST_EXECOP
static final boolean TEST_EXECOP
- See Also:
- Constant Field Values
stats
static java.util.Properties stats
newStats
static java.util.Properties newStats
wsdlLocation
static final java.lang.String wsdlLocation
SpeedTest
public SpeedTest(java.lang.String name)
main
public static void main(java.lang.String[] args)
suite
public static junit.framework.Test suite()
setUp
public void setUp()
- Description copied from class:
junit.framework.TestCase
- Sets up the fixture, for example, open a network connection.
This method is called before a test is executed.
testJava
public void testJava()
doit
private void doit(java.lang.String portName,
java.lang.String protocol)
testResults
private boolean testResults()
getIterations
private int getIterations(java.lang.String testName)
setIterations
private void setIterations(java.lang.String prefix)
getintStat
private int getintStat(java.lang.String name)
getfloatStat
private float getfloatStat(java.lang.String name)
getStats
private static java.util.Properties getStats()
mergeNewStats
private static void mergeNewStats()
loadStatsFromFile
private static void loadStatsFromFile()
saveStatsToFile
private static void saveStatsToFile()