Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Galen Spec generator help #630

Open
deepakkp opened this issue Dec 3, 2019 · 1 comment
Open

Galen Spec generator help #630

deepakkp opened this issue Dec 3, 2019 · 1 comment

Comments

@deepakkp
Copy link

deepakkp commented Dec 3, 2019

Hi team,
please let us know how to generate spec files.
we want to include commands in batch file and generate it or any particular spec generator method.
please share the proper steps.
i have tried below steps.but no luck.

http://galenframework.com/docs/reference-working-in-command-line/#SpecGenerator

@javdeeva
Copy link

javdeeva commented Aug 13, 2020

I can share examples on Java what we implemented for our project. Galen test run is based on Selenium (Junit)

public static void generatePageDump(WebDriver driver, String pageName, String specPath) {
    try {
      new GalenPageDump(pageName).dumpPage(driver, SPEC_COMMON_PATH + specPath,
          DUMP_PATH);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
public static void generateSpecByPageDump(String specPath) {
  SpecGenerator generator = new SpecGenerator();
  SpecGeneratorOptions specGeneratorOptions = new SpecGeneratorOptions();
  specGeneratorOptions.setUseGalenExtras(true);

  try (InputStream inputStream =
           new FileInputStream(DUMP_PATH + "/page.json");
       OutputStream outputStream =
           new FileOutputStream(SPEC_COMMON_PATH + specPath, true)) {

    PageSpecGenerationResult pageSpecGenerationResult = generator.generate(inputStream, specGeneratorOptions);
    String spec = generator.generatePageSpec(pageSpecGenerationResult, specGeneratorOptions);

    outputStream.write(spec.getBytes());

  } catch (IOException e) {
    e.printStackTrace();
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants