gpt4 book ai didi

org.mozilla.zest.impl.ZestBasicRunner.run()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:35:48 26 4
gpt4 key购买 nike

本文整理了Java中org.mozilla.zest.impl.ZestBasicRunner.run()方法的一些代码示例,展示了ZestBasicRunner.run()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestBasicRunner.run()方法的具体详情如下:
包路径:org.mozilla.zest.impl.ZestBasicRunner
类名称:ZestBasicRunner
方法名:run

ZestBasicRunner.run介绍

暂无

代码示例

代码示例来源:origin: mozilla/zest

@Override
public String run(ZestScript script, Map<String, String> params)
    throws ZestAssertFailException, ZestActionFailException, IOException,
        ZestInvalidCommonTestException, ZestAssignFailException,
        ZestClientFailException {
  return this.run(script, null, params);
}

代码示例来源:origin: mozilla/zest

@Override
public String runScript(String script, Map<String, String> params)
    throws ZestAssertFailException, ZestActionFailException, IOException,
        ZestInvalidCommonTestException, ZestAssignFailException,
        ZestClientFailException {
  return run((ZestScript) ZestJSON.fromString(script), params);
}

代码示例来源:origin: mozilla/zest

@Override
public String runScript(Reader reader, Map<String, String> params)
    throws ZestAssertFailException, ZestActionFailException, IOException,
        ZestInvalidCommonTestException, ZestAssignFailException,
        ZestClientFailException {
  StringBuilder sb = new StringBuilder();
  try (BufferedReader fr = new BufferedReader(reader)) {
    String line;
    while ((line = fr.readLine()) != null) {
      sb.append(line);
    }
  }
  return run((ZestScript) ZestJSON.fromString(sb.toString()), params);
}

代码示例来源:origin: mozilla/zest

