Best Testsigma code snippet using com.testsigma.service.TestStepService.mapDeprecatedActionsWithUpdatesOnes
Source:TestStepService.java
...288 naturalTextActionsService.findById(Long.valueOf(step.getNaturalTextActionId()));289 }290 catch (Exception e){291 if (this.depreciatedIds.contains(step.getNaturalTextActionId()))292 this.mapDeprecatedActionsWithUpdatesOnes(step);293 else {294 log.error(e.getMessage() + " and Not able to Map this Action Id with the Mapper");295 step.setDisabled(true);296 step.setAddonActionId(null);297 stepsMap.put(step, message);298 }299 }300 }301 if (Objects.equals(step.getTestDataType(), TestDataType.function.getDispName()) && step.getType() != TestStepType.CUSTOM_FUNCTION) {302 message = "Deprecated Data Generator / Data Generator not found!";303 defaultDataGeneratorService.find(step.getTestDataFunctionId());304 }305 } catch (Exception e) {306 log.error(e.getMessage());307 step.setDisabled(true);308 step.setAddonActionId(null);309 stepsMap.put(step, message);310 log.info("disabling test steps having template id or addon action id or custom function id is not found!");311 }312 if (step.getType() == TestStepType.CUSTOM_FUNCTION) {313 step.setDisabled(true);314 stepsMap.put(step, "Custom Functions not supported in OS");315 log.info("disabling Custom function test step to avoid further issues, since CSFs are deprecated");316 }317 if (step.getType() == TestStepType.FOR_LOOP) {318 Optional<TestData> testData = testDataService.getRecentImportedEntity(importDTO, step.getForLoopTestDataId());319 if (testData.isPresent())320 step.setForLoopTestDataId(testData.get().getId());321 }322 }323 return steps;324 } else {325 List<TestStep> steps = mapper.mapTestStepsList(xmlMapper.readValue(xmlData, new TypeReference<List<TestStepXMLDTO>>() {326 }));327 for (TestStep step : steps) {328 if (step.getTestDataProfileStepId() != null) {329 Optional<TestData> testData = testDataService.getRecentImportedEntity(importDTO, step.getTestDataProfileStepId());330 testData.ifPresent(data -> step.setTestDataProfileStepId(data.getId()));331 }332 if (step.getType() == TestStepType.FOR_LOOP) {333 Optional<TestData> testData = testDataService.getRecentImportedEntity(importDTO, step.getForLoopTestDataId());334 testData.ifPresent(data -> step.setForLoopTestDataId(data.getId()));335 }336 }337 return steps;338 }339 }340 private void mapDeprecatedActionsWithUpdatesOnes(TestStep step) {341 ActionTestDataMap filteredMap = this.actionTestDataMap.stream().filter(dataMap -> dataMap.getTestDataHash().containsKey(step.getNaturalTextActionId())).findFirst().orElse(null);342 if (filteredMap != null) {343 step.setTestData(filteredMap.getTestDataHash().get(step.getNaturalTextActionId()));344 step.setNaturalTextActionId(filteredMap.getOptimizedActionId());345 step.setTestDataType(TestDataType.raw.getDispName());346 }347 }348 @Override349 public Optional<TestStep> findImportedEntity(TestStep testStep, BackupDTO importDTO) {350 Optional<TestCase> testCase = testCaseService.getRecentImportedEntity(importDTO, testStep.getTestCaseId());351 if (testCase.isEmpty()) {352 return Optional.empty();353 }354 Optional<TestStep> previous = repository.findByTestCaseIdInAndImportedId(List.of(testCase.get().getId()), testStep.getId());...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!