How to use processConceptStep method of parser Package

Best Gauge code snippet using parser.processConceptStep

conceptParser.go

Source:conceptParser.go Github

copy

Full Screen

...69 if !isInState(parser.currentState, conceptScope) {70 parseRes.ParseErrors = append(parseRes.ParseErrors, ParseError{FileName: fileName, LineNo: token.LineNo, Message: "Step is not defined inside a concept heading", LineText: token.LineText})71 continue72 }73 if errs := parser.processConceptStep(token, fileName); len(errs) > 0 {74 parseRes.ParseErrors = append(parseRes.ParseErrors, errs...)75 continue76 }77 addStates(&parser.currentState, stepScope)78 } else if parser.isTableHeader(token) {79 if !isInState(parser.currentState, stepScope) {80 parseRes.ParseErrors = append(parseRes.ParseErrors, ParseError{FileName: fileName, LineNo: token.LineNo, Message: "Table doesn't belong to any step", LineText: token.LineText})81 continue82 }83 parser.processTableHeader(token)84 addStates(&parser.currentState, tableScope)85 } else if parser.isScenarioHeading(token) {86 parseRes.ParseErrors = append(parseRes.ParseErrors, ParseError{FileName: fileName, LineNo: token.LineNo, Message: "Scenario Heading is not allowed in concept file", LineText: token.LineText})87 continue88 } else if parser.isTableDataRow(token) {89 if areUnderlined(token.Args) && !isInState(parser.currentState, tableSeparatorScope) {90 addStates(&parser.currentState, tableSeparatorScope)91 } else if isInState(parser.currentState, stepScope) {92 parser.processTableDataRow(token, &parser.currentConcept.Lookup, fileName)93 }94 } else {95 retainStates(&parser.currentState, conceptScope)96 addStates(&parser.currentState, commentScope)97 comment := &gauge.Comment{Value: token.Value, LineNo: token.LineNo}98 if parser.currentConcept == nil {99 preComments = append(preComments, comment)100 addPreComments = true101 continue102 }103 parser.currentConcept.Items = append(parser.currentConcept.Items, comment)104 }105 }106 if parser.currentConcept != nil && len(parser.currentConcept.ConceptSteps) < 1 {107 parseRes.ParseErrors = append(parseRes.ParseErrors, ParseError{FileName: fileName, LineNo: parser.currentConcept.LineNo, Message: "Concept should have atleast one step", LineText: parser.currentConcept.LineText})108 return nil, parseRes109 }110 if parser.currentConcept != nil {111 concepts = append(concepts, parser.currentConcept)112 }113 return concepts, parseRes114}115func (parser *ConceptParser) isConceptHeading(token *Token) bool {116 return token.Kind == gauge.SpecKind117}118func (parser *ConceptParser) isStep(token *Token) bool {119 return token.Kind == gauge.StepKind120}121func (parser *ConceptParser) isScenarioHeading(token *Token) bool {122 return token.Kind == gauge.ScenarioKind123}124func (parser *ConceptParser) isTableHeader(token *Token) bool {125 return token.Kind == gauge.TableHeader126}127func (parser *ConceptParser) isTableDataRow(token *Token) bool {128 return token.Kind == gauge.TableRow129}130func (parser *ConceptParser) processConceptHeading(token *Token, fileName string) (*gauge.Step, *ParseResult) {131 processStep(new(SpecParser), token)132 token.LineText = strings.TrimSpace(strings.TrimLeft(strings.TrimSpace(token.LineText), "#"))133 var concept *gauge.Step134 var parseRes *ParseResult135 concept, parseRes = CreateStepUsingLookup(token, nil, fileName)136 if parseRes != nil && len(parseRes.ParseErrors) > 0 {137 return nil, parseRes138 }139 if !parser.hasOnlyDynamicParams(concept) {140 parseRes.ParseErrors = []ParseError{ParseError{FileName: fileName, LineNo: token.LineNo, Message: "Concept heading can have only Dynamic Parameters", LineText: token.LineText}}141 return nil, parseRes142 }143 concept.IsConcept = true144 parser.createConceptLookup(concept)145 concept.Items = append(concept.Items, concept)146 return concept, parseRes147}148func (parser *ConceptParser) processConceptStep(token *Token, fileName string) []ParseError {149 processStep(new(SpecParser), token)150 conceptStep, parseRes := CreateStepUsingLookup(token, &parser.currentConcept.Lookup, fileName)151 if parseRes != nil && len(parseRes.ParseErrors) > 0 {152 return parseRes.ParseErrors153 }154 parser.currentConcept.ConceptSteps = append(parser.currentConcept.ConceptSteps, conceptStep)155 parser.currentConcept.Items = append(parser.currentConcept.Items, conceptStep)156 return nil157}158func (parser *ConceptParser) processTableHeader(token *Token) {159 steps := parser.currentConcept.ConceptSteps160 currentStep := steps[len(steps)-1]161 addInlineTableHeader(currentStep, token)162 items := parser.currentConcept.Items...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Gauge automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful