Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use testNG @Parameters in @BeforeSuite to read resource file
    text
    copied!<p>I am using <code>testNG</code> with <code>Selenium webdriver2.0</code>.</p> <p>In my <code>testNG.xml</code> I have</p> <pre><code>&lt;suite data-provider-thread-count="2" name="selenium FrontEnd Test" parallel="false" skipfailedinvocationCounts="false" thread-count="2"&gt; &lt;parameter name="config_file" value="src/test/resources/config.properties/"/&gt; &lt;test annotations="JDK" junit="false" name="CarInsurance Sanity Test" skipfailedinvocationCounts="false" verbose="2"&gt; &lt;parameter name="config-file" value="src/test/resources/config.properties/"/&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;/classes&gt; &lt;/test&gt; &lt;/suite&gt; </code></pre> <p>In java file</p> <pre><code>@BeforeSuite(groups = { "abstract" } ) @Parameters(value = { "config-file" }) public void initFramework(String configfile) throws Exception { Reporter.log("Invoked init Method \n",true); Properties p = new Properties(); FileInputStream conf = new FileInputStream(configfile); p.load(conf); siteurl = p.getProperty("BASEURL"); browser = p.getProperty("BROWSER"); browserloc = p.getProperty("BROWSERLOC"); } </code></pre> <p>Getting error as </p> <blockquote> <p>AILED CONFIGURATION: @BeforeSuite initFramework org.testng.TestNGException: Parameter 'config-file' is required by @Configuration on method initFramework but has not been marked @Optional or defined in </p> </blockquote> <p>How to use <code>@Parameters</code> for resource file?</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