简体   繁体   English

Fitnesse上的定制治具

[英]Custom Fixture on Fitnesse

I'm trying to set a symbol in my CustomFixture class, but this is not working for some reason. 我试图在我的CustomFixture类中设置一个符号,但是由于某些原因,这不起作用。 I have another method in there which takes a single argument, and is then set to a symbol. 我在那里有另一个方法,该方法采用单个参数,然后将其设置为符号。 This works fine. 这很好。 Whenever I try to set a symbol with a name and a value (so 2 parameters) it's not working. 每当我尝试设置带有名称和值的符号(即2个参数)时,它都无法正常工作。 This is the Javacode: 这是Javacode:

public class CustomFixtures extends Fixture {

/**
 * Set a timestamp to a symbol
 * @param symbol name of the symbol
 */
public void setCurrentDateTime(String symbol){
    DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    FixtureBridge.setSymbol(symbol, dateFormat.format(new Date()));
}

public void setSymbolValue(String symbol, String value){
    Fixture.setSymbol(symbol, value);
}

} }

Code called in test: 测试中调用的代码:

 |script|selenium driver fixture|
    |set symbol value|test|test|

This is the error that I get: 这是我得到的错误:

set symbol value Method setSymbolValueTest[1] not found in com.xebia.incubator.xebium.SeleniumDriverFixture. 设置符号值com.xebia.incubator.xebium.SeleniumDriverFixture中找不到方法setSymbolValueTest [1]。

Hope anyone has an idea, any help is appreciated! 希望任何人有一个主意,任何帮助表示赞赏! Thanks! 谢谢!

I figured it out, the type of Fixture class you extends corresponds to the format of how you have to call your fixture. 我发现,您扩展的Fixture类的类型对应于您调用Fixture的格式。 I extended DoFixture . extended DoFixture This causes me to put the table in this format: 这使我以这种格式放置表格:

|set symbol|symbol|with|value|

odd columns are concatenated in the method name. 方法名称中连接了奇数列。 Even column names are the parameters: 甚至列名也是参数:

public void setSymbolWith(String symbol, String value)

For further reference: http://fitnesse.org/FitNesse.UserGuide.FixtureGallery.FitLibraryFixtures.DoFixture 有关更多参考: http : //fitnesse.org/FitNesse.UserGuide.FixtureGallery.FitLibraryFixtures.DoFixture

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM