How to use MessageConstants class of com.testsigma.constants package

Best Testsigma code snippet using com.testsigma.constants.MessageConstants

Source:StepProcessor.java Github

copy

Full Screen

1package com.testsigma.step.processors;2import com.testsigma.automator.entity.DefaultDataGeneratorsEntity;3import com.testsigma.config.StorageServiceFactory;4import com.testsigma.constants.MessageConstants;5import com.testsigma.constants.NaturalTextActionConstants;6import com.testsigma.dto.*;7import com.testsigma.exception.ExceptionErrorCodes;8import com.testsigma.exception.ResourceNotFoundException;9import com.testsigma.exception.TestsigmaException;10import com.testsigma.mapper.ElementMapper;11import com.testsigma.mapper.TestStepMapper;12import com.testsigma.model.TestDataSet;13import com.testsigma.model.*;14import com.testsigma.service.*;15import lombok.extern.log4j.Log4j2;16import org.apache.commons.lang3.StringUtils;17import org.springframework.web.context.WebApplicationContext;18import java.util.*;19import java.util.regex.Matcher;20import java.util.regex.Pattern;21@Log4j222public class StepProcessor {23 protected static Integer LOOP_END = -1;24 protected Long testPlanId;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);314 }315 }316 private void populateTestDataFunctionDetailsFromId(DefaultDataGeneratorsEntity testDataFunctionEntity,317 AddonTestStepTestData addonTestStepTestData, TestCaseStepEntityDTO exeTestStepEntity) throws ResourceNotFoundException {318 Map<String, String> arguments = addonTestStepTestData.getTestDataFunctionArguments();319 testDataFunctionEntity.setArguments(arguments);320 if (addonTestStepTestData.getIsAddonFn()) {321 AddonPluginTestDataFunctionEntityDTO tdfEntityDTO = addonService.fetchPluginTestDataFunctionEntities(addonTestStepTestData.getTestDataFunctionId());322 ArrayList<AddonPluginTestDataFunctionEntityDTO> tdfEntityDTOList = new ArrayList<AddonPluginTestDataFunctionEntityDTO>();323 tdfEntityDTOList.add(tdfEntityDTO);324 if (exeTestStepEntity.getAddonPluginTDFEntityList() == null) {325 exeTestStepEntity.setAddonPluginTDFEntityList(tdfEntityDTOList);326 } else {327 exeTestStepEntity.getAddonPluginTDFEntityList().addAll(tdfEntityDTOList);328 }329 testDataFunctionEntity.setIsAddonFn(addonTestStepTestData.getIsAddonFn());330 } else {331 DefaultDataGenerator customFunction = defaultDataGeneratorService.find(addonTestStepTestData.getTestDataFunctionId());332 DefaultDataGeneratorFile customFunctionFile = defaultDataGeneratorService.findFileById(customFunction.getFileId());333 testDataFunctionEntity.setClassName(customFunctionFile.getClassName());334 testDataFunctionEntity.setFunctionName(customFunction.getFunctionName());335 Map<String, String> functionArguments = new ObjectMapperService().parseJson(336 customFunction.getArguments().get("arg_types").toString(), HashMap.class);337 testDataFunctionEntity.setArgumentTypes(functionArguments);338 testDataFunctionEntity.setClassPackage(customFunctionFile.getClassPackage());339 testDataFunctionEntity.setCustomFunctionType(CustomFunctionType.DefaultTestData);340// testDataFunctionEntity.setBinaryFileUrl(getSignedURL(customFunctionFile.getBinary_file_url(), customFunctionFile.getClassName()));341 }342 testDataFunctionEntity.setId(addonTestStepTestData.getTestDataFunctionId());343 }344 private void populateTestDataFunctionDetailsFromMap(DefaultDataGeneratorsEntity defaultDataGeneratorsEntity, TestCaseStepEntityDTO exeTestStepEntity)345 throws TestsigmaException {346 TestStepDataMap testStepDataMap = testStepDTO.getDataMapBean();347 if (testStepDataMap != null) {348 if (testStepDataMap.getAddonTDF() != null) {349 defaultDataGeneratorsEntity.setArguments(testStepDataMap.getAddonTDF().getTestDataFunctionArguments());350 defaultDataGeneratorsEntity.setIsAddonFn(true);351 AddonPluginTestDataFunctionEntityDTO tdfEntityDTO = addonService.fetchPluginTestDataFunctionEntities(testStepDataMap.getAddonTDF().getTestDataFunctionId());352 ArrayList<AddonPluginTestDataFunctionEntityDTO> tdfEntityDTOList = new ArrayList<AddonPluginTestDataFunctionEntityDTO>();353 tdfEntityDTOList.add(tdfEntityDTO);354 exeTestStepEntity.setAddonPluginTDFEntityList(tdfEntityDTOList);355 return;356 }357 }358 if (testStepDTO.getTestDataFunctionId() == null) {359 throw new TestsigmaException(ExceptionErrorCodes.TEST_DATA_NOT_FOUND_TEST_STEP,360 MessageConstants.getMessage(MessageConstants.INVALID_TEST_DATA));361 }362 DefaultDataGenerator defaultDataGenerator = defaultDataGeneratorService.find(testStepDTO.getTestDataFunctionId());363 defaultDataGeneratorsEntity.setClassName(defaultDataGenerator.getFile().getClassName());364 defaultDataGeneratorsEntity.setFunctionName(defaultDataGenerator.getFunctionName());365 defaultDataGeneratorsEntity.setArguments(testStepDTO.getTestDataFunctionArgs());366 Map<String, String> argsTypes = (HashMap) defaultDataGenerator.getArguments().get("arg_types");367 defaultDataGeneratorsEntity.setArgumentTypes(argsTypes);368 defaultDataGeneratorsEntity.setClassPackage(defaultDataGenerator.getFile().getClassPackage());369 }370 public String updateElement(Element element, TestDataSet testData, Map<String, String> environmentParams) {371 String locatorValue = element.getLocatorValue();372 try {373 if (element.getIsDynamic()) {374 ElementMetaData metaData = element.getMetadata();375 if (metaData.getTestData() != null) {376 //JsonObject to Map Casting failed377 Map<String, Object> rawDataMap = metaData.getTestData().toMap();378 Map<String, String> stringTypeDataMap = new HashMap();379 for (Map.Entry<String, Object> entry : rawDataMap.entrySet()) {380 if (entry.getValue() instanceof String) {381 stringTypeDataMap.put(entry.getKey(), (String) entry.getValue());382 }383 }384 Map<String, String> dataMap = stringTypeDataMap;385 if (dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA_TYPE).equals(TestDataType.parameter.name())) {386 //TODO: Handle null and exception cases..387 if (!(testData == null || testData.getData() == null || org.apache.commons.lang3.StringUtils.isEmpty(dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA)) ||388 org.apache.commons.lang3.StringUtils.isEmpty(testData.getData().optString(dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA))))) {389 String data = testData.getData().getString(dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA));390 locatorValue =391 element.getLocatorValue().replaceAll(NaturalTextActionConstants.TEST_DATA_PARAMETER_PREFIX + "\\|" + Pattern.quote(dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA)) + "\\|",392 Matcher.quoteReplacement(data));393 }394 } else if (dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA_TYPE).equals(TestDataType.environment.name())) {395 if (environmentParams != null && StringUtils.isNotEmpty(dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA))) {396 String data = environmentParams.get(dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA));397 if (data != null) {398 locatorValue =399 element.getLocatorValue().replaceAll(NaturalTextActionConstants.TEST_DATA_ENVIRONMENT_PARAM_PREFIX + "\\|" + Pattern.quote(dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA)) + "\\|",400 Matcher.quoteReplacement(data));401 }else {402 String errorMessage = com.testsigma.constants.MessageConstants.getMessage(403 MessageConstants.MSG_UNKNOWN_ENVIRONMENT_PARAMETER_IN_ELEMENT, dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA), this.testCaseEntityDTO.getTestCaseName(), element.getName());404 throw new TestsigmaException(ExceptionErrorCodes.ENVIRONMENT_PARAMETER_NOT_FOUND, errorMessage);405 }406 }407 //TODO: Handle null and exception cases..408 } else if (dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA_TYPE).equals(TestDataType.runtime.name())) {409 //TODO: Handle null and exception cases..410 } else if (dataMap.get(NaturalTextActionConstants.TEST_STEP_DATA_MAP_KEY_TEST_DATA_TYPE).equals(TestDataType.function.name())) {411 //TODO: Handle null and exception cases..s412 }413 }414 }415 } catch (TestsigmaException e) {416 log.info(e.getMessage(),e);417 }...

Full Screen

Full Screen

Source:RestStepProcessor.java Github

copy

Full Screen

1package com.testsigma.step.processors;2import com.testsigma.model.StorageAccessLevel;3import com.testsigma.constants.MessageConstants;4import com.testsigma.constants.NaturalTextActionConstants;5import com.testsigma.dto.*;6import com.testsigma.exception.ExceptionErrorCodes;7import com.testsigma.exception.TestsigmaException;8import com.testsigma.model.TestDataSet;9import com.testsigma.model.*;10import com.testsigma.service.ObjectMapperService;11import lombok.extern.log4j.Log4j2;12import org.apache.commons.lang3.ObjectUtils;13import org.apache.commons.lang3.StringUtils;14import org.json.JSONArray;15import org.json.JSONException;16import org.json.JSONObject;17import org.springframework.web.context.WebApplicationContext;18import java.net.URL;19import java.util.*;20import java.util.regex.Matcher;21import java.util.regex.Pattern;22@Log4j223public 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);94 }95 private JSONObject replaceTestDataAndEnvironmentParams(JSONObject requestString)96 throws TestsigmaException {97 return new JSONObject(replaceTestDataAndEnvironmentParams(requestString.toString()));98 }99 private String replaceTestDataAndEnvironmentParams(String requestString)100 throws TestsigmaException {101 String testDataReplacedString = replaceTestDataParams(requestString, testDataSet,102 testCaseEntityDTO.getTestCaseName(), dataProfile);103 return replaceEnvironmentDataParams(testDataReplacedString, environmentParameters, environmentParamSetName,104 testCaseEntityDTO.getTestCaseName());105 }106 protected String replaceTestDataParams(String inputString, TestDataSet dataSet, String testCaseName,107 String testDataName)108 throws TestsigmaException {109 if (inputString == null) {110 return null;111 }112 int first = inputString.indexOf(NaturalTextActionConstants.REST_DATA_PARAM_START_PATTERN);113 int second = inputString.indexOf(NaturalTextActionConstants.REST_DATA_PARAM_END_PATTERN, first + 2);114 while (first >= 0 && second > 0) {115 String data = inputString.substring(first + 2, second);116 data = data.trim();117 if (dataSet == null) {118 String errorMessage = com.testsigma.constants.MessageConstants.getMessage(119 MessageConstants.MSG_UNKNOWN_TEST_DATA_DATA, testCaseName);120 throw new TestsigmaException(ExceptionErrorCodes.TEST_DATA_SET_NOT_FOUND, errorMessage);121 }122 String parameter = ObjectUtils.defaultIfNull(dataSet.getData(), new JSONObject()).optString(data);123 if (StringUtils.isEmpty(parameter)) {124 String errorMessage = com.testsigma.constants.MessageConstants.getMessage(125 MessageConstants.MSG_UNKNOWN_TEST_DATA_PARAMETER_NOTIN_TEST_STEP, data, testDataName);126 throw new TestsigmaException(ExceptionErrorCodes.TEST_DATA_NOT_FOUND, errorMessage);127 }128 inputString = inputString.replaceAll(NaturalTextActionConstants.REST_DATA_PARAM_START_ESCAPED_PATTERN129 + Pattern.quote(data) + NaturalTextActionConstants.REST_DATA_PARAM_END_ESCAPED_PATTERN, parameter);130 first = inputString.indexOf(NaturalTextActionConstants.REST_DATA_PARAM_START_PATTERN);131 second = inputString.indexOf(NaturalTextActionConstants.REST_DATA_PARAM_END_PATTERN, first + 2);132 }133 return inputString;134 }135 private String replaceEnvironmentDataParams(String inputString, Map<String, String> environmentDataSet, String environmentDataName,136 String testCaseName) throws TestsigmaException {137 if (inputString == null) {138 return null;139 }140 int first = inputString.indexOf(NaturalTextActionConstants.REST_DATA_ENVIRONMENT_PARAM_START_PATTERN);141 int second = inputString.indexOf(NaturalTextActionConstants.REST_DATA_ENVIRONMENT_PARAM_END_PATTERN, first + 2);142 while (first >= 0 && second > 0) {143 String data = inputString.substring(first + 2, second);144 data = data.trim();145 if (environmentDataSet == null) {146 String errorMessage = com.testsigma.constants.MessageConstants.getMessage(147 MessageConstants.MSG_UNKNOWN_ENVIRONMENT_DATA_SET);148 throw new TestsigmaException(ExceptionErrorCodes.ENVIRONMENT_PARAMETERS_NOT_CONFIGURED, errorMessage);149 }150 String parameter = environmentDataSet.getOrDefault(data, "");151 if (StringUtils.isEmpty(parameter)) {152 String errorMessage = com.testsigma.constants.MessageConstants.getMessage(153 MessageConstants.MSG_UNKNOWN_ENVIRONMENT_PARAMETER_IN_TEST_STEP, parameter, testCaseName, environmentDataName);154 throw new TestsigmaException(ExceptionErrorCodes.ENVIRONMENT_PARAMETER_NOT_FOUND, errorMessage);155 }156 inputString = inputString.replaceAll(NaturalTextActionConstants.REST_DATA_ENVIRONMENT_PARAM_START_ESCAPED_PATTERN + Pattern.quote(data)157 + NaturalTextActionConstants.REST_DATA_ENVIRONMENT_PARAM_END_ESCAPED_PATTERN, Matcher.quoteReplacement(parameter));158 first = inputString.indexOf(NaturalTextActionConstants.REST_DATA_ENVIRONMENT_PARAM_START_PATTERN);159 second = inputString.indexOf(NaturalTextActionConstants.REST_DATA_ENVIRONMENT_PARAM_END_PATTERN, first + 2);160 }161 return inputString;162 }163 private void processMultipart(RestStepDTO dto) throws Exception {164 String payload = dto.getPayload();165 Boolean isMultiPart;166 if (payload != null && isJSONValid(payload)) {167 if (isJSONArray(payload)) {...

Full Screen

Full Screen

Source:RunTimeDataService.java Github

copy

Full Screen

...4 * All rights reserved.5 * ****************************************************************************6 */7package com.testsigma.service;8import com.testsigma.constants.MessageConstants;9import com.testsigma.exception.ResourceNotFoundException;10import com.testsigma.model.RunTimeData;11import com.testsigma.model.TestDeviceResult;12import com.testsigma.repository.RunTimeDataRepository;13import com.testsigma.web.request.RuntimeRequest;14import lombok.RequiredArgsConstructor;15import lombok.extern.log4j.Log4j2;16import org.json.JSONException;17import org.json.JSONObject;18import org.springframework.beans.factory.annotation.Autowired;19import org.springframework.stereotype.Service;20@Service21@Log4j222@RequiredArgsConstructor(onConstructor = @__(@Autowired))23public class RunTimeDataService {24 private final RunTimeDataRepository repository;25 private final TestDeviceResultService testDeviceResultService;26 public RunTimeData create(RunTimeData runTimeData) {27 return this.repository.save(runTimeData);28 }29 public RunTimeData findByTestPlanRunIdAndSessionId(Long executionRunId, String sessionId) throws ResourceNotFoundException {30 return repository.findByTestPlanRunIdAndSessionId(executionRunId, sessionId)31 .orElseThrow(32 () -> new ResourceNotFoundException("Could not find resource with id:" + executionRunId));33 }34 public RunTimeData findByExecutionRunId(Long executionRunId) throws ResourceNotFoundException {35 return repository.findByTestPlanRunIdAndSessionIdIsNull(executionRunId)36 .orElseThrow(37 () -> new ResourceNotFoundException("Could not find resource with id:" + executionRunId));38 }39 public RunTimeData findBySessionId(String sessionId) throws ResourceNotFoundException {40 return repository.findBySessionId(sessionId)41 .orElseThrow(42 () -> new ResourceNotFoundException("Could not find resource with session id:" + sessionId));43 }44 public RunTimeData update(RunTimeData runTimeData) {45 return this.repository.save(runTimeData);46 }47 public String getRunTimeData(String variableName, Long environmentResultId, String sessionId)48 throws ResourceNotFoundException {49 try {50 RunTimeData runTimeData;51 TestDeviceResult testDeviceResult = testDeviceResultService.find(environmentResultId);52 runTimeData = findByExecutionRunId(testDeviceResult.getTestPlanResultId());53 return runTimeData.getData().getString(variableName);54 } catch (JSONException | ResourceNotFoundException exception) {55 ResourceNotFoundException resourceNotFoundException = new ResourceNotFoundException(exception.getMessage());56 String errorMessage = MessageConstants.getMessage(MessageConstants.RUNTIME_DATA_VARIABLE_NOT_FOUND);57 resourceNotFoundException.setErrorCode(MessageConstants.RUNTIME_DATA_VARIABLE_NOT_FOUND);58 resourceNotFoundException.setMessage(errorMessage);59 log.error(exception.getMessage(), exception);60 throw exception;61 }62 }63 public void updateRunTimeData(Long environmentResultId, RuntimeRequest runtimeRequest) throws ResourceNotFoundException {64 RunTimeData runTimeData = new RunTimeData();65 TestDeviceResult testDeviceResult = testDeviceResultService.find(environmentResultId);66 runTimeData.setTestPlanRunId(testDeviceResult.getTestPlanResultId());67 try {68 runTimeData.setSessionId(null);69 runTimeData = findByExecutionRunId(testDeviceResult.getTestPlanResultId());70 } catch (ResourceNotFoundException exception) {71 log.error(exception.getMessage(), exception);...

Full Screen

Full Screen

MessageConstants

Using AI Code Generation

copy

Full Screen

1import com.testsigma.constants.MessageConstants;2public class TestMessageConstants {3 public static void main(String[] args) {4 System.out.println(MessageConstants.GREETING_MESSAGE);5 System.out.println(MessageConstants.FAREWELL_MESSAGE);6 }7}

Full Screen

Full Screen

MessageConstants

Using AI Code Generation

copy

Full Screen

1import com.testsigma.constants.MessageConstants;2public class Test{3 public static void main(String[] args){4 System.out.println(MessageConstants.WELCOME_MSG);5 }6}7import com.testsigma.constants.MessageConstants;8public class Test{9 public static void main(String[] args){10 System.out.println(MessageConstants.WELCOME_MSG);11 }12}13import com.testsigma.constants.MessageConstants;14public class Test{15 public static void main(String[] args){16 System.out.println(MessageConstants.WELCOME_MSG);17 }18}19import com.testsigma.constants.MessageConstants;20System.out.println(MessageConstants.WELCOME_MSG);

Full Screen

Full Screen

MessageConstants

Using AI Code Generation

copy

Full Screen

1package com.testsigma.test;2import com.testsigma.constants.MessageConstants;3public class Test {4 public static void main(String[] args) {5 System.out.println(MessageConstants.WELCOME_MESSAGE);6 }7}8package com.testsigma.test;9import com.testsigma.constants.MessageConstants;10public class Test {11 public static void main(String[] args) {12 System.out.println(MessageConstants.WELCOME_MESSAGE);13 }14}15package com.testsigma.test;16import com.testsigma.constants.MessageConstants;17public class Test {18 public static void main(String[] args) {19 System.out.println(MessageConstants.WELCOME_MESSAGE);20 }21}22package com.testsigma.test;23import com.testsigma.constants.MessageConstants;24public class Test {25 public static void main(String[] args) {26 System.out.println(MessageConstants.WELCOME_MESSAGE);27 }28}29package com.testsigma.test;30import com.testsigma.constants.MessageConstants;31public class Test {32 public static void main(String[] args) {33 System.out.println(MessageConstants.WELCOME_MESSAGE);34 }35}36package com.testsigma.test;37import com.testsigma.constants.MessageConstants;38public class Test {39 public static void main(String[] args) {40 System.out.println(MessageConstants.WELCOME_MESSAGE);41 }42}43package com.testsigma.test;44import com.testsigma.constants.MessageConstants;45public class Test {46 public static void main(String[] args) {47 System.out.println(MessageConstants.WELCOME_MESSAGE);48 }49}50package com.testsigma.test;51import com.testsigma.constants.MessageConstants;52public class Test {53 public static void main(String[] args) {54 System.out.println(MessageConstants.WELCOME_MESSAGE);55 }56}

Full Screen

Full Screen

MessageConstants

Using AI Code Generation

copy

Full Screen

1package com.testsigma;2import com.testsigma.constants.MessageConstants;3public class Main {4 public static void main(String[] args) {5 System.out.println(MessageConstants.WELCOME_MSG);6 }7}8package com.testsigma.constants;9public class MessageConstants {10 public static final String WELCOME_MSG = "Welcome to TestSigma";11}12Example 3: Using the static import statement13package com.testsigma;14import static com.testsigma.constants.MessageConstants.WELCOME_MSG;15public class Main {16 public static void main(String[] args) {17 System.out.println(WELCOME_MSG);18 }19}20package com.testsigma.constants;21public class MessageConstants {22 public static final String WELCOME_MSG = "Welcome to TestSigma";23}24Example 4: Using the static import statement25package com.testsigma;26import static com.testsigma.constants.MessageConstants.*;27public class Main {28 public static void main(String[] args) {29 System.out.println(WELCOME_MSG);30 }31}32package com.testsigma.constants;33public class MessageConstants {34 public static final String WELCOME_MSG = "Welcome to TestSigma";35}36Example 5: Using the static import statement37package com.testsigma;38import static com.testsigma.constants.MessageConstants.*;39public class Main {40 public static void main(String[] args) {41 System.out.println(WELCOME_MSG);42 System.out.println(GOODBYE_MSG);43 }44}45package com.testsigma.constants;46public class MessageConstants {47 public static final String WELCOME_MSG = "Welcome to TestSigma";48 public static final String GOODBYE_MSG = "Goodbye from TestSigma";49}50Example 6: Using the static import statement51package com.testsigma;52import static com.testsigma.constants.MessageConstants.*;53public class Main {54 public static void main(String[] args) {55 System.out.println(WELCOME_MSG);56 System.out.println(GOODBYE_MSG

Full Screen

Full Screen

MessageConstants

Using AI Code Generation

copy

Full Screen

1import com.testsigma.constants.MessageConstants;2public class MessageTest {3public static void main(String[] args) {4System.out.println(MessageConstants.WELCOME_MSG);5System.out.println(MessageConstants.GOODBYE_MSG);6}7}8package com.testsigma;9public class MessageTest {10public static void main(String[] args) {11System.out.println("Welcome to TestSigma");12System.out.println("Goodbye from TestSigma");13}14}15package com.testsigma;16public class MessageTest {17public static void main(String[] args) {18System.out.println("Welcome to TestSigma");19System.out.println("Goodbye from TestSigma");20}21}22package com.testsigma;23public class MessageTest {24public static void main(String[] args) {25System.out.println("Welcome to TestSigma");26System.out.println("Goodbye from TestSigma");27}28}29package com.testsigma;30public class MessageTest {31public static void main(String[] args) {32System.out.println("Welcome to TestSigma");33System.out.println("Goodbye from TestSigma");34}35}36package com.testsigma;37public class MessageTest {38public static void main(String[] args) {39System.out.println("Welcome to TestSigma");40System.out.println("Goodbye from TestSigma");41}42}

Full Screen

Full Screen

MessageConstants

Using AI Code Generation

copy

Full Screen

1package com.testsigma.test;2import com.testsigma.constants.MessageConstants;3public class TestMessageConstants{4public static void main(String[] args){5System.out.println(MessageConstants.WELCOME_MESSAGE);6}7}8package com.testsigma.test;9import com.testsigma.constants.MessageConstants;10public class TestMessageConstants{11public static void main(String[] args){12System.out.println(MessageConstants.WELCOME_MESSAGE);13}14}15package com.testsigma.test;16import com.testsigma.constants.MessageConstants;17public class TestMessageConstants{18public static void main(String[] args){19System.out.println(MessageConstants.WELCOME_MESSAGE);20}21}22package com.testsigma.test;23import com.testsigma.constants.MessageConstants;24public class TestMessageConstants{25public static void main(String[] args){26System.out.println(MessageConstants.WELCOME_MESSAGE);27}28}29package com.testsigma.test;30import com.testsigma.constants.MessageConstants;31public class TestMessageConstants{32public static void main(String[] args){33System.out.println(MessageConstants.WELCOME_MESSAGE);34}35}36package com.testsigma.test;37import com.testsigma.constants.MessageConstants;38public class TestMessageConstants{39public static void main(String[] args){40System.out.println(MessageConstants.WELCOME_MESSAGE);41}42}43package com.testsigma.test;44import com.testsigma.constants.MessageConstants;45public class TestMessageConstants{46public static void main(String[] args){47System.out.println(MessageConstants.WELCOME_MESSAGE);48}49}50package com.testsigma.test;51import com.testsigma.constants.MessageConstants;52public class TestMessageConstants{53public static void main(String[] args){54System.out.println(MessageConstants.WELCOME_MESSAGE);55}56}57package com.testsigma.test;58import com.testsigma.constants.MessageConstants;

Full Screen

Full Screen

MessageConstants

Using AI Code Generation

copy

Full Screen

1import com.testsigma.constants.MessageConstants;2{3public static void main(String[] args)4{5System.out.println(MessageConstants.GREETING);6System.out.println(MessageConstants.WELCOME);7}8}9import static com.testsigma.constants.MessageConstants.*;10{11public static void main(String[] args)12{13System.out.println(GREETING);14System.out.println(WELCOME);15}16}

Full Screen

Full Screen

MessageConstants

Using AI Code Generation

copy

Full Screen

1package com.testsigma.test;2import com.testsigma.constants.MessageConstants;3public class TestMessageConstants{4public static void main(String[] args){5System.out.println(MessageConstants.WELCOME_MESSAGE);6}7}

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 MessageConstants

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