How to use tableHeader method of execution Package

Best Gauge code snippet using execution.tableHeader

specExecutor_test.go

Source:specExecutor_test.go Github

copy

Full Screen

...63 line := specBuilder.addPrefix("tags: ", tagText)64 specBuilder.lines = append(specBuilder.lines, line)65 return specBuilder66}67func (specBuilder *specBuilder) tableHeader(cells ...string) *specBuilder {68 return specBuilder.tableRow(cells...)69}70func (specBuilder *specBuilder) tableRow(cells ...string) *specBuilder {71 rowInMarkdown := "|"72 for _, cell := range cells {73 rowInMarkdown = fmt.Sprintf("%s%s|", rowInMarkdown, cell)74 }75 specBuilder.lines = append(specBuilder.lines, fmt.Sprintf("%s\n", rowInMarkdown))76 return specBuilder77}78func (specBuilder *specBuilder) text(comment string) *specBuilder {79 specBuilder.lines = append(specBuilder.lines, fmt.Sprintf("%s\n", comment))80 return specBuilder81}82func (s *MySuite) TestResolveConceptToProtoConceptItem(c *C) {83 conceptDictionary := gauge.NewConceptDictionary()84 specText := SpecBuilder().specHeading("A spec heading").85 scenarioHeading("First scenario").86 step("create user \"456\" \"foo\" and \"9900\"").87 String()88 path, _ := filepath.Abs(filepath.Join("testdata", "concept.cpt"))89 parser.AddConcepts(path, conceptDictionary)90 spec, _ := new(parser.SpecParser).Parse(specText, conceptDictionary, "")91 specExecutor := newSpecExecutor(spec, nil, nil, nil, 0)92 specExecutor.errMap = getValidationErrorMap()93 protoConcept := specExecutor.resolveToProtoConceptItem(*spec.Scenarios[0].Steps[0]).GetConcept()94 checkConceptParameterValuesInOrder(c, protoConcept, "456", "foo", "9900")95 firstNestedStep := protoConcept.GetSteps()[0].GetConcept().GetSteps()[0].GetStep()96 params := getParameters(firstNestedStep.GetFragments())97 c.Assert(1, Equals, len(params))98 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)99 c.Assert(params[0].GetValue(), Equals, "456")100 secondNestedStep := protoConcept.GetSteps()[0].GetConcept().GetSteps()[1].GetStep()101 params = getParameters(secondNestedStep.GetFragments())102 c.Assert(1, Equals, len(params))103 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)104 c.Assert(params[0].GetValue(), Equals, "foo")105 secondStep := protoConcept.GetSteps()[1].GetStep()106 params = getParameters(secondStep.GetFragments())107 c.Assert(1, Equals, len(params))108 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)109 c.Assert(params[0].GetValue(), Equals, "9900")110}111func (s *MySuite) TestResolveNestedConceptToProtoConceptItem(c *C) {112 conceptDictionary := gauge.NewConceptDictionary()113 specText := SpecBuilder().specHeading("A spec heading").114 scenarioHeading("First scenario").115 step("create user \"456\" \"foo\" and \"9900\"").116 String()117 path, _ := filepath.Abs(filepath.Join("testdata", "concept.cpt"))118 parser.AddConcepts(path, conceptDictionary)119 specParser := new(parser.SpecParser)120 spec, _ := specParser.Parse(specText, conceptDictionary, "")121 specExecutor := newSpecExecutor(spec, nil, nil, nil, 0)122 specExecutor.errMap = getValidationErrorMap()123 protoConcept := specExecutor.resolveToProtoConceptItem(*spec.Scenarios[0].Steps[0]).GetConcept()124 checkConceptParameterValuesInOrder(c, protoConcept, "456", "foo", "9900")125 c.Assert(protoConcept.GetSteps()[0].GetItemType(), Equals, gauge_messages.ProtoItem_Concept)126 nestedConcept := protoConcept.GetSteps()[0].GetConcept()127 checkConceptParameterValuesInOrder(c, nestedConcept, "456", "foo")128 firstNestedStep := nestedConcept.GetSteps()[0].GetStep()129 params := getParameters(firstNestedStep.GetFragments())130 c.Assert(1, Equals, len(params))131 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)132 c.Assert(params[0].GetValue(), Equals, "456")133 secondNestedStep := nestedConcept.GetSteps()[1].GetStep()134 params = getParameters(secondNestedStep.GetFragments())135 c.Assert(1, Equals, len(params))136 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)137 c.Assert(params[0].GetValue(), Equals, "foo")138 c.Assert(protoConcept.GetSteps()[1].GetItemType(), Equals, gauge_messages.ProtoItem_Step)139 secondStepInConcept := protoConcept.GetSteps()[1].GetStep()140 params = getParameters(secondStepInConcept.GetFragments())141 c.Assert(1, Equals, len(params))142 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)143 c.Assert(params[0].GetValue(), Equals, "9900")144}145func (s *MySuite) TestResolveToProtoConceptItemWithDataTable(c *C) {146 conceptDictionary := gauge.NewConceptDictionary()147 specText := SpecBuilder().specHeading("A spec heading").148 tableHeader("id", "name", "phone").149 tableHeader("123", "foo", "8800").150 tableHeader("666", "bar", "9900").151 scenarioHeading("First scenario").152 step("create user <id> <name> and <phone>").153 String()154 path, _ := filepath.Abs(filepath.Join("testdata", "concept.cpt"))155 parser.AddConcepts(path, conceptDictionary)156 specParser := new(parser.SpecParser)157 spec, _ := specParser.Parse(specText, conceptDictionary, "")158 specExecutor := newSpecExecutor(spec, nil, nil, nil, 0)159 // For first row160 specExecutor.currentTableRow = 0161 specExecutor.errMap = gauge.NewBuildErrors()162 protoConcept := specExecutor.resolveToProtoConceptItem(*spec.Scenarios[0].Steps[0]).GetConcept()163 checkConceptParameterValuesInOrder(c, protoConcept, "123", "foo", "8800")164 c.Assert(protoConcept.GetSteps()[0].GetItemType(), Equals, gauge_messages.ProtoItem_Concept)165 nestedConcept := protoConcept.GetSteps()[0].GetConcept()166 checkConceptParameterValuesInOrder(c, nestedConcept, "123", "foo")167 firstNestedStep := nestedConcept.GetSteps()[0].GetStep()168 params := getParameters(firstNestedStep.GetFragments())169 c.Assert(1, Equals, len(params))170 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)171 c.Assert(params[0].GetValue(), Equals, "123")172 secondNestedStep := nestedConcept.GetSteps()[1].GetStep()173 params = getParameters(secondNestedStep.GetFragments())174 c.Assert(1, Equals, len(params))175 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)176 c.Assert(params[0].GetValue(), Equals, "foo")177 c.Assert(protoConcept.GetSteps()[1].GetItemType(), Equals, gauge_messages.ProtoItem_Step)178 secondStepInConcept := protoConcept.GetSteps()[1].GetStep()179 params = getParameters(secondStepInConcept.GetFragments())180 c.Assert(1, Equals, len(params))181 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)182 c.Assert(params[0].GetValue(), Equals, "8800")183 // For second row184 specExecutor.currentTableRow = 1185 protoConcept = specExecutor.resolveToProtoConceptItem(*spec.Scenarios[0].Steps[0]).GetConcept()186 c.Assert(protoConcept.GetSteps()[0].GetItemType(), Equals, gauge_messages.ProtoItem_Concept)187 checkConceptParameterValuesInOrder(c, protoConcept, "666", "bar", "9900")188 nestedConcept = protoConcept.GetSteps()[0].GetConcept()189 checkConceptParameterValuesInOrder(c, nestedConcept, "666", "bar")190 firstNestedStep = nestedConcept.GetSteps()[0].GetStep()191 params = getParameters(firstNestedStep.GetFragments())192 c.Assert(1, Equals, len(params))193 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)194 c.Assert(params[0].GetValue(), Equals, "666")195 secondNestedStep = nestedConcept.GetSteps()[1].GetStep()196 params = getParameters(secondNestedStep.GetFragments())197 c.Assert(1, Equals, len(params))198 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)199 c.Assert(params[0].GetValue(), Equals, "bar")200 c.Assert(protoConcept.GetSteps()[1].GetItemType(), Equals, gauge_messages.ProtoItem_Step)201 secondStepInConcept = protoConcept.GetSteps()[1].GetStep()202 params = getParameters(secondStepInConcept.GetFragments())203 c.Assert(1, Equals, len(params))204 c.Assert(params[0].GetParameterType(), Equals, gauge_messages.Parameter_Dynamic)205 c.Assert(params[0].GetValue(), Equals, "9900")206}207func checkConceptParameterValuesInOrder(c *C, concept *gauge_messages.ProtoConcept, paramValues ...string) {208 params := getParameters(concept.GetConceptStep().Fragments)209 c.Assert(len(params), Equals, len(paramValues))210 for i, param := range params {211 c.Assert(param.GetValue(), Equals, paramValues[i])212 }213}214type tableRow struct {215 name string216 input string // input by user for data table rows217 output []int // data table indexes to be executed218 tableRowsCount int // total rows in given data table219}220var tableRowTests = []*tableRow{221 {"Valid single row number", "2", []int{1}, 5},222 {"Valid row numbers list", "2,3,4", []int{1, 2, 3}, 4},223 {"Valid table rows range", "2-5", []int{1, 2, 3, 4}, 5},224 {"Empty table rows range", "", []int{0, 1, 2, 3}, 4},225 {"Table rows list with spaces", "2, 4 ", []int{1, 3}, 4},226 {"Row count is zero with empty input", "", []int{}, 0},227 {"Row count is non-zero with empty input", "", []int{0, 1}, 2},228 {"Row count is non-zero with non-empty input", "2", []int{1}, 2},229}230func (s *MySuite) TestToGetDataTableRowsRangeFromInputFlag(c *C) {231 for _, test := range tableRowTests {232 TableRows = test.input233 got := getDataTableRows(test.tableRowsCount)234 want := test.output235 c.Assert(got, DeepEquals, want, Commentf(test.name))236 }237}238func (s *MySuite) TestCreateSkippedSpecResult(c *C) {239 spec := &gauge.Specification{Heading: &gauge.Heading{LineNo: 0, Value: "SPEC_HEADING"}, FileName: "FILE"}240 se := newSpecExecutor(spec, nil, nil, nil, 0)241 se.errMap = getValidationErrorMap()242 se.specResult = &result.SpecResult{}243 se.skipSpecForError(fmt.Errorf("ERROR"))244 c.Assert(se.specResult.IsFailed, Equals, false)245 c.Assert(se.specResult.Skipped, Equals, true)246 // c.Assert(len(se.errMap.SpecErrs[spec]), Equals, 1)247 // c.Assert(se.errMap.SpecErrs[spec][0].message, Equals, "ERROR")248 // c.Assert(se.errMap.SpecErrs[spec][0].fileName, Equals, "FILE")249 // c.Assert(se.errMap.SpecErrs[spec][0].step.LineNo, Equals, 0)250 // c.Assert(se.errMap.SpecErrs[spec][0].step.LineText, Equals, "SPEC_HEADING")251}252func (s *MySuite) TestCreateSkippedSpecResultWithScenarios(c *C) {253 se := newSpecExecutor(anySpec(), nil, nil, nil, 0)254 se.errMap = getValidationErrorMap()255 se.specResult = &result.SpecResult{ProtoSpec: &gauge_messages.ProtoSpec{}}256 se.skipSpecForError(fmt.Errorf("ERROR"))257 c.Assert(se.specResult.IsFailed, Equals, false)258 c.Assert(se.specResult.Skipped, Equals, true)259 // c.Assert(len(specExecutor.errMap.SpecErrs[spec]), Equals, 1)260 // c.Assert(specExecutor.errMap.SpecErrs[spec][0].message, Equals, "ERROR")261 // c.Assert(specExecutor.errMap.SpecErrs[spec][0].fileName, Equals, "FILE")262 // c.Assert(specExecutor.errMap.SpecErrs[spec][0].step.LineNo, Equals, 1)263 // c.Assert(specExecutor.errMap.SpecErrs[spec][0].step.LineText, Equals, "A spec heading")264 // c.Assert(len(specExecutor.errMap.ScenarioErrs[spec.Scenarios[0]]), Equals, 1)265 // c.Assert(specExecutor.errMap.ScenarioErrs[spec.Scenarios[0]][0].message, Equals, "ERROR")266 // c.Assert(specExecutor.errMap.ScenarioErrs[spec.Scenarios[0]][0].fileName, Equals, "FILE")267 // c.Assert(specExecutor.errMap.ScenarioErrs[spec.Scenarios[0]][0].step.LineNo, Equals, 1)268 // c.Assert(specExecutor.errMap.ScenarioErrs[spec.Scenarios[0]][0].step.LineText, Equals, "A spec heading")269}270func (s *MySuite) TestSkipSpecWithDataTableScenarios(c *C) {271 stepText := "Unimplememted step"272 specText := SpecBuilder().specHeading("A spec heading").273 tableHeader("id", "name", "phone").274 tableRow("123", "foo", "8800").275 tableRow("666", "bar", "9900").276 scenarioHeading("First scenario").277 step(stepText).278 step("create user <id> <name> and <phone>").279 String()280 spec, _ := new(parser.SpecParser).Parse(specText, gauge.NewConceptDictionary(), "")281 errMap := &gauge.BuildErrors{282 SpecErrs: make(map[*gauge.Specification][]error),283 ScenarioErrs: make(map[*gauge.Scenario][]error),284 StepErrs: make(map[*gauge.Step]error),285 }286 errMap.SpecErrs[spec] = []error{validation.NewSpecValidationError("Step implementation not found", spec.FileName)}287 se := newSpecExecutor(spec, nil, nil, errMap, 0)288 specInfo := &gauge_messages.SpecInfo{Name: se.specification.Heading.Value,289 FileName: se.specification.FileName,290 IsFailed: false, Tags: getTagValue(se.specification.Tags)}291 se.currentExecutionInfo = &gauge_messages.ExecutionInfo{CurrentSpec: specInfo}292 se.specResult = gauge.NewSpecResult(se.specification)293 resolvedSpecItems := se.resolveItems(se.specification.GetSpecItems())294 se.specResult.AddSpecItems(resolvedSpecItems)295 se.skipSpec()296 c.Assert(se.specResult.ProtoSpec.GetIsTableDriven(), Equals, true)297 c.Assert(len(se.specResult.ProtoSpec.GetItems()), Equals, 3)298}299func anySpec() *gauge.Specification {300 specText := SpecBuilder().specHeading("A spec heading").301 scenarioHeading("First scenario").302 step("create user \"456\" \"foo\" and \"9900\"").303 String()304 spec, _ := new(parser.SpecParser).Parse(specText, gauge.NewConceptDictionary(), "")305 spec.FileName = "FILE"306 return spec307}308func (s *MySuite) TestSpecIsSkippedIfDataRangeIsInvalid(c *C) {309 errMap := &gauge.BuildErrors{310 SpecErrs: make(map[*gauge.Specification][]error),311 ScenarioErrs: make(map[*gauge.Scenario][]error),312 StepErrs: make(map[*gauge.Step]error),313 }314 spec := anySpec()315 errMap.SpecErrs[spec] = []error{validation.NewSpecValidationError("Table row number out of range", spec.FileName)}316 se := newSpecExecutor(spec, nil, nil, errMap, 0)317 specResult := se.execute()318 c.Assert(specResult.Skipped, Equals, true)319}320func (s *MySuite) TestDataTableRowsAreSkippedForUnimplemetedStep(c *C) {321 stepText := "Unimplememted step"322 specText := SpecBuilder().specHeading("A spec heading").323 tableHeader("id", "name", "phone").324 tableRow("123", "foo", "8800").325 tableRow("666", "bar", "9900").326 scenarioHeading("First scenario").327 step(stepText).328 step("create user <id> <name> and <phone>").329 String()330 spec, _ := new(parser.SpecParser).Parse(specText, gauge.NewConceptDictionary(), "")331 errMap := &gauge.BuildErrors{332 SpecErrs: make(map[*gauge.Specification][]error),333 ScenarioErrs: make(map[*gauge.Scenario][]error),334 StepErrs: make(map[*gauge.Step]error),335 }336 errMap.SpecErrs[spec] = []error{validation.NewSpecValidationError("Step implementation not found", spec.FileName)}337 se := newSpecExecutor(spec, nil, nil, errMap, 0)...

Full Screen

Full Screen

results.go

Source:results.go Github

copy

Full Screen

1package coletores2import (3 "time"4)5// ExecutionResult collects the results of the whole dadosjusbr execution pipeline.6type ExecutionResult struct {7 Pr PackagingResult `json:"pr,omitempty"`8 Cr CrawlingResult `json:"cr,omitempty"`9}10// ProcInfo stores information about a process execution.11//12// NOTE 1: It could be used by any process in the data consolidation pipeline (i.e. validation) and should not contain information specific to a step.13// NOTE 2: Due to storage restrictions, as of 04/2020, we are only going to store process information when there is a failure. That allow us to make the consolidation simpler by storing the full14// stdout, stderr and env instead of backing everything up and storing links.15type ProcInfo struct {16 Stdin string `json:"stdin" bson:"stdin,omitempty"` // String containing the standard input of the process.17 Stdout string `json:"stdout" bson:"stdout,omitempty"` // String containing the standard output of the process.18 Stderr string `json:"stderr" bson:"stderr,omitempty"` // String containing the standard error of the process.19 Cmd string `json:"cmd" bson:"cmd,omitempty"` // Command that has been executed20 CmdDir string `json:"cmddir" bson:"cmdir,omitempty"` // Local directory, in which the command has been executed21 ExitStatus int `json:"status,omitempty" bson:"status,omitempty"` // Exit code of the process executed22 Env []string `json:"env,omitempty" bson:"env,omitempty"` // Copy of strings representing the environment variables in the form ke=value23}24// PackagingResult stores the result of the package step, which creates the datapackage.25type PackagingResult struct {26 ProcInfo ProcInfo `json:"procinfo,omitempty"` // Information about the process execution27 Package string `json:"package"` // Local file path of the package created by the step28}29// Crawler keeps information about the crawler.30type Crawler struct {31 CrawlerID string `json:"id" bson:"id,omitempty"` // Convention: crawler the directory32 CrawlerVersion string `json:"version" bson:"version,omitempty"` // Convention: crawler commit id33}34// CrawlingResult stores the result of a crawler-parser ("coletor") run.35type CrawlingResult struct {36 AgencyID string `json:"aid"`37 Month int `json:"month"`38 Year int `json:"year"`39 Crawler Crawler `json:"crawler"`40 Files []string `json:"files"`41 Employees []Employee `json:"employees"`42 Timestamp time.Time `json:"timestamp"`43 ProcInfo ProcInfo `json:"procinfo,omitempty"`44}45// Employee a Struct that reflets a employee snapshot, containing all relative data about a employee46type Employee struct {47 Reg string `json:"reg" bson:"reg,omitempty" tableheader:"reg" csv:"reg"` // Register number48 Name string `json:"name" bson:"name,omitempty" tableheader:"name" csv:"name"`49 Role string `json:"role" bson:"role,omitempty" tableheader:"role" csv:"role"`50 Type *string `json:"type" bson:"type,omitempty" tableheader:"type" csv:"type"` // servidor, membro, pensionista or indefinido51 Workplace string `json:"workplace" bson:"workplace,omitempty" tableheader:"workplace" csv:"workplace"` // 'Lotacao' Like '10° Zona eleitoral'52 Active bool `json:"active" bson:"active,omitempty" tableheader:"active" csv:"active"` // 'Active' Or 'Inactive'53 Income *IncomeDetails `json:"income" bson:"income,omitempty" csv:"-"`54 Discounts *Discount `json:"discounts" bson:"discounts,omitempty" csv:"-"`55}56// IncomeDetails a Struct that details an employee's income.57type IncomeDetails struct {58 Total float64 `json:"total" bson:"total,omitempty" tableheader:"income_total" csv:"income_total"`59 Wage *float64 `json:"wage" bson:"wage,omitempty" tableheader:"wage" csv:"wage"`60 Perks *Perks `json:"perks" bson:"perks,omitempty" csv:"-"`61 Other *Funds `json:"other" bson:"other,omitempty" csv:"-"` // other funds that make up the total income of the employee. further details explained below62}63// Perks a Struct that details perks that complements an employee's wage.64// Confused? Our Dictonary:65// Name | Pt-BR | Description | About66// Perks | 'Indenizações' | Is the amount of compensation or reparation for acts that result in damages to the employee | https://www.jusbrasil.com.br/topicos/290794/indenizacao67// Food | 'Auxílio Alimentação' | Purpose of subsidizing meal expenses. | https://www.progpe.ufscar.br/servicos/adicionais-auxilios-e-beneficios-1/auxilio-alimentacao68// Vacations | 'Férias Indenizadas' | Equivalent to the period not taken when terminating an employment contract, or those not taken during the term of the contract. | http://www.guiatrabalhista.com.br/guia/ferias-indenizadas.htm69// Transportation | 'Auxílio Transporte' | Intended to partially cover the expenses incurred with municipal, intercity or interstate public transportation in the travels made by the employee of his residence to the workplace and vice versa. | https://progep.ufes.br/manual-servidor/auxilio-transporte70// PreSchool | 'Auxílio Creche | Assistance provided before the child enters school | https://viacarreira.com/auxilio-creche/71// Health | 'Auxílio Saúde' | Partial reimbursement of the amount spent by the employee, active or inactive, and their dependents or pensioners with private health care plans. | https://ww2.uft.edu.br/index.php/progedep/acesso-rapido/servicos/15928-auxilio-saude72// BirthAid | 'Auxílio Natalidade' | Granted for the reason of the birth of a child in an amount equivalent to the lowest salary of the public service. | https://progep.ufes.br/aux%C3%ADlio-natalidade73// HousingAid | 'Auxílio Moradia'| Reimbursement of expenses incurred with renting a house or with accommodation managed by a hotel company, to a Employee who has undergone a change of address due to appointment to a management position or a trust function. | http://portal2.trtrio.gov.br:7777/pls/portal/PORTAL.wwv_media.show?p_id=14107300&p_settingssetid=381905&p_settingssiteid=73&p_siteid=73&p_type=basetext&p_textid=1410730174// Subsistence | 'Ajuda de Custo' | Paid only once or eventually, to cover travel expenses incurred by him, such as: transfer expenses, monitoring of internal or external customers a professional events etc. | https://www.arabello.com.br/ajuda-de-custo-a-funcionario-uso-transporte-proprio/#:~:text=Ajuda%20de%20custo%20%C3%A9%20o,externos%20a%20eventos%20profissionais%20etc.75// CompensatoryLeave | 'Licença Compensatória' | 'Compensation to the server for any acquired right.' | http://ampern.org.br/pgj-defere-requerimento-da-ampern-e-altera-a-resolucao-que-disciplina-a-licenca-compensatoria76// Pecuniary | 'Pecunia' | 'payment of any advantage or right of the public servant' | https://www.acheconcursos.com.br/artigos/o-que-e-pecunia-4529077// VacationPecuniary | 'Pecunia de férias' | 'It consists of exchanging a few days of the vacation period for receiving an extra amount. | https://anape.org.br/site/wp-content/uploads/2014/01/004_046_Raimilan_Seneterri_da_Silva_Rodrigues_11082009-23h36m.pdf78// FurnitureTransport | 'Transporte Mobiliário' | 'Amount related to the payment of the transportation of the employee's furniture in case of change' |79// PremiumLicensePecuniary | 'Licença Prêmio' | award to the assiduous and disciplined public employee, guaranteeing him the right to leave the public service for a period, without reducing his wages. | 'https://juridicocerto.com/p/zereshenrique/artigos/conversao-de-licenca-premio-em-pecunia-1675'80type Perks struct {81 Total float64 `json:"total" bson:"total,omitempty" tableheader:"perks_total" csv:"perks_total"`82 Food *float64 `json:"food" bson:"food,omitempty" tableheader:"perks_food" csv:"perks_food"` // Food Aid83 Vacations *float64 `json:"vacation" bson:"vacation,omitempty" tableheader:"perks_vacation" csv:"perks_vacation"` // Férias Indenizatórias - Vacation perk84 Transportation *float64 `json:"transportation" bson:"transportation,omitempty" tableheader:"perks_transportation" csv:"perks_transportation"` // 'Auxílio Transporte'.85 PreSchool *float64 `json:"pre_school" bson:"pre_school,omitempty" tableheader:"perks_pre_school" csv:"perks_pre_school"` // Assistance provided before the child enters school.86 Health *float64 `json:"health" bson:"health,omitempty" tableheader:"perks_health" csv:"perks_health"` // 'Auxílio Saúde'87 BirthAid *float64 `json:"birth_aid" bson:"birth_aid,omitempty" tableheader:"perks_birth" csv:"perks_birth"` // 'Auxílio Natalidade'88 HousingAid *float64 `json:"housing_aid" bson:"housing_aid,omitempty" tableheader:"perks_housing" csv:"perks_housing"` // 'Auxílio Moradia'89 Subsistence *float64 `json:"subsistence" bson:"subsistence,omitempty" tableheader:"perks_subsistence" csv:"perks_subsistence"` // 'Ajuda de Custo'90 CompensatoryLeave *float64 `json:"compensatory_leave" bson:"compensatory_leave,omitempty" tableheader:"perks_compensatory_leave" csv:"perks_compensatory_leave"` // 'Licença Compensatória'91 Pecuniary *float64 `json:"pecuniary" bson:"pecuniary,omitempty" tableheader:"perks_pecuniary" csv:"perks_pecuniary"` // 'Pecunia'92 VacationPecuniary *float64 `json:"vacation_pecuniary" bson:"vacation_pecuniary,omitempty" tableheader:"perks_vacation_pecuniary" csv:"perks_vacation_pecuniary"` // 'Pecunia de férias'93 FurnitureTransport *float64 `json:"furniture_transport" bson:"furniture_transport,omitempty" tableheader:"perks_furniture_transport" csv:"perks_furniture_transport"` // 'Transporte Mobiliário'94 PremiumLicensePecuniary *float64 `json:"premium_license_pecuniary" bson:"premium_license_pecuniary,omitempty" tableheader:"perks_premium_license_pecuniary" csv:"perks_premium_license_pecuniary"` // 'Licença prêmio em pecúnia (Geralmente as que nao foram gozadas, passam pros sucessores)'95}96// Funds a Struct that details that make up the employee income.97type Funds struct {98 Total float64 `json:"total" bson:"total,omitempty" tableheader:"funds_total" csv:"funds_total"`99 PersonalBenefits *float64 `json:"personal_benefits" bson:"personal_benefits,omitempty" tableheader:"funds_personal_benefits" csv:"funds_personal_benefits"` // Permanent Allowance, VPI, Benefits adquired thought judicial demand and others personal.100 EventualBenefits *float64 `json:"eventual_benefits" bson:"eventual_benefits,omitempty" tableheader:"funds_eventual_benefits" csv:"funds_eventual_benefits"` // Holidays, Others Temporary Wage, Christmas bonus and some others eventual.101 PositionOfTrust *float64 `json:"trust_position" bson:"trust_position,omitempty" tableheader:"funds_trust_position" csv:"funds_trust_position"` // Income given for the importance of the position held.102 Daily *float64 `json:"daily" bson:"daily,omitempty" tableheader:"funds_daily" csv:"funds_daily"` // Employee reimbursement for eventual expenses when working in a different location than usual.103 Gratification *float64 `json:"gratification" bson:"gratification,omitempty" tableheader:"funds_gratification" csv:"funds_gratification"` //104 OriginPosition *float64 `json:"origin_pos" bson:"origin_pos,omitempty" tableheader:"funds_origin_pos" csv:"funds_origin_pos"` // Wage received from other Agency, transfered employee.105 OtherFundsTotal *float64 `json:"others_total" bson:"others_total,omitempty" tableheader:"funds_others_total" csv:"funds_others_total"` // Total of Any other kind of income that does not have a pattern among the Agencys.106 Others map[string]float64 `json:"others" bson:"others,omitempty" csv:"-"` // Any other kind of income that does not have a pattern among the Agencys.107}108// Discount a Struct that details all discounts that must be applied to the employee's income.109type Discount struct {110 Total float64 `json:"total" bson:"total,omitempty" tableheader:"discounts_total" csv:"discounts_total"`111 PrevContribution *float64 `json:"prev_contribution" bson:"prev_contribution,omitempty" tableheader:"discounts_prev_contribution" csv:"discount_prev_contribution"` // 'Contribuição Previdenciária'112 CeilRetention *float64 `json:"ceil_retention" bson:"ceil_retention,omitempty" tableheader:"discounts_ceil_retention" csv:"discounts_ceil_retention"` // 'Retenção de teto'113 IncomeTax *float64 `json:"income_tax" bson:"income_tax,omitempty" tableheader:"discounts_income_tax" csv:"discounts_income_tax"` // 'Imposto de renda'114 OtherDiscountsTotal *float64 `json:"others_total" bson:"others_total,omitempty" tableheader:"discounts_others_total" csv:"discounts_others_total"` // Total of Any other kind of income that does not have a pattern among the Agencys.115 Others map[string]float64 `json:"other" bson:"other,omitempty" csv:"-"` // Any other kind of discount that does not have a pattern among the Agencys.116}...

Full Screen

Full Screen

tableHeader

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 f := excelize.NewFile()4 index := f.NewSheet("Sheet2")5 f.SetCellValue("Sheet2", "A1", "Hello world.")6 f.SetCellValue("Sheet2", "B2", 100)7 f.SetActiveSheet(index)8 err := f.SaveAs("Book1.xlsx")9 if err != nil {10 fmt.Println(err)11 }12}

