Blogs Executing TestNG tests relying on @Parameters from Eclipse

Executing TestNG tests relying on @Parameters from Eclipse

If you wanna run TestNG tests relying on @Parameters like the one below from Eclipse, you need to pass some value for the 'basedir' parameter, otherwise Eclipse will complain:

@Test(groups = "unit", enabled = true, testName = "loaders.bdbje.BdbjeCacheStoreIntegrationTest")
public class BdbjeCacheStoreIntegrationTest extends BaseCacheStoreTest {

  private String tmpDirectory;

  @BeforeTest
  @Parameters({"basedir"})
  protected void setUpTempDir(String basedir) {
     tmpDirectory = basedir + TestingUtil.TEST_PATH + File.separator + getClass().getSimpleName();
  }
...

Having looked around on the web, it’s not clear how to do this and some people even seem to claim that it’s not doable. However, having looked at how Maven deals with this, you simply have to pass the parameter as system property and it will work. So, if you wanna run BdbjeCacheStoreIntegrationTest from Eclipse, simply pass a system property like this:

-Dbasedir=/home/galder/tmp

Otherwise, Eclipse will moan with a message like this:

org.testng.TestNGException:
Parameter 'basedir' is required by @Configuration on method setUpTempDir

Get it, Use it, Ask us!

We’re hard at work on new features, improvements and fixes, so watch this space for more announcements!

Please, download and test the latest release.

The source code is hosted on GitHub. If you need to report a bug or request a new feature, look for a similar one on our JIRA issues tracker. If you don’t find any, create a new issue.

If you have questions, are experiencing a bug or want advice on using Infinispan, you can use GitHub discussions. We will do our best to answer you as soon as we can.

The Infinispan community uses Zulip for real-time communications. Join us using either a web-browser or a dedicated application on the Infinispan chat.