MCPcopy Index your code
hub / github.com/keploy/keploy / Templatize

Function Templatize

cli/templatize.go:17–53  ·  view source on GitHub ↗
(ctx context.Context, logger *zap.Logger, _ *config.Config, serviceFactory ServiceFactory, cmdConfigurator CmdConfigurator)

Source from the content-addressed store, hash-verified

15}
16
17func Templatize(ctx context.Context, logger *zap.Logger, _ *config.Config, serviceFactory ServiceFactory, cmdConfigurator CmdConfigurator) *cobra.Command {
18 var cmd = &cobra.Command{
19 Use: "templatize",
20 Short: "templatize the keploy testcases",
21 Example: `keploy templatize -t "test-set-1,teset-set-3" for particular testsets and keploy templatize for all testsets`,
22 PreRunE: func(cmd *cobra.Command, _ []string) error {
23 return cmdConfigurator.Validate(ctx, cmd)
24 },
25 RunE: func(cmd *cobra.Command, _ []string) error {
26 // Get the replay service.
27 svc, err := serviceFactory.GetService(ctx, cmd.Name())
28 if err != nil {
29 utils.LogError(logger, err, "failed to get service", zap.String("command", cmd.Name()))
30 return nil
31 }
32 var tools toolsSvc.Service
33 var ok bool
34 if tools, ok = svc.(toolsSvc.Service); !ok {
35 utils.LogError(logger, nil, "service doesn't satisfy tools service interface")
36 return nil
37 }
38 if err := tools.Templatize(ctx); err != nil {
39 utils.LogError(logger, err, "failed to templatize test cases")
40 return nil
41 }
42 return nil
43 },
44 }
45
46 err := cmdConfigurator.AddFlags(cmd)
47 if err != nil {
48 utils.LogError(logger, err, "failed to add templatize flags")
49 return nil
50 }
51
52 return cmd
53}

Callers

nothing calls this directly

Calls 7

TemplatizeMethod · 0.95
LogErrorFunction · 0.92
NameMethod · 0.80
ValidateMethod · 0.65
GetServiceMethod · 0.65
AddFlagsMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected