-1

I have a testcase.java which houses all the @Test methods (login, signup and forget password). Since I'm using Selenium ExtentReports, I put LogStatus.PASS after every single statement has been executed.

enterUsername();
logStatus.PASS("User name entered")
enterPassword();
logStatus.PASS("Password entered")
clickLoginButton();
logStatus.PASS("Login button clicked")

The scenario above is for login functionality only. I still have the SignUp and Forget Password methods. As I have observed, the code seems messy because there were lots of log statuses. Can you suggest any technique? Or, is there a way to separate the log status in a separate class?

  • 2
    In order to make the ExtentReports more attractive you have to add more log status, But you can simply stop adding log functions at every place and start only longing the log at the assertion level.That means only the pass and fail status. – ChathuD Oct 17 '16 at 10:45
1

I use such approach. Most webdriver methods have a custom wrapper which logs what happened, and pageobject use those wrappers instead of using webdriver methods directly (unless I want to avoid logging).

It is not rocket science, just competent programming. Allows my code to work on a layer higher than bare webdriver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.