Contributions
Re: Automate SoapUI
yes, made it work! Your reply made me find this site: http://www.programcreek.com/java-api-examples/index.php?source_dir=soapui-master/soapui/src/main/java/com/eviware/soapui/impl/wsdl/actions/project/AddRestUriAction.java and there i finally learned what those imports mean and what they exactly do. and then i found another side which told me how to set the keyword project right, so that i could skip the whole 'testrunner' line that was shifting me to the initial project again :) I am sure my code is not clean yet, but it works now! My code is now: import com.eviware.soapui.impl.wsdl.* import com.eviware.soapui.impl.WsdlInterfaceFactory import com.eviware.soapui.impl.wsdl.teststeps.* import com.eviware.soapui.impl.wsdl.WsdlProject import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory def url = context.expand( '${Lees wsdl vanuit excel#url}' ) def projectName = context.expand( '${Lees wsdl vanuit excel#naam}' ) def currentProject = testRunner.testCase.testSuite.project def workspace = testRunner.testCase.testSuite.project.workspace WsdlProject project = currentProject .getWorkspace() .createProject(projectName, new File(projectName + ".xml")) WsdlInterface iface = WsdlInterfaceFactory.importWsdl(project, url, true )[0] project = workspace.getProjectByName(projectName) suite = project.addNewTestSuite("testsuite1") tc = suite.addNewTestCase ("testcase1") def factory = new WsdlTestRequestStepFactory() //for (iFace in testRunner.testCase.testSuite.project.getInterfaceList()) { for (iFace in project.getInterfaceList()) { if (iFace.getName().matches(".*?[0-9]")) { for (operation in iFace.getOperationList()) { TStepC = WsdlTestRequestStepFactory.createConfig(operation, operation.getName()); testStep = tc.addTestStep(TStepC); } } }2.8KViews0likes2CommentsRe: Automate SoapUI
Hi Rupert, Many thanks for your reply!!! Yeah, its the testrunner line that sets me back to the original project. Its 1 of those lines i don't get how it works. I have triend to put a variabele at the place of the .project. but that doesnt work, so the 'project' seems to be some statement that needs to be in that line and can't be altered. The fun part is that the WSDL is actually imported in the new project. I don't know why exactly (if i know why, then i probably can work out why it isn't doing the same for the teststeps). If i look at this part: WsdlProject project = currentProject .getWorkspace() .createProject(projectName, new File(projectName + ".xml")) WsdlInterface iface = WsdlInterfaceFactory.importWsdl(project, url, true )[0] suite = project.addNewTestSuite("testsuite1") tc = suite.addNewTestCase ("testcase1") and i Run it, the currentProject variabele gives back the 'original project', so i am puzzled why the line 'WsdlInterface iface = WsdlInterfaceFactory.importWsdl(project, url, true )[0]' actually imports the wsdl into the right project (i mean, its the same project variabele as in the testrunner line). Maybe its a nice side-effect of the 'createProject' line...(that he keeps the focus on the newly made project there) I will definatly try to use the code you gave from the Action method. How dit you find that? As a newbee, i thought those commands were just fixed commands for the groovy language :) Happy surprise that there is actually a way of finding out what its really doing! So many thanks and if i succeed, i will definatly let you know :)2.8KViews0likes3CommentsRe: Automate SoapUI
This is getting frustrating...are there any ppl out here who know Groovy script at all? The only person that gave me something, has been rupert Anderson (which i thank for his replies) I have lots of experience in amateur-programming VBA, so i know some of the concepts of programming, and i know that i am only a little way off of what i want to do. Its a matter of not knowing how to get to the right project... Is my question so hard, or is this just an dead forum? And yes, i googled a lot, tried to understand whats going on, but i cant seem to find some sort of 'Groovy for dummies' page with explanations that i can actually understand...2.8KViews0likes5CommentsRe: Automate SoapUI
Almost there...i found some code that does what i want. Only thing is...it does work, but looks at the wrong project... My full code is now: import com.eviware.soapui.impl.wsdl.* import com.eviware.soapui.impl.WsdlInterfaceFactory import com.eviware.soapui.impl.wsdl.teststeps.* def url = context.expand( '${Lees wsdl vanuit excel#url}' ) def projectName = context.expand( '${Lees wsdl vanuit excel#naam}' ) def currentProject = testRunner.testCase.testSuite.project def workspace = testRunner.testCase.testSuite.project.workspace WsdlProject project = currentProject .getWorkspace() .createProject(projectName, new File(projectName + ".xml")) WsdlInterface iface = WsdlInterfaceFactory.importWsdl(project, url, true )[0] //Lees wsdl vanuit excel //def project = workspace.createProject(projectName, new File(projectName + ".xml")) suite = project.addNewTestSuite("testsuite1") tc = suite.addNewTestCase ("testcase1") //new part for making the teststeps for (iFace in testRunner.testCase.testSuite.project.getInterfaceList()) { //for (iFace in testRunner.tc.suite.project.getInterfaceList()) { if (iFace.getName().matches(".*?[0-9]")) { for (operation in iFace.getOperationList()) { TStepC = WsdlTestRequestStepFactory.createConfig(operation, operation.getName()); testStep = tc.addTestStep(TStepC); } } } The last part works, if i copy the script to the newly made project and run it there. It doesn't work if i keep it in the starting project. Either the getInterfaceList or the getOperationList commando is looking at the wrong project. The code supposes to make a new project, with a new testsuite, a new testcase and new teststeps. Up till making a new testcase, it works fine. It makes a brandnew Testcase in the new project. The last part, the new teststeps are however not made in the new project.. Can anyone help me out to straighten this out? Should be such a small thing, but i have been staring and trying for hours now and i cannot seem to get it right...2.8KViews0likes6CommentsRe: Automate SoapUI
Hi Rupert, Thanks for the reply. Difficulty for me is that i am a complete newbee at groovy and java. Which means i really don't know which commando i actually miss. So far i have got this working: I have 1 project, with a datasource step and a groovy step. The datasource step will get the variables url and name for me from an excel list. Up till making the project and the testsuite + testcase, it works fine. But now i have to add some lines to make the appropiate teststeps for me. The WSDL has several methods included and i need some code to add them all. I have been googling and trying to get the right syntax, but i cant seem to get the steps made from the wsdl. ------------------------------------------------------------- import com.eviware.soapui.impl.wsdl.* import com.eviware.soapui.impl.WsdlInterfaceFactory import com.eviware.soapui.impl.wsdl.teststeps.* def url = context.expand( '${Lees wsdl vanuit excel#url}' ) def projectName = context.expand( '${Lees wsdl vanuit excel#naam}' ) def currentProject = testRunner.testCase.testSuite.project def workspace = testRunner.testCase.testSuite.project.workspace WsdlProject project = currentProject .getWorkspace() .createProject(projectName, new File(projectName + ".xml")) WsdlInterface iface = WsdlInterfaceFactory.importWsdl(project, url, true )[0] suite = project.addNewTestSuite("testsuite1") tc = suite.addNewTestCase ("testcase1") ------------------------------------------------------------------2.8KViews0likes7CommentsRe: Automate SoapUI
Ok, i managed to do steps 1 and 2 Atm i am really struggling with adding SOAP teststeps from the WSDL. I have several operations in the WSDL, lets say: Create, CreateOrUpdate, Delete, Retrieve, etc. Now i need to make 1 teststep for each operations in the wsdl automatically. Does anyone know how to let groovy read the wsdl and make a teststep for each method found? I am working with the following: Project Test Suite: Testsuite 1 Case: Testcase 1 Teststeps? (to be made)2.8KViews0likes9CommentsRe: Automate SoapUI
Hi There, Sounds Ok, that Jenkins and i will definatelly look into it. It might be usefull for me in future, but its not what i want to do at this moment.. What i want to do is make the projects, testcases and teststeps every time i need to do my regression tests so that i don't have to keep track of every single alteration in the wsdl's. Its supposed to become a time saver. For this moment all i have to know is what groovy command i need to use to close project A and open project B. If i know that, then i can try (its all try and error atm) to get a step further... The steps that i want to follow are: 1: automatically make projects 1.1 automatically fill some environment variables like different environment url's, different usernames/passwords, etc 2: automatically make testcases 3: automatically make teststeps 4: automatically fill the teststeps 5: run tests automatically and get a report Step 1 is working (not 1.1, i will save that for later) Step 2 isnt atm. Step 5 is covered, i know how to do that2.8KViews0likes10CommentsRe: Automate SoapUI
Hi Rupert, You know anything of scripting in Groovy? I got some that seems to work, but there is 1 thing i can't seem to figure out. What i have so far: 1: excel with 2 columns; name and url 2: project with datasource and groovy script. I open the project en when i run it, it first gets the name and url from the datasource It then makes a project with the wsdl (url) from the datasource. That goes well! Now i need to add the next step: adding a testsuite and testcase. I have this working also, except for 1 annoying thing...the testsuite and testcase are added under my original project and not under the one i just made. here is the script i found and am altering:There is something wrong with the red part...Can you see what i am doing wrong? Thanks in advance!! //some blabla, dunno what for import com.eviware.soapui.impl.wsdl.* import com.eviware.soapui.impl.WsdlInterfaceFactory //getting variables URL and Name def url = context.expand( '${DataSource#url}' ) def currentProject = testRunner.testCase.testSuite.project def project1 = testRunner.testCase.testSuite.project String projectName = context.expand( '${DataSource#naam}' ) //guess this actually makes the project WsdlProject project = currentProject .getWorkspace() .createProject(projectName, new File(projectName + ".xml")) WsdlInterface iface = WsdlInterfaceFactory.importWsdl(project, url, true )[0] //something is wrong here. My goal with these lines is to make the newly made project active so that the suite is made in that project //Doesn't work! I need to switch from project A to Project B here... import com.eviware.soapui.impl.wsdl.* WsdlProjectPro project2 = new WsdlProjectPro('${DataSource#naam}'); currentProject = testRunner.testCase.testSuite.project2.name == '${DataSource#naam}' //here the suite and testacses are made suite = context.testCase.testSuite.project.addNewTestSuite("test") tc = suite.addNewTestCase("test case") context.testCase.testSuite.project.save()4.3KViews0likes0CommentsRe: Automate SoapUI
Hi There, Thanks for replying :) Yeah, it seems to me like a small step... At this moment, i make projects by adding an name, WSDL url and click Yes a cpl of times. Soapui does the rest and when its finished, all i have to do is put some values in the fields of the test case. I have to make about 60 projects in order to test every service we use. We have a lot of ongoing projects, so i have to do this frequently cause our services change a lot and i do not always exactly know which ones are altered, so best thing for me is to 'reload' the wsdl each time or to delete all projects and make new ones. So i was hoping there was some sort of batch function that reads the url from an excel list and makes the project automatically (so not filling the testcases, that i can automate another way by making them data driven, my goal atm is only making projects automatically). I now understand it can be done, but you have to use groovy or java for that (which i both don't know yet), so for now it looks like i have to do it the 'old fashioned' way..4.3KViews0likes2CommentsAutomate SoapUI
Hi There, I wonder; is there anyway to 'Automate' SOAPUI entirely? I mean; not only running tests, but also making them? And besides making them, also have stuff like adding and using environments and Usernames/Passwords automatically? (for instance; make and use them for every project encountered in folder X??) What i would like to do, is having a list with for example 4 colomns (Name; WSDL; Environment; Username/Password) and let SoapUI make a project for each line in that list. Is there anyway to make this happen?5.5KViews0likes20Comments