Is it possible to customize the format of the generated java code using
1- code template,
2- formatter or
3- any other methods?
It is possible to generate code without hard-coded string in locator/condition/... Example:
- Code: Select all
ui.click(new ButtonLocator("myHardCodedString"));
What I would prefer is to use a properties file with a Message class that hold all strings. This way, it will allow me to change the string in the user interface and updating tests rapidly instead of having to change all string elsewere in the tests.
Example:
- Code: Select all
package org.eclipse.jdt.internal.corext;
import org.eclipse.osgi.util.NLS;
public final class Messages extends NLS {
private static final String BUNDLE_NAME= "plugin.name.Messages";//$NON-NLS-1$
private CorextMessages() {
// Do not instantiate
}
public static String Application1_Dialog1_ButtonLabel1;
static {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
}
and in the generated test
- Code: Select all
ui.click(new ButtonLocator(Messages.Application1_Dialog1_ButtonLabel1));
Thanks
Vincent