How to use dryRun method of com.tngtech.jgiven.impl.Config class

Best JGiven code snippet using com.tngtech.jgiven.impl.Config.dryRun

Source:ScenarioExecutor.java Github

copy

Full Screen

...380 * @param arguments the test arguments with their parameter names381 */382 public void startScenario(Class<?> testClass, Method method, List<NamedArgument> arguments) {383 listener.scenarioStarted(testClass, method, arguments);384 if (Config.config().dryRun()) {385 methodInterceptor.setDefaultInvocationMode(InvocationMode.PENDING);386 methodInterceptor.disableMethodExecution();387 executeLifeCycleMethods = false;388 suppressExceptions = true;389 } else {390 Pending annotation = extractPendingAnnotation(method);391 if (annotation == null) {392 methodInterceptor.setSuppressExceptions(suppressStepExceptions);393 } else {394 if (annotation.failIfPass()) {395 failIfPass();396 } else {397 methodInterceptor.setDefaultInvocationMode(InvocationMode.PENDING);398 if (!annotation.executeSteps()) {...

Full Screen

Full Screen

Source:Config.java Github

copy

Full Screen

...35 logDryRunEnabled();36 logReportEnabled();37 }38 static void logDryRunEnabled() {39 if (INSTANCE.dryRun()) {40 log.info("Dry Run enabled.");41 }42 }43 static void logReportEnabled() {44 if (!INSTANCE.isReportEnabled()) {45 log.info("Please note that the report generation is turned off.");46 }47 }48 private Config() {49 }50 private static Properties loadConfigFileProperties() {51 String path = System.getProperty(JGIVEN_CONFIG_PATH, "jgiven.properties");52 String charset = System.getProperty(JGIVEN_CONFIG_CHARSET, "UTF-8");53 Properties properties = new Properties();54 try (Reader reader = Files.newBufferedReader(Paths.get(path), Charset.forName(charset))) {55 properties.load(reader);56 } catch (IOException e) {57 log.debug("config file " + path + " not loaded: " + e.getMessage());58 }59 return properties;60 }61 private String resolveProperty(String name) {62 return resolveProperty(name, null);63 }64 private String resolveProperty(String name, String defaultValue) {65 return System.getProperty(name, configFileProperties.getProperty(name, defaultValue));66 }67 /**68 * Returns the directory set either via a configuration file or a system property.69 * If no value is specified and the surefire test classpath is set, the default maven directory will be used,70 * otherwise a default is returned.71 */72 public Optional<File> getReportDir() {73 String reportDirName = resolveProperty(JGIVEN_REPORT_DIR);74 if (reportDirName == null) {75 if (resolveProperty("surefire.test.class.path") != null) {76 reportDirName = "target/jgiven-reports/json";77 log.info(JGIVEN_REPORT_DIR + " not set, but detected surefire plugin, generating reports to "78 + reportDirName);79 } else {80 reportDirName = "jgiven-reports";81 log.debug(JGIVEN_REPORT_DIR + " not set, using default value jgiven-reports");82 }83 }84 File reportDir = new File(reportDirName);85 if (reportDir.exists() && !reportDir.isDirectory()) {86 log.warn(reportDirName + " exists but is not a directory. Will not generate JGiven reports.");87 return Optional.empty();88 }89 log.debug("Using folder " + reportDirName + " to store JGiven reports");90 return Optional.of(reportDir);91 }92 public boolean isReportEnabled() {93 return TRUE.equalsIgnoreCase(resolveProperty(JGIVEN_REPORT_ENABLED, TRUE));94 }95 public void setReportEnabled(boolean enabled) {96 System.setProperty(JGIVEN_REPORT_ENABLED, "" + enabled);97 }98 public ConfigValue textColorEnabled() {99 return ConfigValue.fromString(resolveProperty(JGIVEN_REPORT_TEXT_COLOR, AUTO));100 }101 public boolean textReport() {102 return TRUE.equalsIgnoreCase(resolveProperty(JGIVEN_REPORT_TEXT, TRUE));103 }104 public void setTextReport(boolean b) {105 System.setProperty(JGIVEN_REPORT_TEXT, "" + b);106 }107 public boolean filterStackTrace() {108 return TRUE.equalsIgnoreCase(resolveProperty(JGIVEN_FILTER_STACK_TRACE, TRUE));109 }110 public void setReportDir(File reportDir) {111 System.setProperty(JGIVEN_REPORT_DIR, reportDir.getAbsolutePath());112 }113 public boolean dryRun() {114 return TRUE.equals(System.getProperty(JGIVEN_REPORT_DRY_RUN, FALSE));115 }116}...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run JGiven automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful