Why TestNG Optional parameter coming with double quotes

413 Views Asked by At

With TestNG 7.0.0 and Eclipse 2019-03 When trying to use @Optional Parameters value, it comes with double-quotes. Not getting why?

Check the below screenshot for details.

[enter image description here]

What am I missing? I expect the optional value without quotes just like myBrowser variable.

1

There are 1 best solutions below

1
On

This is correct way to use @optional annotation.

I hope you know it that we can pass values from Testng.xml to @Test. If we are not passing any value from xml to test case then @Optional comes in picture. Whatever value we will pass in @Optional it will be default value. So that we need to pass this value in double quotes as it is not a function arguement.

For more detail, check it:

https://www.seleniumeasy.com/testng-tutorials/optional-annotation-in-testng