Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I am using @Factory annotation from TestNG to create tests dynamically. It will read a property file that contains the list of test cases to be executed and return them.

@Factory
public  Object[] dp() throws IOException {
  FileInputStream fs=new FileInputStream(System.getProperty("user.dir")+"/TestCaseNames.properties");

  Properties p=new Properties();
  p.load(fs);

  Set<Object> myset=p.keySet();
  System.out.println("myset " + myset);
  Object[] str= new Object[myset.size()];

  int cnt=0;
  for (Object t : myset) {
    str[cnt]=new Startup(p.getProperty((String) t));
    cnt=cnt+1;
  }
  return str;
}

Now the Test method is as below:

@Parameters({ "browser", "url", "app"})
@Test
public void ExecuteTestCase(String bname, String uname, String appname) 
  throws 
     NumberFormatException, MongoException, BiffException, 
     IOException, WriteException 
{
   ...
   ...
}

The test cases are executing fine but after execution the report is generating as below where it is showing the Test method name as 'ExecuteTestCase' instead of the original test method name present in the property file.

Please update me with the resolution so that the TestNG report file contains the proper method name instead of 'ExecuteTestCase'

share|improve this question
    
It may help or speed up reading your question if you remove from your code irrelevant parts (e.g. exceptions) and add those that matter. For instance, ExecuteTestCase() is a method of Startup class, correct? Also, how can your Factory translate a method name from property file to real method in a class? What are parameters of Startup constructor? How does your parameters file looks like? How those method names are defined? –  dzieciou Nov 1 '12 at 7:26
    
I would also recommend you to send your code to codereview.stackexchange.com site to get suggestions how to improve your code leggibility. I'd like to help you with your problem, but I got problem to see the context. –  dzieciou Nov 1 '12 at 7:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.