How to use getCurrentLog method of com.paypal.selion.reports.runtime.SeLionReporter class

Best SeLion code snippet using com.paypal.selion.reports.runtime.SeLionReporter.getCurrentLog

Source:SeLionReporter.java Github

copy

Full Screen

...41 private BaseLog currentLog;42 private String getBaseFileName() {43 return baseFileName;44 }45 private BaseLog getCurrentLog() {46 return currentLog;47 }48 private void setCurrentLog(BaseLog currentLog) {49 this.currentLog = currentLog;50 }51 /**52 * Sets string path to the output53 * 54 * @param rootFolder55 * path to the output folder56 */57 public static void setTestNGOutputFolder(String rootFolder) {58 output = rootFolder;59 }60 /**61 * <ol>62 * <li>Provides saver with path to output information.63 * <li>Initializes saver.<br>64 * <li>Creates if missing output directories.<br>65 * </ol>66 */67 public static void init() {68 logger.entering();69 saver = new SaverFileSystem(output);70 saver.init();71 logger.exiting();72 }73 /**74 * Creates an instance of {@link BaseLog}. Calls any {@link LogAction}s which are hooked in.75 * 76 * @param saveSrc77 * Save the current page source <code>true/false</code>. Requires an active {@link Grid} session.78 * @return A {@link BaseLog} subclass that represents the actual log that was generated.79 */80 protected BaseLog createLog(boolean saveSrc) {81 String href = null;82 /**83 * Changed html file extension to txt84 */85 if (!(saver instanceof SaverFileSystem)) { // NOSONAR86 throw new RuntimeException("Internal error. SeLionReporter expects an instance of SaverFileSystem."); // NOSONAR87 }88 if (saveSrc) {89 PageContents source = new PageContents(Grid.driver().getPageSource(), getBaseFileName());90 saver.saveSources(source);91 href = "sources" + File.separator + getBaseFileName() + ".source.txt";92 getCurrentLog().setHref(href);93 }94 for (LogAction eachAction : actionList) {95 eachAction.perform();96 }97 return getCurrentLog();98 }99 /**100 * Generate a log message and send it to the TestNG {@link Reporter}101 * 102 * @param takeScreenshot103 * Take a screenshot <code>true/false</code>. Requires an active {@link Grid} session.104 * @param saveSrc105 * Save the current page source <code>true/false</code>. Requires an active {@link Grid} session.106 */107 protected void generateLog(boolean takeScreenshot, boolean saveSrc) {108 logger.entering(new Object[] { takeScreenshot, saveSrc });109 try {110 BaseLog log = createLog(saveSrc);111 String screenshotPath = null;...

Full Screen

Full Screen

getCurrentLog

Using AI Code Generation

copy

Full Screen

1@Step("Step 1: Get the current log file")2public void step1() {3 File logFile = SeLionReporter.getCurrentLog();4 System.out.println("Current log file is " + logFile.getAbsolutePath());5}6@Step("Step 2: Get the log file for the specified test method")7public void step2() {8 File logFile = SeLionReporter.getLog("testMethod1");9 System.out.println("Log file for testMethod1 is " + logFile.getAbsolutePath());10}11@Step("Step 3: Get the log file for the specified test method and test class")12public void step3() {13 File logFile = SeLionReporter.getLog("testMethod1", "com.paypal.selion.samples.SampleTest");14 System.out.println("Log file for testMethod1 in class com.paypal.selion.samples.SampleTest is " + logFile.getAbsolutePath());15}16@Step("Step 4: Get the log file for the specified test method and test class")17public void step4() {18 File logFile = SeLionReporter.getLog("testMethod1", SampleTest.class);19 System.out.println("Log file for testMethod1 in class com.paypal.selion.samples.SampleTest is " + logFile.getAbsolutePath());20}21@Step("Step 5: Get the log file for the specified test method and test class")22public void step5() {23 File logFile = SeLionReporter.getLog("testMethod1", "com.paypal.selion.samples.SampleTest");24 System.out.println("Log file for testMethod1 in class com.paypal.selion.samples.SampleTest is " + logFile.getAbsolutePath());25}

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 SeLion 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