/**
  * {@inheritDoc}
  *
  * @see org.junit.rules.TestWatcher#finished(org.junit.runner.Description)
  */
 @Override
 protected void finished(Description description) {
   log(
       "\n\t<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\tFinished Test [%s.%s]\n\t<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
       testClass.getSimpleName(), methodName);
   super.finished(description);
 }
示例#2
0
  // 失敗したときはスクリーンショットを撮る
  @Override
  protected void failed(Throwable e, Description description) {
    super.failed(e, description);

    System.out.println("失敗!!!");

    //	takeScreenShot(String.format("%s_%s",
    //	description.getClassName(), description.getMethodName()));
  }
    @Override
    protected void finished(final Description description) {
      super.finished(description);

      try {
        for (Liquibase liquibase : liquibaseList) {
          liquibase.rollback(1000, null);
        }
      } catch (Exception e) {
        e.printStackTrace();
        throw new Error(e);
      } finally {
        try {
          conn.close();
        } catch (Exception f) {
        }
      }
    }
  /**
   * Deletes existing screenshots before creating new ones.
   *
   * @see org.junit.rules.TestWatcher#starting(org.junit.runner.Description)
   */
  @Override
  protected void starting(final Description description) {

    if ("on".equals(getPropertyValue("screenshots"))) {

      final TestCase currentTestCase = description.getAnnotation(TestCase.class);

      // if screenshots are enabled, and the output directory already
      // exists, then delete the existing screenshots first.

      final String screenshotDirectory = getPropertyValue("site.resources.output.screenshots");

      final File outputFolder = new File(screenshotDirectory + currentTestCase.id());
      if (outputFolder.exists()) {
        final File[] files = outputFolder.listFiles();
        for (final File file : files) {
          file.delete();
        }
      }
    }

    super.starting(description);
  }
示例#5
0
 @Override
 protected void starting(Description description) {
   super.starting(description);
   className = description.getClassName();
   memWatcher = new MemWatcher();
 }
 /**
  * {@inheritDoc}
  *
  * @see org.junit.rules.TestWatcher#failed(java.lang.Throwable, org.junit.runner.Description)
  */
 @Override
 protected void failed(Throwable e, Description d) {
   System.err.println(
       "\n\t[" + testClass.getSimpleName() + "." + d.getMethodName() + "]  FAILED:   [" + e + "]");
   super.failed(e, d);
 }
示例#7
0
 @Override
 protected void succeeded(Description description) {
   super.succeeded(description);
   System.out.println("成功!!!");
 }