How to use TestStepDTO class of com.testsigma.dto package

Best Testsigma code snippet using com.testsigma.dto.TestStepDTO

Source:StepProcessor.java Github

copy

Full Screen

...25 protected List<TestCaseStepEntityDTO> testCaseStepEntityDTOS;26 protected WorkspaceType workspaceType;27 protected Map<String, Element> elementMap;28 protected TestDataSet testDataSet;29 protected TestStepDTO testStepDTO;30 protected Map<String, String> environmentParameters;31 protected TestCaseEntityDTO testCaseEntityDTO;32 protected String environmentParamSetName;33 protected String dataProfile;34 protected TestDataProfileService testDataProfileService;35 protected ElementMapper elementMapper;36 protected NaturalTextActionsService naturalTextActionsService;37 protected StorageService storageService;38 protected RestStepService restStepService;39 protected TestStepMapper testStepMapper;40 protected ProxyAddonService addonService;41 protected DefaultDataGeneratorService defaultDataGeneratorService;42 WebApplicationContext webApplicationContext;43 public StepProcessor(WebApplicationContext webApplicationContext, List<TestCaseStepEntityDTO> testCaseStepEntityDTOS,44 WorkspaceType workspaceType, Map<String, Element> elementMap,45 TestStepDTO testStepDTO, Long testPlanId, TestDataSet testDataSet,46 Map<String, String> environmentParameters, TestCaseEntityDTO testCaseEntityDTO, String environmentParamSetName,47 String dataProfile) {48 this.webApplicationContext = webApplicationContext;49 this.testCaseStepEntityDTOS = testCaseStepEntityDTOS;50 this.workspaceType = workspaceType;51 this.elementMap = elementMap;52 this.testStepDTO = testStepDTO;53 this.testPlanId = testPlanId;54 this.testDataSet = testDataSet;55 this.environmentParameters = environmentParameters;56 this.testCaseEntityDTO = testCaseEntityDTO;57 this.environmentParamSetName = environmentParamSetName;58 this.dataProfile = dataProfile;59 this.testDataProfileService = (TestDataProfileService) webApplicationContext.getBean("testDataProfileService");60 this.elementMapper = (ElementMapper) webApplicationContext.getBean("elementMapperImpl");61 this.testStepMapper = (TestStepMapper) webApplicationContext.getBean("testStepMapperImpl");62 this.naturalTextActionsService = (NaturalTextActionsService) webApplicationContext.getBean("naturalTextActionsService");63 this.storageService = webApplicationContext.getBean(StorageServiceFactory.class).getStorageService();64 this.restStepService = (RestStepService) webApplicationContext.getBean("restStepService");65 this.defaultDataGeneratorService = (DefaultDataGeneratorService) webApplicationContext.getBean("defaultDataGeneratorService");66 this.testStepMapper = (TestStepMapper) webApplicationContext.getBean("testStepMapperImpl");67 this.addonService = (ProxyAddonService) webApplicationContext.getBean("proxyAddonService");68 }69 protected void processDefault(TestCaseStepEntityDTO exeTestStepEntity) throws TestsigmaException {70 exeTestStepEntity.setId(testStepDTO.getId());71 exeTestStepEntity.setType(testStepDTO.getType());72 exeTestStepEntity.setTestCaseId(testStepDTO.getTestCaseId());73 exeTestStepEntity.setAction(testStepDTO.getAction());74 exeTestStepEntity.setTestPlanId(testPlanId);75 exeTestStepEntity.setPriority(testStepDTO.getPriority());76 exeTestStepEntity.setPreRequisite(testStepDTO.getPreRequisiteStepId());77 exeTestStepEntity.setPosition(testStepDTO.getPosition());78 exeTestStepEntity.setIfConditionExpectedResults(testStepDTO.getIfConditionExpectedResults());79 exeTestStepEntity.setAdditionalData(testStepDTO.getDataMapJson());80 exeTestStepEntity.setAddonTestData(testStepDTO.getAddonTestData());81 populateStepDetails(testStepDTO, exeTestStepEntity);82 }83 public TestCaseStepEntityDTO processStep() throws TestsigmaException {84 TestCaseStepEntityDTO exeTestStepEntity = new TestCaseStepEntityDTO();85 exeTestStepEntity.setId(testStepDTO.getId());86 exeTestStepEntity.setType(testStepDTO.getType());87 exeTestStepEntity.setNaturalTextActionId(testStepDTO.getNaturalTextActionId());88 exeTestStepEntity.setTestCaseId(testStepDTO.getTestCaseId());89 exeTestStepEntity.setAction(testStepDTO.getAction());90 exeTestStepEntity.setTestPlanId(testPlanId);91 exeTestStepEntity.setPriority(testStepDTO.getPriority());92 exeTestStepEntity.setPreRequisite(testStepDTO.getPreRequisiteStepId());93 exeTestStepEntity.setPosition(testStepDTO.getPosition());94 exeTestStepEntity.setWaitTime(testStepDTO.getWaitTime() == null ? 0 : testStepDTO.getWaitTime());95 exeTestStepEntity.setIfConditionExpectedResults(testStepDTO.getIfConditionExpectedResults());96 exeTestStepEntity.setAdditionalData(testStepDTO.getDataMapJson());97 populateStepDetails(testStepDTO, exeTestStepEntity);98 if ((testStepDTO.getType() != null &&99 (testStepDTO.getType() == com.testsigma.model.TestStepType.STEP_GROUP)100 || (testStepDTO.getType() == com.testsigma.model.TestStepType.FOR_LOOP))) {101 return exeTestStepEntity;102 }103 if (testStepDTO.getNaturalTextActionId() != null && testStepDTO.getNaturalTextActionId() > 0) {104 NaturalTextActions naturalTextActions = naturalTextActionsService.findById(testStepDTO.getNaturalTextActionId().longValue());105 exeTestStepEntity.setSnippetClass(naturalTextActions.getSnippetClass());106 } else if (testStepDTO.getAddonActionId() != null) {107 exeTestStepEntity.setSnippetEnabled(Boolean.FALSE);108 exeTestStepEntity.setAddonNaturalTextActionEntity(addonService.fetchPluginEntity(testStepDTO.getAddonActionId()));109 }110 setElementMap(exeTestStepEntity);111 setTestDataMap(exeTestStepEntity);112 setAttributesMap(exeTestStepEntity);113 exeTestStepEntity.getStepDetails().setTestDataName(exeTestStepEntity.getTestDataName());114 exeTestStepEntity.getStepDetails().setTestDataValue(exeTestStepEntity.getTestDataValue());115 setAddonPluginStepDetails(exeTestStepEntity);116 return exeTestStepEntity;117 }118 public void setElementMap(TestCaseStepEntityDTO exeTestStepEntity) throws TestsigmaException {119 Map<String, ElementPropertiesDTO> elementsMap = new HashMap<>();120 if (testStepDTO.getAddonActionId() != null) {121 Map<String, AddonElementData> elements = testStepDTO.getAddonElements();122 for (Map.Entry<String, AddonElementData> entry : elements.entrySet()) {123 AddonElementData addonElementData = entry.getValue();124 String elementName = addonElementData.getName();125 ElementPropertiesDTO elementPropertiesDTO = getElementEntityDTO(elementName);126 elementsMap.put(entry.getKey(), elementPropertiesDTO);127 }128 } else {129 String elementName = testStepDTO.getElement();130 String fromElementName = testStepDTO.getFromElement();131 String toElementName = testStepDTO.getToElement();132 if (!org.apache.commons.lang3.StringUtils.isEmpty(elementName)) {133 ElementPropertiesDTO elementPropertiesDTO = getElementEntityDTO(elementName);134 elementsMap.put(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_ELEMENT, elementPropertiesDTO);135 }136 if (!org.apache.commons.lang3.StringUtils.isEmpty(fromElementName)) {137 ElementPropertiesDTO elementPropertiesDTO = getElementEntityDTO(fromElementName);138 elementsMap.put(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_FROM_ELEMENT, elementPropertiesDTO);139 }140 if (!org.apache.commons.lang3.StringUtils.isEmpty(toElementName)) {141 ElementPropertiesDTO elementPropertiesDTO = getElementEntityDTO(toElementName);142 elementsMap.put(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TO_ELEMENT, elementPropertiesDTO);143 }144 }145 exeTestStepEntity.setElementsMap(elementsMap);146 }147 public void setTestDataMap(TestCaseStepEntityDTO exeTestStepEntity) throws TestsigmaException {148 LinkedHashMap<String, com.testsigma.automator.entity.TestDataPropertiesEntity> testDatasMap = new LinkedHashMap<>();149 if (testStepDTO.getAddonActionId() != null || testStepDTO.getAddonTestData() != null) {150 Map<String, AddonTestStepTestData> testDataMap = testStepDTO.getAddonTestData();151 for (Map.Entry<String, AddonTestStepTestData> entry : testDataMap.entrySet()) {152 AddonTestStepTestData addonTestStepTestData = entry.getValue();153 String testDataName = entry.getKey();154 String testDataValue = addonTestStepTestData.getValue();155 String testDataType = addonTestStepTestData.getType().getDispName();156 com.testsigma.automator.entity.TestDataPropertiesEntity testDataPropertiesEntity = getTestDataEntityDTO(testDataName,157 testDataValue, testDataType, addonTestStepTestData,exeTestStepEntity);158 if (com.testsigma.model.TestDataType.getTypeFromName(testDataType) == com.testsigma.model.TestDataType.raw) {159 testDataPropertiesEntity.setTestDataValue(addonTestStepTestData.getValue());160 }161 testDatasMap.put(entry.getKey(), testDataPropertiesEntity);162 }163 } else {164 String testDataName = NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA;165 String testDataValue = testStepDTO.getTestData();166 String testDataType = testStepDTO.getTestDataType();167 if (!org.apache.commons.lang3.StringUtils.isEmpty(testDataName)) {168 com.testsigma.automator.entity.TestDataPropertiesEntity testDataPropertiesEntity = getTestDataEntityDTO(testDataName,169 testDataValue, testDataType, null, exeTestStepEntity);170 if (TestDataType.getTypeFromName(testDataType) == TestDataType.raw) {171 testDataPropertiesEntity.setTestDataValue(testStepDTO.getTestData());172 }173 testDatasMap.put(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA, testDataPropertiesEntity);174 }175 }176 exeTestStepEntity.setTestDataMap(testDatasMap);177 }178 public void setAttributesMap(TestCaseStepEntityDTO exeTestStepEntity) {179 Map<String, AttributePropertiesEntityDTO> attributesMap = new HashMap<>();180 //Custom Action (Or Addon) doesn't have the concept of attributes. They are treated as test-data itself181 //Even normal Action shouldn't have them but since it was supported earlier so we are keeping it for now182 //And should be migrated as normal test data later.183 if (testStepDTO.getAddonActionId() == null) {184 String attributeName = testStepDTO.getAttribute();185 if (!org.apache.commons.lang3.StringUtils.isEmpty(attributeName)) {186 AttributePropertiesEntityDTO attributePropertiesEntityDTO = new AttributePropertiesEntityDTO();187 attributePropertiesEntityDTO.setAttributeName(attributeName);188 attributesMap.put(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_ATTRIBUTE, attributePropertiesEntityDTO);189 }190 }191 exeTestStepEntity.setAttributesMap(attributesMap);192 }193 private ElementPropertiesDTO getElementEntityDTO(String elementName) throws TestsigmaException {194 Element element = elementMap.get(elementName.toLowerCase());195 ElementDTO elementDTO = elementMapper.map(element);196 if (element == null) {197 throw new TestsigmaException(ExceptionErrorCodes.ELEMENT_NOT_FOUND,198 MessageConstants.getMessage(MessageConstants.ELEMENT_WITH_THE_NAME_IS_NOT_AVAILABLE, elementName));199 }200 String locatorValue = updateElement(element, testDataSet, environmentParameters);201 ElementPropertiesDTO elementPropertiesDTO = new ElementPropertiesDTO();202 elementPropertiesDTO.setElementName(elementName);203 elementPropertiesDTO.setLocatorValue(locatorValue);204 elementPropertiesDTO.setLocatorStrategyName(element.getLocatorType().toString());205 elementPropertiesDTO.setFindByType(FindByType.getType(element.getLocatorType()));206 elementPropertiesDTO.setElementEntity(elementDTO);207 return elementPropertiesDTO;208 }209 private com.testsigma.automator.entity.TestDataPropertiesEntity getTestDataEntityDTO(String testDataName, String testDataValue,210 String testDataType, AddonTestStepTestData211 addonTestStepTestData, TestCaseStepEntityDTO testCaseStepEntityDTO)212 throws TestsigmaException {213 com.testsigma.automator.entity.TestDataPropertiesEntity testDataPropertiesEntity = new com.testsigma.automator.entity.TestDataPropertiesEntity();214 testDataPropertiesEntity.setTestDataType(testDataType);215 switch (com.testsigma.model.TestDataType.getTypeFromName(testDataType)) {216 case environment:217 if ((environmentParameters == null)) {218 throw new TestsigmaException(ExceptionErrorCodes.ENVIRONMENT_PARAMETERS_NOT_CONFIGURED,219 MessageConstants.getMessage(MessageConstants.MSG_UNKNOWN_ENVIRONMENT_DATA_SET));220 } else if (environmentParameters.get(testDataValue) == null) {221 throw new TestsigmaException(ExceptionErrorCodes.ENVIRONMENT_PARAMETER_NOT_FOUND,222 MessageConstants.getMessage(MessageConstants.MSG_UNKNOWN_ENVIRONMENT_PARAMETER_IN_TEST_STEP, testDataValue,223 testCaseEntityDTO.getTestCaseName(), environmentParamSetName));224 }225 String originalTestDataEnvironmentValue = testDataValue;226 testDataValue = environmentParameters.get(testDataValue);227 break;228 case parameter:229 if ((testDataSet == null) || (testDataSet.getData() == null)) {230 throw new TestsigmaException(ExceptionErrorCodes.TEST_DATA_SET_NOT_FOUND,231 com.testsigma.constants.MessageConstants.getMessage(MessageConstants.MSG_UNKNOWN_TEST_DATA_SET));232 }233 String originalTestDataValue = testDataValue;234 testDataValue = testDataSet.getData().has(testDataValue) ? (String) testDataSet.getData().get(testDataValue) :235 null;236 if (testDataValue == null) {237 throw new TestsigmaException(ExceptionErrorCodes.TEST_DATA_NOT_FOUND,238 MessageConstants.getMessage(MessageConstants.MSG_UNKNOWN_TEST_DATA_PARAMETER_IN_TEST_STEP,239 testDataName, testCaseEntityDTO.getTestCaseName(), dataProfile));240 }241 break;242 case random:243 case runtime:244 break;245 case function:246 populateDefaultDataGeneratorsEntity(testDataPropertiesEntity, addonTestStepTestData,testCaseStepEntityDTO);247 break;248 default:249 }250 testDataPropertiesEntity.setTestDataName(testDataName);251 testDataPropertiesEntity.setTestDataValue(testDataValue);252 return testDataPropertiesEntity;253 }254 public void populateStepDetails(TestStepDTO testStepDTO, TestCaseStepEntityDTO testCaseStepEntityDTO) {255 StepDetailsDTO stepDetails = new StepDetailsDTO();256 stepDetails.setNaturalTextActionId(testStepDTO.getNaturalTextActionId());257 stepDetails.setAction(testStepDTO.getAction());258 stepDetails.setPriority(Optional.ofNullable(testStepDTO.getPriority()).orElse(null));259 stepDetails.setPreRequisiteStepId(testStepDTO.getPreRequisiteStepId());260 stepDetails.setConditionType(testStepDTO.getConditionType());261 stepDetails.setParentId(testStepDTO.getParentId());262 stepDetails.setType(Optional.ofNullable(testStepDTO.getType()).orElse(null));263 stepDetails.setStepGroupId(testStepDTO.getStepGroupId());264 stepDetails.setAction(testStepDTO.getAction());265 stepDetails.setPosition(testStepDTO.getPosition());266 stepDetails.setTestDataName(testCaseStepEntityDTO.getTestDataName());267 stepDetails.setTestDataValue(testCaseStepEntityDTO.getTestDataValue());268 stepDetails.setDataMap(testStepMapper.mapDataMap(testStepDTO.getDataMapBean()));269 stepDetails.setIgnoreStepResult(testStepDTO.getIgnoreStepResult());270 testCaseStepEntityDTO.setStepDetails(stepDetails);271 }272 private void setAddonPluginStepDetails(TestCaseStepEntityDTO exeTestStepEntity) {273 if (testStepDTO.getAddonActionId() != null) {274 exeTestStepEntity.setAddonTestData(testStepDTO.getAddonTestData());275 exeTestStepEntity.setAddonElements(testStepDTO.getAddonElements());276 }277 }278 public void loadLoop(TestStepDTO stepDTOEntity, List<TestStepDTO> stepDTOEntities,279 List<Long> loopIds) {280 List<TestStepDTO> loopSteps = new ArrayList<>();281 TestStepDTO childTestStepDTO;282 List<Long> childConditions = new ArrayList<>();283 for (int index = 0; index < stepDTOEntities.size(); index++) {284 childTestStepDTO = stepDTOEntities.get(index);285 if ((childTestStepDTO.getParentId() != null && childTestStepDTO.getParentId() > 0 && stepDTOEntity.getId() != null286 && (childTestStepDTO.getParentId().equals(stepDTOEntity.getId()) ||287 (childConditions.indexOf(childTestStepDTO.getParentId()) > -1)))) {288 if (childTestStepDTO.getType() != null &&289 (com.testsigma.model.TestStepType.FOR_LOOP.equals(childTestStepDTO.getType())290 || TestStepConditionType.LOOP_WHILE.equals(childTestStepDTO.getConditionType()))) {291 loadLoop(childTestStepDTO, stepDTOEntities, loopIds);292 } else {293 childConditions.add(childTestStepDTO.getId());294 }295 loopIds.add(childTestStepDTO.getId());296 loopSteps.add(childTestStepDTO);297 }298 }299 stepDTOEntity.setTestStepDTOS(loopSteps);300 }301 private void populateDefaultDataGeneratorsEntity(com.testsigma.automator.entity.TestDataPropertiesEntity testDataPropertiesEntity,302 AddonTestStepTestData addonTestStepTestData, TestCaseStepEntityDTO exeTestStepEntity)303 throws TestsigmaException {304 DefaultDataGeneratorsEntity defaultDataGeneratorsEntity = new DefaultDataGeneratorsEntity();305 try {306 if (testStepDTO.getAddonActionId() != null) {307 populateTestDataFunctionDetailsFromId(defaultDataGeneratorsEntity, addonTestStepTestData, exeTestStepEntity);308 } else {309 populateTestDataFunctionDetailsFromMap(defaultDataGeneratorsEntity, exeTestStepEntity);310 }311 testDataPropertiesEntity.setDefaultDataGeneratorsEntity(defaultDataGeneratorsEntity);312 } catch (Exception e) {313 throw new TestsigmaException(e.getMessage(), e);...

Full Screen

Full Screen

Source:RestStepProcessor.java Github

copy

Full Screen

...23public class RestStepProcessor extends StepProcessor {24 private final static String TESTSIGMA_STORAGE = "testsigma-storage:";25 public RestStepProcessor(WebApplicationContext webApplicationContext, List<TestCaseStepEntityDTO> testCaseStepEntityDTOS,26 WorkspaceType workspaceType, Map<String, Element> elementMap,27 TestStepDTO testStepDTO, Long testPlanId, TestDataSet testDataSet,28 Map<String, String> environmentParams, TestCaseEntityDTO testCaseEntityDTO,29 String environmentParamSetName, String dataProfile) {30 super(webApplicationContext, testCaseStepEntityDTOS, workspaceType, elementMap, testStepDTO, testPlanId, testDataSet,31 environmentParams, testCaseEntityDTO, environmentParamSetName, dataProfile);32 }33 public void process() throws TestsigmaException {34 TestCaseStepEntityDTO testCaseStepEntityDTO = new TestCaseStepEntityDTO();35 testCaseStepEntityDTO.setId(testStepDTO.getId());36 processDefault(testCaseStepEntityDTO);37 testCaseStepEntityDTOS.add(testCaseStepEntityDTO);38 Map<String, Object> restDetails = new HashMap<>();39 try {40 if (testCaseEntityDTO.getTestDataId() != null) {41 TestData testData = testDataProfileService.find(testCaseEntityDTO.getTestDataId());42 }43 RestStep restStep = restStepService.findByStepId(testStepDTO.getId());44 //in restful application if the type is custom function skip45 if (restStep == null) {46 return;47 }48 RestStepDTO restEntity = testStepMapper.map(restStep);49 processMultipart(restEntity);50 if (testStepDTO.getConditionType() != TestStepConditionType.CONDITION_ELSE) {51 restEntity.setRequestHeaders(replaceTestDataAndEnvironmentParams(ObjectUtils.defaultIfNull(52 restEntity.getRequestHeaders(), new JSONObject())));53 restEntity.setAuthorizationValue(replaceTestDataAndEnvironmentParams(ObjectUtils.defaultIfNull(54 restEntity.getAuthorizationValue(), new JSONObject())));55 restEntity.setUrl(replaceTestDataAndEnvironmentParams(restEntity.getUrl()));56 restEntity.setPayload(replaceTestDataAndEnvironmentParams(restEntity.getPayload()));57 restEntity.setResponse(replaceTestDataAndEnvironmentParams(restEntity.getResponse()));58 restEntity.setStatus(replaceTestDataAndEnvironmentParams(restEntity.getStatus()));59 restDetails.put("rest_details", testStepMapper.mapStepEntity(restEntity));60 testCaseStepEntityDTO.setIfConditionExpectedResults(testStepDTO.getIfConditionExpectedResults());61 testCaseStepEntityDTO.setAdditionalData(testStepDTO.getDataMapJson());62 }63 } catch (TestsigmaException e) {64 log.error(e.getMessage(), e);65 throw e;66 } catch (Exception e) {67 log.error(e.getMessage(), e);68 throw new TestsigmaException(e.getMessage(), e.getMessage());69 }70 testCaseStepEntityDTO.setStepGroupId(testStepDTO.getStepGroupId());71 testCaseStepEntityDTO.setParentId(testStepDTO.getParentId());72 testCaseStepEntityDTO.setConditionType(testStepDTO.getConditionType());73 testCaseStepEntityDTO.setTestCaseId(testStepDTO.getTestCaseId());74 if (testStepDTO.getDataMapJson() != null) {75 restDetails.putAll(testStepDTO.getDataMapJson());76 }77 testCaseStepEntityDTO.setAdditionalData(restDetails);78 }79 public void setStepDetails(TestCaseStepEntityDTO testCaseStepEntityDTO, TestStepDTO testStepDTO) {80 StepDetailsDTO stepDetails = new StepDetailsDTO();81 stepDetails.setNaturalTextActionId(testStepDTO.getNaturalTextActionId());82 stepDetails.setAction(testStepDTO.getAction());83 stepDetails.setPriority(testStepDTO.getPriority());84 stepDetails.setPreRequisiteStepId(testStepDTO.getPreRequisiteStepId());85 stepDetails.setConditionType(testStepDTO.getConditionType());86 stepDetails.setParentId(testStepDTO.getParentId());87 stepDetails.setDataMap(testStepMapper.mapDataMap(testStepDTO.getDataMapBean()));88 stepDetails.setType(testStepDTO.getType());89 stepDetails.setStepGroupId(testStepDTO.getStepGroupId());90 stepDetails.setPosition(testStepDTO.getPosition());91 stepDetails.setTestDataName(testCaseStepEntityDTO.getTestDataName());92 stepDetails.setTestDataValue(testCaseStepEntityDTO.getTestDataValue());93 testCaseStepEntityDTO.setStepDetails(stepDetails);...

Full Screen

Full Screen

Source:ForLoopStepProcessor.java Github

copy

Full Screen

1package com.testsigma.step.processors;2import com.testsigma.constants.MessageConstants;3import com.testsigma.dto.TestCaseEntityDTO;4import com.testsigma.dto.TestCaseStepEntityDTO;5import com.testsigma.dto.TestStepDTO;6import com.testsigma.exception.TestsigmaException;7import com.testsigma.model.TestDataSet;8import com.testsigma.model.*;9import lombok.extern.log4j.Log4j2;10import org.springframework.web.context.WebApplicationContext;11import java.util.ArrayList;12import java.util.List;13import java.util.Map;14@Log4j215public class ForLoopStepProcessor extends StepProcessor {16 public ForLoopStepProcessor(WebApplicationContext webApplicationContext, List<TestCaseStepEntityDTO> testCaseStepEntityDTOS,17 WorkspaceType workspaceType, Map<String, Element> elementMap,18 TestStepDTO testStepDTO, Long testPlanId, TestDataSet testDataSet,19 Map<String, String> environmentParams, TestCaseEntityDTO testCaseEntityDTO,20 String environmentParamSetName, String dataProfile) {21 super(webApplicationContext, testCaseStepEntityDTOS, workspaceType, elementMap, testStepDTO, testPlanId, testDataSet,22 environmentParams, testCaseEntityDTO, environmentParamSetName, dataProfile);23 }24 public void processLoop(List<TestStepDTO> testStepDTOS, List<Long> loopIds)25 throws TestsigmaException, CloneNotSupportedException {26 if (testStepDTOS != null) {27 loadLoop(testStepDTO, testStepDTOS, loopIds);28 }29 Long testDataId = testStepDTO.getForLoopTestDataId();30 Integer start = testStepDTO.getForLoopStartIndex();31 Integer end = testStepDTO.getForLoopEndIndex();32 TestData testData = testDataProfileService.find(testDataId);33 List<TestCaseStepEntityDTO> entityList = new ArrayList<>();34 List<TestDataSet> dataBank = testData.getData();35 if ((dataBank != null) && dataBank.size() > 0) {36 end = (end.equals(LOOP_END)) ? dataBank.size() : end;37 if (testStepDTO.getTestStepDTOS() != null && testStepDTO.getTestStepDTOS().size() > 0) {38 for (int i = start - 1; i < end && i < dataBank.size(); i++) {39 TestStepDTO entity = testStepDTO.clone();40 TestDataSet dataSet = dataBank.get(i);41 TestCaseStepEntityDTO iteEntity = new TestCaseStepEntityDTO();42 iteEntity.setId(entity.getId());43 for (int lcount = 0; lcount < entity.getTestStepDTOS().size(); lcount++) {44 TestStepDTO loopentity = entity.getTestStepDTOS().get(lcount);45 if (loopentity.getType() == com.testsigma.model.TestStepType.REST_STEP) {46 new RestStepProcessor(webApplicationContext, iteEntity.getTestCaseSteps(), workspaceType,47 elementMap, loopentity, testPlanId, dataSet, environmentParameters, testCaseEntityDTO,48 environmentParamSetName, dataProfile).process();49 continue;50 }51 TestCaseStepEntityDTO exeEntity = new StepProcessor(webApplicationContext, testCaseStepEntityDTOS,52 workspaceType, elementMap, loopentity, testPlanId, dataSet, environmentParameters,53 testCaseEntityDTO, environmentParamSetName, testData.getTestDataName()).processStep();54 if (loopentity.getType() == TestStepType.FOR_LOOP) {55 loopIds.add(loopentity.getId());56 new ForLoopStepProcessor(webApplicationContext, iteEntity.getTestCaseSteps(), workspaceType,57 elementMap, loopentity, testPlanId, dataSet, environmentParameters, testCaseEntityDTO,58 environmentParamSetName, dataProfile)59 .processLoop(entity.getTestStepDTOS(), loopIds);60 continue;61 }62 exeEntity.setParentId(loopentity.getParentId());63 exeEntity.setTestCaseId(loopentity.getTestCaseId());64 exeEntity.setConditionType(loopentity.getConditionType());65 exeEntity.setPriority(loopentity.getPriority());66 exeEntity.setPreRequisite(loopentity.getPreRequisiteStepId());67 exeEntity.setType(loopentity.getType());68 exeEntity.setStepGroupId(loopentity.getStepGroupId());69 exeEntity.setPosition(loopentity.getPosition());70 exeEntity.setIndex(i + 1);71 for (TestStepDTO centity : loopentity.getTestStepDTOS()) {72 List<TestCaseStepEntityDTO> stepGroupSpecialSteps = new ArrayList<>();73 //TODO: check logic for test step key Generation and recursive logic for step group generation74 if (loopIds.contains(centity.getParentId())) {75 continue;76 }77 if (centity.getType() == TestStepType.REST_STEP) {78 new RestStepProcessor(webApplicationContext, stepGroupSpecialSteps, workspaceType,79 elementMap, centity, testPlanId, dataSet, environmentParameters, testCaseEntityDTO,80 environmentParamSetName, dataProfile).process();81 exeEntity.getTestCaseSteps().addAll(stepGroupSpecialSteps);82 continue;83 }84 if (TestStepType.FOR_LOOP == centity.getType()) {85 loopIds.add(centity.getId());86 new ForLoopStepProcessor(webApplicationContext, stepGroupSpecialSteps, workspaceType,87 elementMap, centity, testPlanId, dataSet, environmentParameters, testCaseEntityDTO,88 environmentParamSetName, dataProfile)89 .processLoop(loopentity.getTestStepDTOS(), loopIds);90 exeEntity.getTestCaseSteps().addAll(stepGroupSpecialSteps);91 continue;92 }93 TestCaseStepEntityDTO cstepEntity = new StepProcessor(webApplicationContext, testCaseStepEntityDTOS,94 workspaceType, elementMap, centity, testPlanId, dataSet, environmentParameters,95 testCaseEntityDTO, environmentParamSetName, testData.getTestDataName()).processStep();96 cstepEntity.setParentId(centity.getParentId());97 cstepEntity.setTestCaseId(centity.getTestCaseId());98 cstepEntity.setConditionType(centity.getConditionType());99 cstepEntity.setPriority(centity.getPriority());100 cstepEntity.setPreRequisite(centity.getPreRequisiteStepId());101 cstepEntity.setType(centity.getType());102 cstepEntity.setStepGroupId(centity.getStepGroupId());103 exeEntity.getTestCaseSteps().add(cstepEntity);...

Full Screen

Full Screen

TestStepDTO

Using AI Code Generation

copy

Full Screen

1package com.testsigma.test;2import com.testsigma.dto.TestStepDTO;3public class TestStepDTOExample {4 public static void main(String[] args) {5 TestStepDTO testStepDTO = new TestStepDTO();6 testStepDTO.setStepName("Test Step Name");7 testStepDTO.setStepDescription("Test Step Description");8 testStepDTO.setStepType("Test Step Type");9 testStepDTO.setStepStatus("Test Step Status");10 testStepDTO.setStepDuration(10);11 System.out.println(testStepDTO);12 }13}

Full Screen

Full Screen

TestStepDTO

Using AI Code Generation

copy

Full Screen

1import com.testsigma.dto.TestStepDTO;2import com.testsigma.dto.TestStepDTO.TestStepDTOBuilder;3public class TestStepDTOExample {4 public static void main(String[] args) {5 TestStepDTOBuilder builder = new TestStepDTOBuilder();6 TestStepDTO testStepDTO = builder.setTestStep("Click on Login Button").setExpectedResult("Login Page should open").setTestStepStatus("Passed").build();7 System.out.println(testStepDTO);8 }9}10String getTestStep() - returns the Test Step description11String getExpectedResult() - returns the Expected Result description12String getTestStepStatus() - returns the Test Step status13TestStepDTOBuilder setTestStep(String testStep) - sets the Test Step description14TestStepDTOBuilder setExpectedResult(String expectedResult) - sets the Expected Result description15TestStepDTOBuilder setTestStepStatus(String testStepStatus) - sets the Test Step status16TestStepDTO build() - builds the TestStepDTO object17TestStepBuilder setTestStep(String testStep) - sets the Test Step description18TestStepBuilder setExpectedResult(String expectedResult) - sets the Expected Result description19TestStepBuilder setTestStepStatus(String testStepStatus) - sets the Test Step status20TestStep build() - builds the TestStep object21TestStepDTOBuilder setTestStep(String testStep) - sets the Test Step description22TestStepDTOBuilder setExpectedResult(String expectedResult) - sets the Expected Result description

Full Screen

Full Screen

TestStepDTO

Using AI Code Generation

copy

Full Screen

1package com.testsigma;2import com.testsigma.dto.TestStepDTO;3public class TestStepDTOExample {4public static void main(String args[]) {5TestStepDTO testStepDTO = new TestStepDTO();6testStepDTO.setStepName("Test Step Name");7testStepDTO.setStepDescription("Test Step Description");8testStepDTO.setStepStatus("Test Step Status");9testStepDTO.setStepStartTime("Test Step Start Time");10testStepDTO.setStepEndTime("Test Step End Time");11testStepDTO.setStepDuration("Test Step Duration");12testStepDTO.setStepScreenshot("Test Step Screenshot");13testStepDTO.setStepLog("Test Step Log");14testStepDTO.setStepReport("Test Step Report");15testStepDTO.setStepReportType("Test Step Report Type");16testStepDTO.setStepReportPath("Test Step Report Path");17testStepDTO.setStepReportName("Test Step Report Name");18}19}20package com.testsigma;21import com.testsigma.dto.TestStepDTO;22public class TestStepDTOExample {23public static void main(String args[]) {24TestStepDTO testStepDTO = new TestStepDTO();25testStepDTO.setStepName("Test Step Name");26testStepDTO.setStepDescription("Test Step Description");27testStepDTO.setStepStatus("Test Step Status");28testStepDTO.setStepStartTime("Test Step Start Time");29testStepDTO.setStepEndTime("Test Step End Time");30testStepDTO.setStepDuration("Test Step Duration");31testStepDTO.setStepScreenshot("Test Step Screenshot");32testStepDTO.setStepLog("Test Step Log");33testStepDTO.setStepReport("Test Step Report");34testStepDTO.setStepReportType("Test Step Report Type");35testStepDTO.setStepReportPath("Test Step Report Path");36testStepDTO.setStepReportName("Test Step Report Name");37}38}39package com.testsigma;40import com.testsigma.dto.TestStepDTO;41public class TestStepDTOExample {42public static void main(String args[]) {43TestStepDTO testStepDTO = new TestStepDTO();44testStepDTO.setStepName("Test Step Name");45testStepDTO.setStepDescription("Test Step Description");46testStepDTO.setStepStatus("Test Step Status");47testStepDTO.setStepStartTime("Test Step Start Time");

Full Screen

Full Screen

TestStepDTO

Using AI Code Generation

copy

Full Screen

1package com.testsigma.examples;2import com.testsigma.dto.TestStepDTO;3import java.util.ArrayList;4import java.util.List;5public class TestStepDTOExample {6 public static void main(String[] args) {7 TestStepDTO testStepDTO = new TestStepDTO();8 testStepDTO.setStepDescription("Step Description");9 testStepDTO.setStepExpectedResult("Step Expected Result");10 testStepDTO.setStepExecutionStatus("Step Execution Status");11 testStepDTO.setStepExecutionTime(1000);12 testStepDTO.setStepName("Step Name");13 testStepDTO.setStepNumber(1);14 List<TestStepDTO> testStepDTOList = new ArrayList<TestStepDTO>();15 testStepDTOList.add(testStepDTO);16 testStepDTO.setTestStepDTOList(testStepDTOList);17 System.out.println(testStepDTO);18 System.out.println(testStepDTO.getTestStepDTOList());19 }20}

Full Screen

Full Screen

TestStepDTO

Using AI Code Generation

copy

Full Screen

1package com.testsigma.test;2import org.testng.annotations.Test;3import com.testsigma.dto.TestStepDTO;4import com.testsigma.dto.TestStepDTO.TestStepDTOBuilder;5public class TestStepDTOExample {6public void test() {7TestStepDTOBuilder builder = new TestStepDTOBuilder();8builder.setStepName("Click on Login button");9builder.setStepDescription("User should be able to click on Login button");10builder.setStepStatus("PASS");11builder.setStepExpectedResult("Login button should be clickable");12builder.setStepActualResult("Login button is clickable");13builder.setStepScreenShot("C:\\Users\\TestSigma\\Desktop\\TestSigma\\TestStepDTO.png");14builder.setStepDuration("2");15builder.setStepIteration("1");16builder.setStepException("No Exception");17builder.setStepExceptionMessage("No Exception");18builder.setStepExceptionStackTrace("No Exception");19builder.setStepExceptionCause("No Exception");20TestStepDTO testStepDTO = builder.build();21System.out.println(testStepDTO);22}23}24package com.testsigma.dto;25import java.io.Serializable;26public class TestStepDTO implements Serializable {27private static final long serialVersionUID = 1L;28private String stepName;29private String stepDescription;30private String stepStatus;31private String stepExpectedResult;32private String stepActualResult;33private String stepScreenShot;34private String stepDuration;35private String stepIteration;36private String stepException;37private String stepExceptionMessage;38private String stepExceptionStackTrace;39private String stepExceptionCause;40public TestStepDTO() {41}42private TestStepDTO(TestStepDTOBuilder builder) {43this.stepName = builder.stepName;44this.stepDescription = builder.stepDescription;45this.stepStatus = builder.stepStatus;46this.stepExpectedResult = builder.stepExpectedResult;47this.stepActualResult = builder.stepActualResult;48this.stepScreenShot = builder.stepScreenShot;49this.stepDuration = builder.stepDuration;50this.stepIteration = builder.stepIteration;51this.stepException = builder.stepException;52this.stepExceptionMessage = builder.stepExceptionMessage;53this.stepExceptionStackTrace = builder.stepExceptionStackTrace;54this.stepExceptionCause = builder.stepExceptionCause;55}56public String getStepName() {57return stepName;58}59public void setStepName(String stepName) {60this.stepName = stepName;61}62public String getStepDescription() {63return stepDescription;64}65public void setStepDescription(String

Full Screen

Full Screen

TestStepDTO

Using AI Code Generation

copy

Full Screen

1import com.testsigma.dto.TestStepDTO;2import com.testsigma.dto.TestStepDTO;3import java.util.ArrayList;4import java.util.List;5public class TestStepDTOExample {6 public static void main(String[] args) {7 TestStepDTO testStepDTO = new TestStepDTO();8 testStepDTO.setStepNo(1);9 testStepDTO.setStepDesc("Click on the button");10 testStepDTO.setExpectedResult("Button should be clicked");11 testStepDTO.setActualResult("Button is clicked");12 testStepDTO.setStatus("PASS");13 testStepDTO.setScreenShotPath("C:\\screenshot.png");14 List<TestStepDTO> testStepDTOList = new ArrayList<TestStepDTO>();15 testStepDTOList.add(testStepDTO);16 TestStepDTO testStepDTO1 = new TestStepDTO();17 testStepDTO1.setStepNo(2);18 testStepDTO1.setStepDesc("Enter the text in the text box");19 testStepDTO1.setExpectedResult("Text should be entered");20 testStepDTO1.setActualResult("Text is entered");21 testStepDTO1.setStatus("PASS");22 testStepDTO1.setScreenShotPath("C:\\screenshot1.png");23 testStepDTOList.add(testStepDTO1);24 TestStepDTO testStepDTO2 = new TestStepDTO();25 testStepDTO2.setStepNo(3);26 testStepDTO2.setStepDesc("Click on the button");27 testStepDTO2.setExpectedResult("Button should be clicked");28 testStepDTO2.setActualResult("Button is clicked");29 testStepDTO2.setStatus("PASS");30 testStepDTO2.setScreenShotPath("C:\\screenshot2.png");31 testStepDTOList.add(testStepDTO2);

Full Screen

Full Screen

TestStepDTO

Using AI Code Generation

copy

Full Screen

1package com.testsigma.test;2import com.testsigma.dto.TestStepDTO;3import com.testsigma.dto.TestStepDTOList;4public class Test {5 public void test() {6 TestStepDTOList testStepDTOList = new TestStepDTOList();7 TestStepDTO testStepDTO = new TestStepDTO();8 testStepDTO.setTestStepName("testStep1");9 testStepDTO.setTestStepDescription("testStepDescription1");10 testStepDTO.setTestStepExpectedResult("testStepExpectedResult1");11 testStepDTO.setTestStepStatus("testStepStatus1");12 testStepDTOList.add(testStepDTO);13 testStepDTO = new TestStepDTO();14 testStepDTO.setTestStepName("testStep2");15 testStepDTO.setTestStepDescription("testStepDescription2");16 testStepDTO.setTestStepExpectedResult("testStepExpectedResult2");17 testStepDTO.setTestStepStatus("testStepStatus2");18 testStepDTOList.add(testStepDTO);19 System.out.println(testStepDTOList);20 }21}22package com.testsigma.test;23import com.testsigma.dto.TestStepDTO;24import com.testsigma.dto.TestStepDTOList;25public class Test {26 public void test() {27 TestStepDTOList testStepDTOList = new TestStepDTOList();28 TestStepDTO testStepDTO = new TestStepDTO();29 testStepDTO.setTestStepName("testStep1");30 testStepDTO.setTestStepDescription("testStepDescription1");31 testStepDTO.setTestStepExpectedResult("testStepExpectedResult1");32 testStepDTO.setTestStepStatus("testStepStatus1");33 testStepDTOList.add(testStepDTO);34 testStepDTO = new TestStepDTO();35 testStepDTO.setTestStepName("testStep2");36 testStepDTO.setTestStepDescription("testStepDescription2");37 testStepDTO.setTestStepExpectedResult("testStepExpectedResult2");38 testStepDTO.setTestStepStatus("testStepStatus2");39 testStepDTOList.add(testStepDTO);40 System.out.println(testStepDTOList);41 }42}43[{"testStepName":"testStep1","testStepDescription":"testStepDescription1","testStep

Full Screen

Full Screen

TestStepDTO

Using AI Code Generation

copy

Full Screen

1import com.testsigma.dto.*;2public class TestStepDTO {3 private String name;4 private String description;5 private String status;6 private String type;7 private String expected;8 private String actual;9 private String executionTime;10 private String startTime;11 private String endTime;12 private String stepId;13 private String stepType;14 private String stepCategory;15 private String stepSubCategory;16 private String stepDescription;17 private String stepExpected;18 private String stepActual;19 private String stepStatus;20 private String stepExecutionTime;21 private String stepStartTime;22 private String stepEndTime;23 private String stepException;24 private String stepScreenshot;25 private String stepScreenshotPath;26 private String stepVideo;27 private String stepVideoPath;28 private String stepLog;29 private String stepLogPath;30 private String stepData;31 private String stepDataPath;32 private String stepReport;33 private String stepReportPath;34 private String stepAttachment;35 private String stepAttachmentPath;36 private String stepScreenRecord;37 private String stepScreenRecordPath;38 private String stepCustom;39 private String stepCustomPath;40 private String stepCustom1;41 private String stepCustom1Path;42 private String stepCustom2;43 private String stepCustom2Path;44 private String stepCustom3;45 private String stepCustom3Path;46 private String stepCustom4;47 private String stepCustom4Path;48 private String stepCustom5;49 private String stepCustom5Path;50 private String stepCustom6;51 private String stepCustom6Path;52 private String stepCustom7;53 private String stepCustom7Path;54 private String stepCustom8;55 private String stepCustom8Path;56 private String stepCustom9;57 private String stepCustom9Path;58 private String stepCustom10;59 private String stepCustom10Path;60 private String stepCustom11;61 private String stepCustom11Path;62 private String stepCustom12;63 private String stepCustom12Path;64 private String stepCustom13;65 private String stepCustom13Path;66 private String stepCustom14;67 private String stepCustom14Path;68 private String stepCustom15;69 private String stepCustom15Path;70 private String stepCustom16;71 private String stepCustom16Path;

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 Testsigma automation tests on LambdaTest cloud grid

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

Most used methods in TestStepDTO

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful