TestNG Reporters & Asserts in Selenium Web Driver

TestNG Reporters

TestNG is a Construction and many different powerful features of TestNG. It almost provides all the important things need to complete the Platform.

TestNG Reporter Logs

TestNG gives us the logging service for the test. the running of test case user would like some information logged in the gaming console. Information could be any fine detail depends upon the purpose TestNG Reporters & Asserts in Selenium Web Driver.

TestNG Reporters & Asserts in Selenium Web Driver

That using Selenium for testing, we need the information. which helps the User to comprehend the test steps or any failure the test execution. the help of TestNG Logs able to enable logging during the Selenium test execution.

Types of logging

In selenium, there are two types of logging. High-level logging and Low-level logging. In low-level logging effort to produce logs for the step take or every action made in the automation script. In high-level logging try to take main occurrences of the test.

Everybody has their own design of logging and I’ve mine too. I am the big lover of Log4j logging so in retrospect. They do not merge log4j logging with testing logging but on the same part, to use of both of its. I perform low-level logging with log4j and advanced with testing reporter logs.

How to do it…

1) Write a test circumstance for Sign In application and use Log4j logging on every step.
2) Place Reporter logs on the primary events of the test.
3) Run the test by right click on the test case script and choose Run As > TestNG Test.
Log4j logging will help to report a bug or steps taken through the test. so reporters log will help to reveal the test position with leadership. As leadership enthusiastic about the test results, not the test steps.

TestNG Asserts

TestNG also provides us the energy to consider decisions in the middle of the test run by making use of Assets. With this, we can put various checkpoints to the test. Assets are the most popular and used methods while creating Selenium Scripts. In selenium, will see many situations in the test were like to check the presence of an element. All you have to to do is to place an assert assertion on to it to confirm its existence.

Different Assets Statements

1) Assert.assertTrue() & Assert.assertFalse()

 Assert true assertion fails the ensure. that stop the execution of the test if the actual output is incorrect. Assert.assert false() works opposing of Assert.assertTrue(). This means that if you wish your test to continue only if when some certain element is not present on the web page. You will use Assert false, so it will are unsuccessful the test in case there is the element present on the web page.

2) Assert.assertEquals()

It also works the same manner like assert true and assert fail. It will stop the execution, if the value is not similar and keep on the execution of the worthiness is equal.

TestNG Reporters & Asserts in Selenium Web Driver

We provide TestNG Reporters & Asserts in Selenium Web Driver in real time training. We offer project training for selenium training in hyderabad real time.


Leave a comment