Я пытаюсь создать переносной набор тестов с Cucumber и Selenium на Java. С моей основной метод, который я делаю что-то вроде этого:Настройка CucumberOptions «функции» динамически изнутри в Java
JPanel panel = new JPanel();
// adding panel to frame
frame.add(panel, BorderLayout.CENTER);
/* calling user defined method for adding components
* to the panel.
*/
placeComponents(panel);
//Set the size of the window
//Set the frame to appear in the center of the screen.
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation(dim.width/2-frame.getSize().width/2, dim.height/2-frame.getSize().height/2);
// Setting the frame visibility to true
frame.setVisible(true);
System.out.println("Gonna Try to launch the test");
RunCukeTests.main(args);
у меня есть класс простой конфигурации (который я планирую добавить больше функций в)
public class FeatureConfig {
private static String filePath = "";
public static String getFilePath() {
return filePath;
}
}
И мой класс TestRunner выглядит это:
@RunWith(Cucumber.class)
//@Feature("my/package/**/*.feature")
@CucumberOptions(
//features= {"src/test/java/multiTest"}
features= {FeatureConfig.getFilePath() }
, glue={"stepDefs"}
, monochrome = true
, plugin = {"pretty"}
)
public class RunCukeTests {
public static void main(String[] args) throws Exception {
System.out.println("This is a test");
JUnitCore junit = new JUnitCore();
Result result = junit.run(windowGui.RunCukeTests.class);
}
}
проблема Я бегу в в линии
features= {FeatureConfig.getFilePath() }
Который дает мне ошибку
The value for annotation attribute CucumberOPtions.feature must be a constant expression
ли это означает, что я не могу установить путь особенности динамически без использования командной строки или есть способ достижения этой цели?