func GenerateTestCases(params *GenerationParameters) ([]model.TestCase, Scripts, error) {
	logger := logrus.WithFields(logrus.Fields{
		"function": "GenerateTestCases",
	})

	specType, err := GetSpecType(params.Spec.SchemaVersion)
	if err != nil {
		return nil, Scripts{}, errors.New("unknown specification " + params.Spec.SchemaVersion)

	}
	logrus.Debug("GenerateManifestTestCases for spec type:" + specType)
	scripts, refs, err := LoadGenerationResources(specType, params.ManifestPath, params.Ctx)
	if err != nil {
		logger.WithFields(logrus.Fields{
			"err": err,
		}).Error("Error on loadGenerationResources")
		return nil, Scripts{}, err
	}
	var filteredScripts Scripts
	if specType == "accounts" {
		filteredScripts, err = FilterTestsBasedOnDiscoveryEndpoints(scripts, params.Endpoints, accountsRegex)
		if err != nil {
			logger.WithFields(logrus.Fields{"err": err}).Error("error filter scripts based on accounts discovery")
		}
	} else if specType == "payments" {
		filteredScripts, err = FilterTestsBasedOnDiscoveryEndpoints(scripts, params.Endpoints, paymentsRegex)
		if err != nil {
			logger.WithFields(logrus.Fields{"err": err}).Error("error filter scripts based on payments discovery")
		}
	} else if specType == "cbpii" {
		filteredScripts, err = FilterTestsBasedOnDiscoveryEndpoints(scripts, params.Endpoints, cbpiiRegex)
		if err != nil {
			logger.WithFields(logrus.Fields{"err": err}).Error("error filter scripts based on cbpii discovery")
		}
	} else if specType == "vrps" {
		filteredScripts, err = FilterTestsBasedOnDiscoveryEndpoints(scripts, params.Endpoints, vrpRegex)
		if err != nil {
			logger.WithFields(logrus.Fields{"err": err}).Error("error filter scripts based on vrp discovery")
		}
	} else {
		filteredScripts = scripts // normal processing
	}

	params.Ctx.DumpContext("Incoming Ctx")

	tests := []model.TestCase{}

	for _, script := range filteredScripts.Scripts {
		localCtx, err := script.processParameters(&refs, params.Ctx)
		if err != nil {
			logger.WithError(err).Error("Error on processParameters")
			return nil, Scripts{}, err
		}

		interactionId := uuid.New().String()
		tc, err := buildTestCase(script, refs.References, localCtx, params.Baseurl, specType, params.Validator, params.Spec, interactionId)
		if err != nil {
			logger.WithError(err).Error("Error on testCaseBuilder")
		}

		localCtx.PutContext(params.Ctx)
		showReplacementErrors := true
		tc.ProcessReplacementFields(localCtx, showReplacementErrors)

		err = addConditionalPropertiesToRequest(&tc, params.Conditional, logger)
		if err != nil {
			return nil, Scripts{}, err
		}

		addQueryParametersToRequest(&tc, script.QueryParameters)
		tests = append(tests, tc)
	}

	return tests, filteredScripts, nil
}
// GenerateTestCases examines a manifest file, asserts file and resources definition, then builds the associated test cases
GenerateTestCases examines a manifest file, asserts file and resources definition, then builds the associated test cases
// GenerateTestCases examines a manifest file asserts file and resources definition then builds the associated test cases
func GenerateTestCases(params *GenerationParameters) ([]model.TestCase, Scripts, error) {
	logger := logrus.WithFields(logrus.Fields{
		"function": "GenerateTestCases",
	})
	specType, err := GetSpecType(params.Spec.SchemaVersion)
	if err != nil {
		return nil, Scripts{}, errors.New("unknown specification " + params.Spec.SchemaVersion)
	}
	logrus.Debug("GenerateManifestTestCases for spec type:" + specType)
	scripts, refs, err := LoadGenerationResources(specType, params.ManifestPath, params.Ctx)
	if err != nil {
		logger.WithFields(logrus.Fields{
			"err": err,
		}).Error("Error on loadGenerationResources")
		return nil, Scripts{}, err
	}
	var filteredScripts Scripts
	if specType == "accounts" {
		filteredScripts, err = FilterTestsBasedOnDiscoveryEndpoints(scripts, params.Endpoints, accountsRegex)
		if err != nil {
			logger.WithFields(logrus.Fields{"err": err}).Error("error filter scripts based on accounts discovery")
		}
	} else if specType == "payments" {
		filteredScripts, err = FilterTestsBasedOnDiscoveryEndpoints(scripts, params.Endpoints, paymentsRegex)
		if err != nil {
			logger.WithFields(logrus.Fields{"err": err}).Error("error filter scripts based on payments discovery")
		}
	} else if specType == "cbpii" {
		filteredScripts, err = FilterTestsBasedOnDiscoveryEndpoints(scripts, params.Endpoints, cbpiiRegex)
		if err != nil {
			logger.WithFields(logrus.Fields{"err": err}).Error("error filter scripts based on cbpii discovery")
		}
	} else if specType == "vrps" {
		filteredScripts, err = FilterTestsBasedOnDiscoveryEndpoints(scripts, params.Endpoints, vrpRegex)
		if err != nil {
			logger.WithFields(logrus.Fields{"err": err}).Error("error filter scripts based on vrp discovery")
		}
	} else {
		filteredScripts = scripts 
	}
	params.Ctx.DumpContext("Incoming Ctx")
	tests := []model.TestCase{}
	for _, script := range filteredScripts.Scripts {
		localCtx, err := script.processParameters(&refs, params.Ctx)
		if err != nil {
			logger.WithError(err).Error("Error on processParameters")
			return nil, Scripts{}, err
		}
		interactionId := uuid.New().String()
		tc, err := buildTestCase(script, refs.References, localCtx, params.Baseurl, specType, params.Validator, params.Spec, interactionId)
		if err != nil {
			logger.WithError(err).Error("Error on testCaseBuilder")
		}
		localCtx.PutContext(params.Ctx)
		showReplacementErrors := true
		tc.ProcessReplacementFields(localCtx, showReplacementErrors)
		err = addConditionalPropertiesToRequest(&tc, params.Conditional, logger)
		if err != nil {
			return nil, Scripts{}, err
		}
		addQueryParametersToRequest(&tc, script.QueryParameters)
		tests = append(tests, tc)
	}
	return tests, filteredScripts, nil
}
func GenerateTestCases ( params * GenerationParameters ) ( [ ] model . TestCase , Scripts , error ) { logger := logrus . WithFields ( logrus . Fields { " " : " " , } ) specType , err := GetSpecType ( params . Spec . SchemaVersion ) if err != nil { return nil , Scripts { } , errors . New ( " " + params . Spec . SchemaVersion ) } logrus . Debug ( " " + specType ) scripts , refs , err := LoadGenerationResources ( specType , params . ManifestPath , params . Ctx ) if err != nil { logger . WithFields ( logrus . Fields { " " : err , } ) . Error ( " " ) return nil , Scripts { } , err } var filteredScripts Scripts if specType == " " { filteredScripts , err = FilterTestsBasedOnDiscoveryEndpoints ( scripts , params . Endpoints , accountsRegex ) if err != nil { logger . WithFields ( logrus . Fields { " " : err } ) . Error ( " " ) } } else if specType == " " { filteredScripts , err = FilterTestsBasedOnDiscoveryEndpoints ( scripts , params . Endpoints , paymentsRegex ) if err != nil { logger . WithFields ( logrus . Fields { " " : err } ) . Error ( " " ) } } else if specType == " " { filteredScripts , err = FilterTestsBasedOnDiscoveryEndpoints ( scripts , params . Endpoints , cbpiiRegex ) if err != nil { logger . WithFields ( logrus . Fields { " " : err } ) . Error ( " " ) } } else if specType == " " { filteredScripts , err = FilterTestsBasedOnDiscoveryEndpoints ( scripts , params . Endpoints , vrpRegex ) if err != nil { logger . WithFields ( logrus . Fields { " " : err } ) . Error ( " " ) } } else { filteredScripts = scripts } params . Ctx . DumpContext ( " " ) tests := [ ] model . TestCase { } for _ , script := range filteredScripts . Scripts { localCtx , err := script . processParameters ( & refs , params . Ctx ) if err != nil { logger . WithError ( err ) . Error ( " " ) return nil , Scripts { } , err } interactionId := uuid . New ( ) . String ( ) tc , err := buildTestCase ( script , refs . References , localCtx , params . Baseurl , specType , params . Validator , params . Spec , interactionId ) if err != nil { logger . WithError ( err ) . Error ( " " ) } localCtx . PutContext ( params . Ctx ) showReplacementErrors := true tc . ProcessReplacementFields ( localCtx , showReplacementErrors ) err = addConditionalPropertiesToRequest ( & tc , params . Conditional , logger ) if err != nil { return nil , Scripts { } , err } addQueryParametersToRequest ( & tc , script . QueryParameters ) tests = append ( tests , tc ) } return tests , filteredScripts , nil }
GenerateTestCases examines a manifest file, asserts file and resources definition, then builds the associated test cases
GenerateTestCases examines a manifest file asserts file and resources definition then builds the associated test cases
// normal processing