Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Looks like your <code>config-file</code> parameter is not defined at the <code>&lt;suite&gt;</code> level. There are several ways to solve this: 1. Make sure the <code>&lt;parameter&gt;</code> element is defined within <code>&lt;suite&gt;</code> tag but outside of any <code>&lt;test&gt;</code>:</p> <pre><code> &lt;suite name="Suite1" &gt; &lt;parameter name="config-file" value="src/test/resources/config.properties/" /&gt; &lt;test name="Test1" &gt; &lt;!-- not here --&gt; &lt;/test&gt; &lt;/suite&gt; </code></pre> <p>2. If you want to have the default value for the parameter in the Java code despite the fact it is specified in <code>testng.xml</code> or not, you can add <code>@Optional</code> annotation to the method parameter:</p> <pre><code>@BeforeSuite @Parameters( {"config-file"} ) public void initFramework(@Optional("src/test/resources/config.properties/") String configfile) { //method implementation here } </code></pre> <p><strong>EDIT</strong> (based on posted testng.xml):</p> <p>Option 1:</p> <pre><code>&lt;suite&gt; &lt;parameter name="config-file" value="src/test/resources/config.properties/"/&gt; &lt;test &gt; &lt;groups&gt; &lt;run&gt; &lt;include name="abstract"/&gt; &lt;include name="Sanity"/&gt; &lt;/run&gt; &lt;/groups&gt; &lt;classes&gt; &lt;!--put classes here --&gt; &lt;/classes&gt; &lt;/test&gt; &lt;/suite&gt; </code></pre> <p>Option 2:</p> <pre><code>@BeforeTest @Parameters( {"config-file"} ) public void initFramework(@Optional("src/test/resources/config.properties/") String configfile) { //method implementation here } </code></pre> <p>In any case, I would recommend not having two parameters with almost identical names, identical values, and different scope.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload