public void executeTest() { Object selected = form.getSelection(); Test test = selected instanceof Scenario ? ((Scenario) selected).getParent() : (Test) selected; if (test == null) { form.displayErrorMessage(L.get("ui.error.no_test_selected")); } else if (!test.isValid()) { form.displayErrorMessage(L.get("ui.error.test_not_valid")); } else { executor.execute(test); } }
public void moveScenario(int delta) { Object selected = form.getSelection(); if (!(selected instanceof Scenario)) form.displayErrorMessage(L.get("ui.error.no_scenario_selected")); else { Scenario scenario = (Scenario) selected; scenario.moveBy(delta); form.selectElement(scenario); } }
public void openTests(File file) throws DataException { form.setTitle(L.get("ui.title.file", file.getName())); currentFile = file.getAbsolutePath(); try { InputStream in = new BufferedInputStream(new FileInputStream(currentFile)); try { form.resetEditor(); tests.clear(); reader.read(in, tests, actions); form.selectionChanged(); } finally { in.close(); } } catch (IOException e) { throw new DataException(e); } }
public void saveTests() throws DataException { if (currentFile == null) { File file = form.showSaveDialog(); if (file == null) return; form.setTitle(L.get("ui.title.file", file.getName())); currentFile = file.toString(); } try { OutputStream out = new BufferedOutputStream(new FileOutputStream(currentFile)); try { writer.write(out, tests); } finally { out.close(); } } catch (IOException e) { throw new DataException(e); } }
public void createTest() { form.editElementName(tests.add(new Test(L.get("ui.default_test_title")))); }
public void newTests() { currentFile = null; form.setTitle(L.get("ui.title")); tests.clear(); form.selectionChanged(); }
public void createAction(Schema action) { Object selected = form.getSelection(); Test test = selected instanceof Scenario ? ((Scenario) selected).getParent() : (Test) selected; if (test == null) form.displayErrorMessage(L.get("ui.error.no_test_selected")); else form.editElementName(test.add(new Scenario(action))); }