本文整理匯總了Golang中github.com/getgauge/gauge/gauge.ArgLookup.GetArg方法的典型用法代碼示例。如果您正苦於以下問題:Golang ArgLookup.GetArg方法的具體用法?Golang ArgLookup.GetArg怎麽用?Golang ArgLookup.GetArg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/getgauge/gauge/gauge.ArgLookup
的用法示例。
在下文中一共展示了ArgLookup.GetArg方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: PopulateConceptDynamicParams
// Creating a copy of the lookup and populating table values
func PopulateConceptDynamicParams(concept *gauge.Step, dataTableLookup *gauge.ArgLookup) {
//If it is a top level concept
if concept.Parent == nil {
lookup := concept.Lookup.GetCopy()
for key, _ := range lookup.ParamIndexMap {
conceptLookupArg := lookup.GetArg(key)
if conceptLookupArg.ArgType == gauge.Dynamic {
resolvedArg := dataTableLookup.GetArg(conceptLookupArg.Value)
lookup.AddArgValue(key, resolvedArg)
}
}
concept.Lookup = *lookup
}
//Updating values inside the concept step as well
newArgs := make([]*gauge.StepArg, 0)
for _, arg := range concept.Args {
if arg.ArgType == gauge.Dynamic {
if concept.Parent != nil {
newArgs = append(newArgs, concept.Parent.GetArg(arg.Value))
} else {
newArgs = append(newArgs, dataTableLookup.GetArg(arg.Value))
}
} else {
newArgs = append(newArgs, arg)
}
}
concept.Args = newArgs
concept.PopulateFragments()
}
示例2: GetResolvedParams
func (paramResolver *ParamResolver) GetResolvedParams(step *gauge.Step, parent *gauge.Step, dataTableLookup *gauge.ArgLookup) []*gauge_messages.Parameter {
parameters := make([]*gauge_messages.Parameter, 0)
for _, arg := range step.Args {
parameter := new(gauge_messages.Parameter)
parameter.Name = proto.String(arg.Name)
if arg.ArgType == gauge.Static {
parameter.ParameterType = gauge_messages.Parameter_Static.Enum()
parameter.Value = proto.String(arg.Value)
} else if arg.ArgType == gauge.Dynamic {
var resolvedArg *gauge.StepArg
if parent != nil {
resolvedArg = parent.GetArg(arg.Value)
} else {
resolvedArg = dataTableLookup.GetArg(arg.Value)
}
//In case a special table used in a concept, you will get a dynamic table value which has to be resolved from the concept lookup
parameter.Name = proto.String(resolvedArg.Name)
if resolvedArg.Table.IsInitialized() {
parameter.ParameterType = gauge_messages.Parameter_Special_Table.Enum()
parameter.Table = paramResolver.createProtoStepTable(&resolvedArg.Table, dataTableLookup)
} else {
parameter.ParameterType = gauge_messages.Parameter_Dynamic.Enum()
parameter.Value = proto.String(resolvedArg.Value)
}
} else if arg.ArgType == gauge.SpecialString {
parameter.ParameterType = gauge_messages.Parameter_Special_String.Enum()
parameter.Value = proto.String(arg.Value)
} else if arg.ArgType == gauge.SpecialTable {
parameter.ParameterType = gauge_messages.Parameter_Special_Table.Enum()
parameter.Table = paramResolver.createProtoStepTable(&arg.Table, dataTableLookup)
} else {
parameter.ParameterType = gauge_messages.Parameter_Table.Enum()
parameter.Table = paramResolver.createProtoStepTable(&arg.Table, dataTableLookup)
}
parameters = append(parameters, parameter)
}
return parameters
}
示例3: createProtoStepTable
func (resolver *ParamResolver) createProtoStepTable(table *gauge.Table, dataTableLookup *gauge.ArgLookup) *gauge_messages.ProtoTable {
protoTable := new(gauge_messages.ProtoTable)
protoTable.Headers = &gauge_messages.ProtoTableRow{Cells: table.Headers}
tableRows := make([]*gauge_messages.ProtoTableRow, 0)
if len(table.Columns) == 0 {
protoTable.Rows = tableRows
return protoTable
}
for i := 0; i < len(table.Columns[0]); i++ {
row := make([]string, 0)
for _, header := range table.Headers {
tableCell := table.Get(header)[i]
value := tableCell.Value
if tableCell.CellType == gauge.Dynamic {
//if concept has a table with dynamic cell, fetch from datatable
value = dataTableLookup.GetArg(tableCell.Value).Value
}
row = append(row, value)
}
tableRows = append(tableRows, &gauge_messages.ProtoTableRow{Cells: row})
}
protoTable.Rows = tableRows
return protoTable
}