Exemplo n.º 1
0
 public void play(IConsole console) {
   try {
     String scriptText = displayView.getScript();
     if (!validTestCase(scriptText)) {
       reportException(new Exception("No test() function or fixture found in the script"));
       return;
     }
     try {
       playbackStopped = false;
       ddTestRunner = new DDTestRunner(console, scriptText);
     } catch (Exception e) {
       reportException(new Exception(e.getMessage()));
       return;
     }
     if (ddTestRunner.hasNext()) {
       logHeader(console, "Play");
       ddTestRunner.next();
       displayView.startTestRun();
       runTest();
       return;
     }
   } catch (Throwable t) {
     reportException(t);
     destroyRuntime();
     return;
   }
   reportException(new Exception("No test() function or fixture found in the script"));
 }
Exemplo n.º 2
0
 public void record(IConsole console) {
   logHeader(console, "Record");
   String scriptText = displayView.getScript();
   if (!validTestCase(scriptText)) {
     scriptText = getFixtureHeader() + scriptText;
   }
   try {
     createRuntime(scriptText, console, MarathonMode.RECORDING);
     displayView.startInserting();
     runtime.createScript(scriptText, displayView.getFilePath(), false, true);
     recorder = recorderProvider.get();
     startApplicationIfNecessary();
     runtime.startRecording(recorder);
     setState(State.RECORDING);
   } catch (Throwable e) {
     setState(State.STOPPED_WITH_APP_CLOSED);
     destroyRuntime();
     displayView.stopInserting();
     stopApplicationIfNecessary();
     reportException(e);
   }
 }