Project Structure issue | Selenium Forum
A
Adil Alami Posted on 04/06/2020

I still have that NullPointerException and from the TestNG Output display I can tell that the second line is pointing into line 17 of the TestA: softAssert("Titles Not Equal");

Since my extent report is as follow:

something is telling me it does not go beyond the line 17 where you called the function mentioned above: softAssert("Titles Not Equal"); and since this function and act as a hard assert even if it's a soft one.

 

Please help me out here, I won't be able to progress unless I resolve this matter.

 

Thank you


A
Ashish Replied on 04/06/2020

I am sure

Soft assert object is not initialized and so it throws null pointer

Debug your program


A
Adil Alami Replied on 06/06/2020

Hello Ashish,

I initialized the SoftAssert() as you mentioned on the TestBase class within the init Method and made it public so that the listener may access it and it worked fine but when I cameback today for more practice, it started throwing me the famous java.lang.AssertionError: some error message
null,
null
at org.testng.asserts.SoftAssert.assertAll(SoftAssert.java:47)
at suitea.TestA.testA(TestA.java:36)

when I doubled click on the TestA.java:36 line, it took me to the TestA and specifically into the line where it says: softAssert.assertAll("some error message");

And the following screenshot is telling me that Null in the last line of the details column is coming also from the Listener class:

Responsive image

 

which means the listener class is not reading from the TestBase class and at the same time it's reading the fruit and its value "mango".

I'm kind of confused here and need your help.

I'm adding testNG and console screenshots for ur attention:

Responsive image

Responsive image

 

 


A
Adil Alami Replied on 07/06/2020

Never mind Ashish, I was able to figure it out.

Thank you (Hope you're feeling better)


A
Ashish Replied on 08/06/2020

Thank you !!

Yes


Related Posts