Full Screen

Full Screen

tableHeader

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 f := excelize.NewFile()4 index := f.NewSheet("Sheet2")5 f.SetCellValue("Sheet2", "A2", "Hello world.")6 f.SetCellValue("Sheet2", "B2", 100)7 f.SetActiveSheet(index)8 err := f.SaveAs("./Book1.xlsx")9 if err != nil {10 fmt.Println(err)11 }12}

Full Screen

Full Screen

tableHeader

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 f := excelize.NewFile()4 index := f.NewSheet("Sheet1")5 f.SetActiveSheet(index)6 if err := f.SaveAs("Book1.xlsx"); err != nil {7 fmt.Println(err)8 }9 xlsx, err := excelize.OpenFile("Book1.xlsx")10 if err != nil {11 fmt.Println(err)12 os.Exit(1)13 }14 rows := xlsx.GetRows("Sheet1")15 for _, row := range rows {16 for _, colCell := range row {17 fmt.Print(colCell, "\t")18 }19 fmt.Println()20 }

Full Screen

Full Screen

tableHeader

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 app := cli.NewApp()4 app.Flags = []cli.Flag{5 cli.StringFlag{6 },7 }8 app.Action = func(c *cli.Context) error {9 header := c.String("header")10 tableHeader(header)11 }12 app.Run(os.Args)13}14import (15func main() {16 app := cli.NewApp()17 app.Flags = []cli.Flag{18 cli.StringFlag{19 },20 }21 app.Action = func(c *cli.Context) error {22 row := c.String("row")23 tableRow(row)24 }25 app.Run(os.Args)26}27import (28func main() {29 app := cli.NewApp()30 app.Flags = []cli.Flag{31 cli.StringFlag{32 },33 }34 app.Action = func(c *cli.Context) error {35 data := c.String("data")36 tableData(data)37 }38 app.Run(os.Args)39}40import (41func main() {

Full Screen

Full Screen

tableHeader

Using AI Code Generation

copy

Full Screen

1import (2type Execution struct {3}4func (e *Execution) sortData() {5 sort.Slice(e.data, func(i, j int) bool {6 })7}8func (e *Execution) tableHeader() {9 e.sortData()10 for _, v := range e.header {11 fmt.Printf("%s\t", v)12 }13 fmt.Println()14}15func (e *Execution) tableData() {16 e.sortData()17 for _, v := range e.data {18 for _, v1 := range v {19 fmt.Printf("%s\t", v1)20 }21 fmt.Println()22 }23}24func (e *Execution) printTable() {25 e.tableHeader()26 e.tableData()27}28func main() {29 e := Execution{}30 e.header = strings.Split("id name age", " ")31 e.data = [][]string{32 strings.Split("1 John 20", " "),33 strings.Split("2 Steve 21", " "),34 strings.Split("3 Anna 19", " "),35 }36 e.printTable()37}

Full Screen

Full Screen

tableHeader

Using AI Code Generation

copy

Full Screen

1import (2type Execution struct {3 tableHeader func()4 tableFooter func()5 tableRow func()6 tableColumn func()7}8func (e Execution) tableHeader() {9 fmt.Println("----------------------------------------------------------")

Full Screen

Full Screen

tableHeader

Using AI Code Generation

copy

Full Screen

1func (e *Execution) tableHeader() {2 fmt.Println("1. Create a New Account")3 fmt.Println("2. Update an Existing Account")4 fmt.Println("3. Delete an Existing Account")5 fmt.Println("4. View an Existing Account")6 fmt.Println("5. View All Accounts")7 fmt.Println("6. Exit")8}9func (e *Execution) tableFooter() {10 fmt.Println("--------------------------------------------------------------------")11}12func (e *Execution) tableFooter2() {13 fmt.Println("--------------------------------------------------------------------")14}

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