Beispiel #1
0
  @BeforeClass(alwaysRun = true)
  public void initTC() throws Exception {
    if (testSuite == null) {
      initTestSuiteParameter();
    }
    LOGGER.info("............................INITIALIZE TEST-CASE with {}", initParameter);
    String testCaseName = this.getClass().getSimpleName();
    initParameter = getTestCaseInitParameter();
    if (initParameter == null) {
      throw new SakuliException("init parameter have to be set!");
    }
    testSuite = BeanLoader.loadBean(TestSuite.class);

    // start sahi controlled browser if needed
    initSahiBrowser();

    testSuite.addTestCase(new TestCaseBuilder(testCaseName, initParameter.getTestCaseId()).build());
    testCaseAction = BeanLoader.loadTestCaseAction();

    // add the the testcase folder as image folder
    if (Files.exists(getTestCaseFolder())) {
      initParameter.addImagePath(getTestCaseFolder().toString());
    }
    initTestCaseAction(initParameter);
    LOGGER.info(
        "............................START TEST-CASE '{}' - {}",
        initParameter.getTestCaseId(),
        testCaseName);
    counter = 0;
    startTimeCase = DateTime.now();
  }
Beispiel #2
0
 @AfterClass(alwaysRun = true)
 public void stopTC() throws Exception {
   if (executorService != null) {
     executorService.awaitTermination(1, TimeUnit.MILLISECONDS);
   }
   String testCaseName = this.getClass().getSimpleName();
   LOGGER.info(
       "............................ SAVE RESULTS OF TEST-CASE '{}' - {}",
       initParameter.getTestCaseId(),
       testCaseName);
   testCaseAction.saveResult(
       initParameter.getTestCaseId(),
       String.valueOf(startTimeCase.getMillis()),
       String.valueOf(DateTime.now().getMillis()),
       null,
       null);
   if (browser != null) {
     browser.close();
   }
 }