Use of tags in command line via bamboo build - Run all tests while sending -T tags parameters
Question In our CI build pipeline (bamboo) I setup two parameters tagTestSuite and tagTestCase. This way, all our automation testers can specify, if needed, which test cases need to be ran based on certain tags. This works fine if there are indeed such tags passed on. But what if a project just wants to run all of its tests? These -T parameters cannot be left empty in the command line as that fails the build... Deleting them from the bamboo variables will then lose the standardized approach for all testers to do a tag-based execution. Seeing the documentation here (https://support.smartbear.com/readyapi/docs/functional/running/automating/cli.html)I noticed you can provide logical operators. So I thought I came up with a nice solution: I provide as default value for those parameters in bamboo a tag value that nobody would use and by setting the "!" operator in front of it I'd expected thatALL test suites/cases would run. So I've set parameters and resulted in a command line that has these : "-TTestSuite !itShouldRunAllTestSuites" "-TTestCase !itShouldRunAllTestCase". Since none of the testSuite/testCases has a tag "itShouldRunAllTestSuites" or "itShouldRunAllTestCases" I thought my project would be run in full.... But nope: error is shown:[errorlog] java.lang.Exception: The tag "itShouldRunAllTestSuites" was not found. Yes, I could go and add a tag to every single test suite and test case to work around this, but that could be tedious and not so future proof... Answer Solution: ReadyAPI seems to look first for a tag and then complain it wasn't found. So I tried this: I've added the tags "itShouldRunAllTestCases" and "itShouldRunAllTestSuites" to my project but did not tag any of my testsuites/testcases with this tag. Executed above again and now ALL of my tests get's executed nicely!682Views0likes0CommentsAutomate Environment creation for REST and SOAP services
This came up in a previous thread, and I've finally worked out how to populate environments into a project and how to set their endpoints accordingly. This is relatively simple and can be extended for adding multiple environments. We're currently using this to convert all of our various ReadyAPI / SoapUI NG Pro projects to support environments. It's working like a charm! // For REST Services import com.eviware.soapui.model.environment.* import com.eviware.soapui.config.* def project = context.testCase.testSuite.project; // Assuming binding is the first interface on the project. def binding = context.testCase.testSuite.project.getInterfaceAt(1).getName().toString(); // Getting current list of environment names def environNames = project.getEnvironmentNames().toString(); // Names of environments to add def name = "env1" // Environment URLs, number should match number in previous array for environment names project.addNewEnvironment(name); project.setActiveEnvironment(name); def environ = project.getActiveEnvironment(); def newService; // For REST service: newService = environ.addNewService(binding, com.eviware.soapui.config.ServiceConfig.Type.REST); def serviceConfig = newService.getConfig(); def endpointConfig; endpointConfig = serviceConfig.addNewEndpoint(); newService.buildEndpoint(endpointConfig); def isCopy1 = true; log.info(isCopy1); environ.populateService(newService, isCopy1); environ.release(); For SOAP services: import com.eviware.soapui.model.environment.* import com.eviware.soapui.config.* def project = context.testCase.testSuite.project; // Assuming binding is the first interface on the project. def binding = context.testCase.testSuite.project.getInterfaceAt(1).getName().toString(); // Getting current list of environment names def environNames = project.getEnvironmentNames().toString(); // Names of environments to add def name = "env1" // Environment URLs, number should match number in previous array for environment names project.addNewEnvironment(name); project.setActiveEnvironment(name); def environ = project.getActiveEnvironment(); def newService; // For SOAP service: newService = environ.addNewService(binding, com.eviware.soapui.config.ServiceConfig.Type.SOAP); // For REST service: // newService = environ.addNewService(binding, com.eviware.soapui.config.ServiceConfig.Type.REST); def serviceConfig = newService.getConfig(); def endpointConfig; endpointConfig = serviceConfig.addNewEndpoint(); endpointConfig.setStringValue(url) newService.buildEndpoint(endpointConfig); def isCopy1 = true; log.info(isCopy1); environ.populateService(newService, isCopy1); environ.release(); The two are almost identical except for a couple of lines. Other than that, these have both worked for me without any problems.444Views0likes0Comments