private static void run(ZestScript zs, Map<String, String> parameters, boolean debug) {
    ZestBasicRunner zbr = new ZestBasicRunner();
    zbr.setOutputWriter(new OutputStreamWriter(System.out));
    zbr.setStopOnAssertFail(false);
    zbr.setDebug(debug);
    try {
      zbr.run(zs, parameters);
    } catch (Exception e) {
      System.out.println("Error running script: " + e);
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: mozilla/zest

@Test(expected = IllegalArgumentException.class)
public void shouldFailToRunNonPassiveStatementsInPassiveScripts() throws Exception {
  // Given
  ZestScript script = new ZestScript();
  script.setType(ZestScript.Type.Passive);
  script.add(new ZestRequest());
  ZestBasicRunner runner = new ZestBasicRunner();
  // When
  runner.run(script, new HashMap<String, String>());
  // Then = IllegalArgumentException
}

代码示例来源:origin: mozilla/zest

String result = runner.run(zestScript, req, map);

代码示例来源:origin: mozilla/zest

ZestBasicRunner runner = new ZestBasicRunner();
runner.run(script, new HashMap<String, String>());

代码示例来源:origin: mozilla/zest

@Test(expected = ZestClientFailException.class)
public void testInvalidName() throws Exception {
  ZestScript script = new ZestScript();
  script.add(new ZestClientLaunch("bad", "baddriver", getServerUrl(PATH_SERVER_FILE)));
  script.add(new ZestClientWindowClose("bad", 0));
  ZestBasicRunner runner = new ZestBasicRunner();
  runner.run(script, null);
}

代码示例来源:origin: mozilla/zest

runner.run(script, null);
System.out.println("done");

代码示例来源:origin: mozilla/zest

@Test
public void testClientXpathLoopReturningType() throws Exception {
  ZestScript script = new ZestScript();
  script.add(new ZestClientLaunch("htmlunit", "HtmlUnit", getServerUrl(PATH_SERVER_FILE)));
  ZestLoopClientElements loop =
      new ZestLoopClientElements("val", "htmlunit", "xpath", "//*", "type");
  loop.addStatement(new ZestActionPrint("{{val}}"));
  script.add(loop);
  script.add(new ZestClientWindowClose("htmlunit", 0));
  ZestBasicRunner runner = new ZestBasicRunner();
  // Uncomment this to proxy via ZAP
  // runner.setProxy("localhost", 8090);
  StringWriter sw = new StringWriter();
  runner.setOutputWriter(sw);
  runner.run(script, null);
  assertEquals("text\n" + "password\n" + "select-one\n" + "submit\n", sw.toString());
}

代码示例来源:origin: mozilla/zest

@Test
public void testClientXpathLoopReturningName() throws Exception {
  ZestScript script = new ZestScript();
  script.add(new ZestClientLaunch("htmlunit", "HtmlUnit", getServerUrl(PATH_SERVER_FILE)));
  ZestLoopClientElements loop =
      new ZestLoopClientElements("val", "htmlunit", "xpath", "//*", "name");
  loop.addStatement(new ZestActionPrint("{{val}}"));
  script.add(loop);
  script.add(new ZestClientWindowClose("htmlunit", 0));
  ZestBasicRunner runner = new ZestBasicRunner();
  // Uncomment this to proxy via ZAP
  // runner.setProxy("localhost", 8090);
  StringWriter sw = new StringWriter();
  runner.setOutputWriter(sw);
  runner.run(script, null);
  // Expected string split up for clarity
  assertEquals("something\n" + "a\n" + "b\n" + "c" + "\n" + "submit\n", sw.toString());
}

代码示例来源:origin: mozilla/zest

@Test
public void testClientXpathLoopReturningText() throws Exception {
  ZestScript script = new ZestScript();
  script.add(new ZestClientLaunch("htmlunit", "HtmlUnit", getServerUrl(PATH_SERVER_FILE)));
  ZestLoopClientElements loop =
      new ZestLoopClientElements(
          "val", "htmlunit", "xpath", "//input[@type='text']", "name");
  loop.addStatement(new ZestActionPrint("{{val}}"));
  script.add(loop);
  script.add(new ZestClientWindowClose("htmlunit", 0));
  ZestBasicRunner runner = new ZestBasicRunner();
  // Uncomment this to proxy via ZAP
  // runner.setProxy("localhost", 8090);
  StringWriter sw = new StringWriter();
  runner.setOutputWriter(sw);
  runner.run(script, null);
  assertEquals("a\n", sw.toString());
}

代码示例来源:origin: mozilla/zest

runner.run(script, null);
assertEquals(" 1, 2, 3, 4, 5, 6, 7,", runner.getVariable("res"));
runner.run(script, null);
assertEquals(",,,,,,,", runner.getVariable("res"));
runner.run(script, null);
assertEquals(" 1 2 3 4 5 6 7", runner.getVariable("res"));
loop.setEnabled(false);
runner.run(script, null);
assertEquals("", runner.getVariable("res"));

代码示例来源:origin: mozilla/zest

@Test
public void testHtmlUnitByClassLaunch() throws Exception {
  ZestScript script = new ZestScript();
  ZestClientLaunch cl =
      new ZestClientLaunch(
          "htmlunit",
          "org.openqa.selenium.htmlunit.HtmlUnitDriver",
          getServerUrl(PATH_SERVER_FILE));
  cl.setCapabilities("browserName=htmlunit");
  script.add(cl);
  script.add(new ZestClientWindowClose("htmlunit", 0));
  ZestBasicRunner runner = new ZestBasicRunner();
  // Uncomment this to proxy via ZAP
  // runner.setProxy("localhost", 8090);
  runner.run(script, null);
  verifyUrlAccessed(PATH_SERVER_FILE);
}

代码示例来源:origin: mozilla/zest

@Test
public void testHtmlUnitLaunch() throws Exception {
  ZestScript script = new ZestScript();
  script.add(
      new ZestClientLaunch(
          "htmlunit", "HtmlUnit", getServerUrl(PATH_SERVER_FILE), false));
  script.add(new ZestClientWindowClose("htmlunit", 0));
  script.add(new ZestActionSleep(1));
  ZestBasicRunner runner = new ZestBasicRunner();
  // Uncomment this to proxy via ZAP
  // runner.setProxy("localhost", 8090);
  runner.run(script, null);
  verifyUrlAccessed(PATH_SERVER_FILE);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com