TestBase changeTest(int id) { IPTestListJB.TestName t = IPTestListJB.TestName.values()[id]; TestBase tb = IPTestListJB.newTest(t); tb.createBaseTest(this); // setupBars(tb); return tb; }
@Override protected void setUp() throws Exception { super.setUp(); tempDir = getTempDir(); extractTestZip(tempDir, TestBase.TEST_FILES); }
public void setUp() throws Exception { super.setUp(); tj = gls.getJournal("TestJournal"); POSTDATE = Util.parseDateTime("20050103120000"); A = gls.getFinalAccount("TestChart", "111"); B = gls.getFinalAccount("TestChart", "112"); }
@BeforeClass( alwaysRun = true, groups = {Constants.DashboardAPIChecker.DASHBOARD_TEST_CASES_GROUP}) public void initTest() throws Exception { super.init(TestUserMode.SUPER_TENANT_ADMIN); String accessTokenString = "Bearer " + OAuthUtil.getOAuthToken(backendHTTPURL, backendHTTPSURL); this.client = new MDMHttpClient(backendHTTPSURL, Constants.APPLICATION_JSON, accessTokenString); }
@Override public void afterInvocation(IInvokedMethod method, ITestResult result) { Throwable throwable = result.getThrowable(); if (throwable != null) { TestBase.setFailed(throwable.getMessage()); } super.afterInvocation(method, result); if (method.isTestMethod()) { if (!TestBase.getPassed()) { logBusinessScreenshot("Error Occurred!"); } else { if (TestBaseWebDriver.takePassedScreenshot) { logBusinessScreenshot("Test Passed"); } } } }
@BeforeClass( alwaysRun = true, groups = {Constants.LicenseManagement.LICENSE_MANAGEMENT_GROUP}) public void initTest() throws Exception { super.init(TestUserMode.SUPER_TENANT_ADMIN); String accessTokenString = "Bearer " + OAuthUtil.getOAuthToken(backendHTTPSURL, backendHTTPSURL); this.client = new RestClient(backendHTTPSURL, Constants.APPLICATION_JSON, accessTokenString); }
public void afterInvocation(IInvokedMethod method, ITestResult result) { resultT = result; String textMsg = "Completed executing " + returnMethodName(method.getTestMethod()); Reporter.log(textMsg, true); Reporter.setCurrentTestResult(result); if (method.isTestMethod()) { List<Throwable> verificationFailures = TestBase.getVerificationFailures(); // if there are verification failures... if (verificationFailures.size() > 0) { // set the test to failed result.setStatus(ITestResult.FAILURE); // if there is an assertion failure add it to verificationFailures if (result.getThrowable() != null) { verificationFailures.add(result.getThrowable()); } int size = verificationFailures.size(); // if there's only one failure just set that if (size == 1) { result.setThrowable(verificationFailures.get(0)); } else { // create a failure message with all failures and stack traces (except last failure) StringBuffer failureMessage = new StringBuffer("Multiple failures (").append(size).append("):\n\n"); for (int i = 0; i < size - 1; i++) { failureMessage .append("Failure ") .append(i + 1) .append(" of ") .append(size) .append(":\n"); Throwable t = verificationFailures.get(i); String fullStackTrace = Utils.stackTrace(t, false)[1]; failureMessage.append(fullStackTrace).append("\n\n"); } // final failure Throwable last = verificationFailures.get(size - 1); failureMessage.append("Failure ").append(size).append(" of ").append(size).append(":\n"); failureMessage.append(last.toString()); // set merged throwable Throwable merged = new Throwable(failureMessage.toString()); merged.setStackTrace(last.getStackTrace()); result.setThrowable(merged); } } } }
@Before public void setUpTest() throws Exception { // call super setup super.setUp(name.getMethodName()); // also start helloworld DebugBridge.get().runShellCommand("pm clear com.groupon.roboremote.example.helloworld"); DebugBridge.get() .runShellCommand("am start -n com.groupon.roboremote.example.helloworld/.HelloWorld"); }
public void setUp() throws Exception { super.setUp(); tj = gls.getJournal("TestJournal"); cashUS = gls.getFinalAccount("TestChart", "111"); cashPesos = gls.getAccount("TestChart", "112"); bobEquity = gls.getAccount("TestChart", "31"); aliceEquity = gls.getAccount("TestChart", "32"); assets = gls.getAccount("TestChart", "1"); equity = gls.getAccount("TestChart", "3"); root = assets.getRoot(); }
@BeforeClass public void beforeClass() { super.beforeClass(); route = main.tapPurchase(); route.setChildren(childrenNum); train = route.tapFind(); String trainIndex = train.verifyTrainPresent(expectedTrain); car = train.selectCarType(trainIndex, carType); car.selectCar(carNumber); seat = car.selectSeat().hideHint(); passengers = seat.clickPassengerData(); }
public void run() { while (mRun) { // Our loop for launching tests or benchmarks synchronized (this) { // We may have been asked to exit while waiting if (!mRun) return; } if (mBenchmarkMode) { // Loop over the tests we want to benchmark for (int ct = 0; (ct < mTestList.length) && mRun; ct++) { // For reproducibility we wait a short time for any sporadic work // created by the user touching the screen to launch the test to pass. // Also allows for things to settle after the test changes. mRS.finish(); try { sleep(250); } catch (InterruptedException e) { } // If we just ran a test, we destroy it here to relieve some memory pressure if (mTest != null) { mTest.destroy(); } // Select the next test mTest = changeTest(mTestList[ct], false); // If the user selected the "long pause" option, wait if (mTogglePause) { for (int i = 0; (i < 100) && mRun; i++) { try { sleep(100); } catch (InterruptedException e) { } } } // Run the test Result r = getBenchmark(); mTestResults[ct] = r.totalTime / r.iterations * 1000.f; mTestInfo[ct] = r.testInfo; } onBenchmarkFinish(mRun); } else { // Run the kernel runTest(); // Send our RS message handler a message so we know when this work has completed mRS.sendMessage(0, null); } } }
@BeforeMethod public void setUp() { super.setUp(); EntityMemcache mc = new EntityMemcache(null); cads = new CachingAsyncDatastoreService(DatastoreServiceFactory.getAsyncDatastoreService(), mc); nods = new CachingAsyncDatastoreService(new MockAsyncDatastoreService(), mc); key = KeyFactory.createKey("thing", 1); keyInSet = Collections.singleton(key); entity = new Entity(key); entity.setProperty("foo", "bar"); entityInList = Collections.singletonList(entity); }
public void run() { Surface lastSurface = null; while (mRun) { synchronized (this) { try { this.wait(); } catch (InterruptedException e) { } if (!mRun) return; if ((mOutSurface == null) || (mOutPixelsAllocation == null)) { continue; } if (lastSurface != mOutSurface) { mOutDisplayAllocation.setSurface(mOutSurface); lastSurface = mOutSurface; } } if (mBenchmarkMode) { for (int ct = 0; (ct < mTestList.length) && mRun; ct++) { mRS.finish(); try { sleep(250); } catch (InterruptedException e) { } if (mTest != null) { mTest.destroy(); } mTest = changeTest(mTestList[ct]); if (mTogglePause) { for (int i = 0; (i < 100) && mRun; i++) { try { sleep(100); } catch (InterruptedException e) { } } } mTestResults[ct] = getBenchmark(); mHandler.sendMessage(Message.obtain()); } onBenchmarkFinish(mRun); } } }
// Run one loop of kernels for at least the specified minimum time. // The function returns the average time in ms for the test run private Result runBenchmarkLoop(float minTime) { Result r = new Result(); long t = java.lang.System.currentTimeMillis(); r.testInfo = mTest.getTestInfo(); do { // Run the kernel mTest.runTest(); r.iterations++; // Send our RS message handler a message so we know when this work has completed mRS.sendMessage(0, null); long t2 = java.lang.System.currentTimeMillis(); r.totalTime += (t2 - t) / 1000.f; t = t2; } while (r.totalTime < minTime); // Wait for any stray operations to complete and update the final time mRS.finish(); long t2 = java.lang.System.currentTimeMillis(); r.totalTime += (t2 - t) / 1000.f; t = t2; return r; }
public void testBasics() throws IOException { HebrewExactAnalyzer a = TestBase.getHebrewExactAnalyzer(); checkOneTerm(a, "בדיקה", "בדיקה$"); checkOneTerm(a, "בדיקה$", "בדיקה$"); // test non-hebrew checkOneTerm(a, "books", "books$"); checkOneTerm(a, "book", "book$"); checkOneTerm(a, "book$", "book$"); checkOneTerm(a, "steven's", "steven's$"); checkOneTerm(a, "steven\u2019s", "steven's$"); checkOneTerm(a, "3", "3"); // checkOneTerm(a, "steven\uFF07s", "steven"); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.charge_test); tv_chargeinfo = (TextView) findViewById(R.id.chargeinfo); tv_chargerinfo = (TextView) findViewById(R.id.chargerinfo); btn_success = (Button) findViewById(R.id.btn_success); btn_success.setOnClickListener(this); btn_fail = (Button) findViewById(R.id.btn_fail); btn_fail.setOnClickListener(this); ct.initButton(btn_success); myHandler = new Handler(this); }
public void exit() { mRun = false; synchronized (this) { notifyAll(); } try { this.join(); } catch (InterruptedException e) { } if (mTest != null) { mTest.destroy(); mTest = null; } mRS.destroy(); mRS = null; }
private float getBenchmark() { mDoingBenchmark = true; mTest.setupBenchmark(); long result = 0; long runtime = 1000; if (mToggleLong) { runtime = 10000; } if (mToggleDVFS) { mDvfsWar.go(); } // Log.v("rs", "Warming"); long t = java.lang.System.currentTimeMillis() + 250; do { mTest.runTest(); mTest.finish(); } while (t > java.lang.System.currentTimeMillis()); // mHandler.sendMessage(Message.obtain()); // Log.v("rs", "Benchmarking"); int ct = 0; t = java.lang.System.currentTimeMillis(); do { mTest.runTest(); mTest.finish(); ct++; } while ((t + runtime) > java.lang.System.currentTimeMillis()); t = java.lang.System.currentTimeMillis() - t; float ft = (float) t; ft /= ct; mTest.exitBenchmark(); mDoingBenchmark = false; android.util.Log.v("rs", "bench " + ft); return ft; }
void setupBars(TestBase t) { mSpinner.setVisibility(View.VISIBLE); t.onSpinner1Setup(mSpinner); mBar1.setVisibility(View.VISIBLE); mText1.setVisibility(View.VISIBLE); t.onBar1Setup(mBar1, mText1); mBar2.setVisibility(View.VISIBLE); mText2.setVisibility(View.VISIBLE); t.onBar2Setup(mBar2, mText2); mBar3.setVisibility(View.VISIBLE); mText3.setVisibility(View.VISIBLE); t.onBar3Setup(mBar3, mText3); mBar4.setVisibility(View.VISIBLE); mText4.setVisibility(View.VISIBLE); t.onBar4Setup(mBar4, mText4); mBar5.setVisibility(View.VISIBLE); mText5.setVisibility(View.VISIBLE); t.onBar5Setup(mBar5, mText5); }
@Override protected void onDestroy() { super.onDestroy(); }
TestBase changeTest(BlasTestList.TestName t, boolean setupUI) { TestBase tb = BlasTestList.newTest(t); tb.createBaseTest(this); return tb; }
@Override protected void onResume() { super.onResume(); }
@Override protected void onStart() { initAllControl(); super.onStart(); }
@Override protected void onStop() { releaseRec(); super.onStop(); }
@Before @Override public void setUp() { super.setUp(); ads = (AdvancedDatastore) ds; }
// DTD resolution blocked @Test(expected = UncheckedXMLException.class) @Override public void externalEntityRegexp3_DOM() { super.externalEntityRegexp3_DOM(); }
// DTD resolution blocked @Test(expected = UncheckedXMLException.class) @Override public void dtdSystemURL_DOM() { super.dtdSystemURL_DOM(); }
@Override protected void tearDown() throws Exception { super.tearDown(); deleteDir(tempDir); }
void runTest() { mTest.runTest(); }
public void testRandomStrings() throws Exception { checkRandomData(random(), TestBase.getHebrewExactAnalyzer(), 1000 * RANDOM_MULTIPLIER); }