Wednesday, March 03, 2010

SOAPUi and MSBuild

After my last post I cannot withhold you from this nugget. It’s a guy (Todd) that have created some MSBuild targets to call SOAPUi from a build script.
I am about to try it out… I’ll get back to you if I run into problems.

[UPDATED]
Yup - it worked! Great! Thanks Todd.

Still have some issues in that the switch /endpoint will override all the endpoints in the SOAPUi project... But I'm on it...

[UPDATED AGAIN]

See this on how to solve the endpoint problem.

11 comments:

Unknown said...

Phew! My scripts often don't work.

Anonymous said...

Hey - it not only worked - it worked LIKE A CHARM.

Thanks man!

Anonymous said...

excellent post.... thank you so much for this post .. it worked like any thing.. Also if you don't mind i have one more help needed, When I run this project file from ms build(TFS) soapUI test runs as expected but It is not displaying test results and code coverage results

can you please help me to generate test results and code coverage results with in the build
Default Configuration and Platform

Here is the results below

0 error(s), 0 warning(s)
1 projects/solutions compiled
No Test Results
No Code Coverage Results

Thanks again for your help
SR

Marcus said...

Aha - now you're brushing om something hard.

The first thing to remember is that your running the SoapUi testrunner (see http://www.soapui.org/Test-Automation/functional-tests.html) and it's not trivial to integrate with TFSBuild, to get your results published to there.

But (phew!) SoapUi is creating a lot of logs and data from the test run. See the Command line argument on the page I've linked up above to see where you can find/place them.

Hope this helps

Unknown said...

Thanks for the replay Marcus,

Yes I tried below link but my manger is looking especially Code Coverage % from soapUI test to display in View Summary page, I have been spending count less hours and days on this to get it done but I am not finding any way to do it, can you please help me if you know any other ways to generate code coverage based on the log file


0 error(s), 0 warning(s)
1 projects/solutions compiled
No Test Results
No Code Coverage Results

Appreciate your help and you will save my job:)
-SR

Anonymous said...

Thanks for the replay Marcus,

Yes I tried below link but my manger is looking especially Code Coverage % from soapUI test to display in View Summary page, I have been spending count less hours and days on this to get it done but I am not finding any way to do it, can you please help me if you know any other ways to generate code coverage based on the log file


0 error(s), 0 warning(s)
1 projects/solutions compiled
No Test Results
No Code Coverage Results

Appreciate your help and you will save my job:)
-SR

Marcus said...

Hello again Sreenivas,

I don't think that's even possible - to get the coverage result of your code when you execute SOAPUi tests.

You (and your manager :)) have to remember that these tests are testing black-box, that is; the outside of a deployed service (i.e. from the contract) and Code Coverage measure how much of the internal code that is covered.

In other words - SOAPUI are calling the webservice as any client would. Not knowing anything about the inside of the webservice - as it should be! But to get code coverage in the way you describe you need to have access to the internal code of the service (at least to my knowledge)

There are two things you can do:
- SOAPUi have a coverage report. And that measure how much of the contract and assertions that are run, how many of them that went well etc.
- you can also write unit-tests that run your service in the same process (simply instanciate your service with var svc = new MyService();) and use MsTest's built in Code Coverage report. Then you will not use SOAPUi at all which might not be what you want

I hope this helps you - and that you don't have to put in any more countless hours. Not worth it, man!

Unknown said...

Marcus,

Thanks again for quick response and clarifications, I will try to get node coverage from soapUI.

Also one more help if possible, I am able to get below results in the logs when run the soapUI test from MSBuild(TFS).
SoapUI 3.6.1 TestCaseRunner Summary
-----------------------------
Time Taken: 73893ms
Total TestSuites: 9
Total TestCases: 251 (0 failed)
Total TestSteps: 981
Total Request Assertions: 2836
Total Failed Assertions: 0
Total Exported Results: 0

The question is there any way to parse this logs and display in view summary page or send an email with this results from TFS after build is completed?

Thanks
SR

Marcus said...

@Sreenivas,

I haven't check this out before - but there's an extensive reporting infrastructure. Read about it here: http://www.soapui.org/Reporting/getting-started-with-reporting.html

Haven't worked with it though.

I haven't seen any possibilities to email reports but if your tests generates and HTML-report (or a text btw) and place it in a well-known location on every test run, you can point your users there and they can check out the latests results.

Good luck!

Anonymous said...

Thanks you so much for all your help,

Finally I am able to save the soapUI results on output folder, now I am planing to send an email to every with results once build is completed either in HTML format or links

Here is the MSbuild file that I am using but some thing i am missing in the file, can you please help me to resolve this issue





NightlyBuildProject.xml
\\ABCD\build_output\SoapUI_Results







$(ProgramFiles)\eviware\soapUI-Pro-3.6.1\bin
$(MSBuildProjectDirectory)\$(SoapUiProject)
"$(SoapUiPath)\testrunner.bat" @(Args,' ')-r -o -g "$(TestProject)"

Anonymous said...

Unable to send complete MSBuild file, Please let me know is it possible to send via email

Thanks
SR