0

This is the testNG.xml File:

enter image description here

This is the day4.java File

enter image description here]

This is the console Result. This is the console Result.

Why I am getting this issue?

I also tried with @optional method but in the that way I am getting the NULL value.

Nico Griffioen
  • 5,143
  • 2
  • 27
  • 36
SID
  • 1

2 Answers2

0

You are not passed any parameter value in the testng.xml file.Your xml file should look like

 <suite name="Parameter test Suite" verbose="1">
        <!-- This parameter will be passed to every test in this suite -->
        <parameter name="suite-param" value="suite level parameter" />
        <test name="Home loan">
            <classes>
                <class name="test">
                    <methods>
                        <include name="demo" />
                    </methods>
                </class>
            </classes>
        </test>
 </suite>

Here parameter name and value will be your URL

Few more details about xml file https://developers.perfectomobile.com/display/TT/TestNG+-User+specified+TestNG+xml+parameters

Zakaria Shahed
  • 2,589
  • 6
  • 23
  • 52
0

So you have to make 2 changes.

Your code should look like this:

@Parameter("URL") @Test public void webloginHomeloan(@Optional String urlname){

System.out.println("WebloginHome");
System.out.println("Parameterized value is:"+ URL)

}

Add @Optional in parameter as you are not passing any value from String urlname and change "urlname" to "URL"

Pratik
  • 357
  • 1
  • 9