@Override public void setUp() throws Exception { mTestInstance = new BluetoothStressTest() { @Override void reportMetrics( ITestInvocationListener l, TestInfo test, Map<String, String> metrics) { mReportedTestInfo = test; mReportedMetrics = metrics; } }; mScanInfo = new TestInfo(); mScanInfo.mTestName = "scan"; mScanInfo.mTestMethod = "testScan"; mScanInfo.mIterCount = 1; mScanInfo.mPerfMetrics.add("startScan"); mScanInfo.mPerfMetrics.add("stopScan"); }
private void setupTests() { if (mTestCases != null) { // assume already set up return; } // Allocate enough space for all of the TestInfo instances below mTestCases = new ArrayList<TestInfo>(12); TestInfo t = new TestInfo(); t.mTestName = "discoverable"; t.mTestMethod = "testDiscoverable"; t.mIterKey = "discoverable_iterations"; t.mIterCount = mDiscoverableIterations; t.mPerfMetrics.add("discoverable"); t.mPerfMetrics.add("undiscoverable"); mTestCases.add(t); t = new TestInfo(); t.mTestName = "enable"; t.mTestMethod = "testEnable"; t.mIterKey = "enable_iterations"; t.mIterCount = mEnableIterations; t.mPerfMetrics.add("enable"); t.mPerfMetrics.add("disable"); mTestCases.add(t); t = new TestInfo(); t.mTestName = "scan"; t.mTestMethod = "testScan"; t.mIterKey = "scan_iterations"; t.mIterCount = mScanIterations; t.mPerfMetrics.add("startScan"); t.mPerfMetrics.add("stopScan"); mTestCases.add(t); t = new TestInfo(); t.mTestName = "enable_pan"; t.mTestMethod = "testEnablePan"; t.mIterKey = "enable_pan_iterations"; t.mIterCount = mEnablePanIterations; t.mPerfMetrics.add("enablePan"); t.mPerfMetrics.add("disablePan"); mTestCases.add(t); // Remote device tests t = new TestInfo(); t.mTestName = "pair"; t.mTestMethod = "testPair"; t.mIterKey = "pair_iterations"; t.mIterCount = mPairIterations; t.mPerfMetrics.add("pair"); t.mPerfMetrics.add("unpair"); t.mRemoteAddress = mDeviceAddress; t.mPairPin = mDevicePairPin; t.mPairPasskey = mDevicePairPasskey; t.mInstructions = String.format( "Start the testAcceptPair instrumentation on the remote " + "Android device with the following command:\n\n%s\n\nHit Enter when done.", String.format( INSTRUCTIONS_INSTRUMENT_CMD, mDeviceSerial, mLocalAddress, "pair_iterations", mPairIterations, mTestClassName, "testAcceptPair", mTestPackageName, TEST_RUNNER_NAME)); mTestCases.add(t); t = new TestInfo(); t.mTestName = "accept_pair"; t.mTestMethod = "testAcceptPair"; t.mIterKey = "pair_iterations"; t.mIterCount = mAcceptPairIterations; t.mPerfMetrics.add("acceptPair"); t.mPerfMetrics.add("unpair"); t.mRemoteAddress = mDeviceAddress; t.mPairPin = mDevicePairPin; t.mPairPasskey = mDevicePairPasskey; t.mInstructions = String.format( "Start the testPair instrumentation on the remote " + "Android device with the following command:\n\n%s\n\nHit Enter when done.", String.format( INSTRUCTIONS_INSTRUMENT_CMD, mDeviceSerial, mLocalAddress, "pair_iterations", mAcceptPairIterations, mTestClassName, "testPair", mTestPackageName, TEST_RUNNER_NAME)); mTestCases.add(t); t = new TestInfo(); t.mTestName = "connect_headset"; t.mTestMethod = "testConnectHeadset"; t.mIterKey = "connect_headset_iterations"; t.mIterCount = mConnectHeadsetIterations; t.mPerfMetrics.add("connectHeadset"); t.mPerfMetrics.add("disconnectHeadset"); t.mRemoteAddress = mHeadsetAddress; t.mPairPin = mHeadsetPairPin; t.mPairPasskey = mHeadsetPairPasskey; t.mInstructions = "Put the remote headset device in pairing mode. Hit Enter when done."; mTestCases.add(t); t = new TestInfo(); t.mTestName = "connect_a2dp"; t.mTestMethod = "testConnectA2dp"; t.mIterKey = "connect_a2dp_iterations"; t.mIterCount = mConnectA2dpIterations; t.mPerfMetrics.add("connectA2dp"); t.mPerfMetrics.add("disconnectA2dp"); t.mRemoteAddress = mA2dpAddress; t.mPairPin = mA2dpPairPin; t.mPairPasskey = mA2dpPairPasskey; t.mInstructions = "Put the remote A2DP device in pairing mode. Hit Enter when done."; mTestCases.add(t); t = new TestInfo(); t.mTestName = "connect_input"; t.mTestMethod = "testConnectInput"; t.mIterKey = "connect_input_iterations"; t.mIterCount = mConnectInputIterations; t.mPerfMetrics.add("connectInput"); t.mPerfMetrics.add("disconnectInput"); t.mRemoteAddress = mInputAddress; t.mPairPin = mInputPairPin; t.mPairPasskey = mInputPairPasskey; t.mInstructions = "Put the remote input device in pairing mode. Hit Enter when done."; mTestCases.add(t); t = new TestInfo(); t.mTestName = "connect_pan"; t.mTestMethod = "testConnectPan"; t.mIterKey = "connect_pan_iterations"; t.mIterCount = mConnectPanIterations; t.mPerfMetrics.add("connectPan"); t.mPerfMetrics.add("disconnectPan"); t.mRemoteAddress = mDeviceAddress; t.mPairPin = mDevicePairPin; t.mPairPasskey = mDevicePairPasskey; t.mInstructions = String.format( "Start the testIncomingPanConnection instrumentation on " + "the remote Android device with the following command:\n\n%s\n\nHit Enter when " + "done.", String.format( INSTRUCTIONS_INSTRUMENT_CMD, mDeviceSerial, mLocalAddress, "connect_pan_iterations", mConnectPanIterations, mTestClassName, "testIncomingPanConnection", mTestPackageName, TEST_RUNNER_NAME)); mTestCases.add(t); t = new TestInfo(); t.mTestName = "incoming_pan_connection"; t.mTestMethod = "testIncomingPanConnection"; t.mIterKey = "connect_pan_iterations"; t.mIterCount = mIncomingPanConnectionIterations; t.mPerfMetrics.add("incomingPanConnection"); t.mPerfMetrics.add("incomingPanDisconnection"); t.mRemoteAddress = mDeviceAddress; t.mPairPin = mDevicePairPin; t.mPairPasskey = mDevicePairPasskey; t.mInstructions = ("Start the testConnectPan instrumentation on the remote Android " + "device. Hit Enter when done."); t.mInstructions = String.format( "Start the testConnectPan instrumentation on the remote " + "Android device with the following command:\n\n%s\n\nHit Enter when done.", String.format( INSTRUCTIONS_INSTRUMENT_CMD, mDeviceSerial, mLocalAddress, "connect_pan_iterations", mIncomingPanConnectionIterations, mTestClassName, "testConnectPan", mTestPackageName, TEST_RUNNER_NAME)); mTestCases.add(t); t = new TestInfo(); t.mTestName = "start_stop_sco"; t.mTestMethod = "testStartStopSco"; t.mIterKey = "start_stop_sco_iterations"; t.mIterCount = mStartStopScoIterations; t.mPerfMetrics.add("startSco"); t.mPerfMetrics.add("stopSco"); t.mRemoteAddress = mHeadsetAddress; t.mPairPin = mHeadsetPairPin; t.mPairPasskey = mHeadsetPairPasskey; t.mInstructions = "Put the remote headset device in pairing mode. Hit Enter when done."; mTestCases.add(t); }