Spring 2005 ECE450H1S Software Engineering IITutorial 7Unit Test and Web service deploymentjunit, AxisSpring 2005 ECE450H1S Software Engineering IILast lecture…On Software Reuse• The concepts of software reuse: to use the ___________ more than once• Classical software reuse techniques• Component-based software reuse– How ___________ help with component-based software reuse• Quality-based software reuse– How ___________ helps with quality-base reuse• Don’t reinvent the wheelSpring 2005 ECE450H1S Software Engineering IIThis tutorial will cover skills you can apply to your project immediately:• Unit test• Deployment of Web servicesNote. We shall do the two tutorials on these subjects, but we have to save some time for you to express yourselves during the next lecture time. Thus we compress the two tutorials into one.Today…Spring 2005 ECE450H1S Software Engineering II1. What is Unit Test?• Unit Test: …• Integration Test: …• System Test: …• Acceptance Test: …The earlier a bug is found, the _______!Test can be done once a unit is ready! Replace other units with ________!Spring 2005 ECE450H1S Software Engineering IIWhat can be tested in units?• A __________ requirement: Given input that satisfies the precondition, whether the output satisfies the post-condition• A unit can be a ____________________________________________________________• __________ is the key! Replace user interaction with the scripts, if possible; replace some with stubs …• A unit tested can still have bugs, but most trivial bugs should have been foundSpring 2005 ECE450H1S Software Engineering IIWhat can not be tested?• Generally, test can not replace the _________ or __________• Specifically for unit test, ______________ ___________________________________________________ are not possible when the system is not ready yetSpring 2005 ECE450H1S Software Engineering IITest-driven development• Extreme Programming– Also called “Paired programming”– How test helps? ______________________• Refactoring– How test helps? __________________________________________________________Spring 2005 ECE450H1S Software Engineering IIOpenOME and JUnitSpring 2005 ECE450H1S Software Engineering II2. Web Service Deployment in the course• We have 11 teams, codenames are:mindz, photons, team2, xteam, lumieresolutions, mugqq, overnight enterprise, team7, websilon, team9, canadiantired• The URL of the tomcat server is http://128.100.36.17:8080• The deployed web service should be placed under c:\program files\apache software foundation\tomcat 5.5\webapps\axis\WEB-INF\classes\<codename>Spring 2005 ECE450H1S Software Engineering II2.1 Develop Web service in AXISdeploy.wsdd, undeploy.wsdd can be generated from WSDL:• java -cp $AXISCLASSPATH org.apache.axis.wsdl.WSDL2Java -s -d Session -Nurn:AddressFetcher2=samples.addrsamples/addr/AddressBook.wsdlStart a simple Axis server• java -cp .:$AXISCLASSPATH org.apache.axis.transport.http.SimpleAxisServer-p 9012 &Deploy the web service• java -cp $AXISCLASSPATH org.apache.axis.client.AdminClient -p 9012 samples/addr/deploy.wsddCall the web service from the client program• java -cp .:$AXISCLASSPATH samples.addr.Main -p 9012 $*Spring 2005 ECE450H1S Software Engineering IIFeedback from the clientUsing proxy without session maintenance.(queries without session should say: "ADDRESS NOT FOUND!")>> Storing address for 'Purdue Boilermaker'>> Querying address for 'Purdue Boilermaker'>> Response is:[ADDRESS NOT FOUND!]>> Querying address for 'Purdue Boilermaker' again>> Response is:[ADDRESS NOT FOUND!]Using proxy with session maintenance.>> Storing address for 'Purdue Boilermaker'>> Querying address for 'Purdue Boilermaker'>> Response is:1 University DriveWest Lafayette, IN 47907Phone: (765) 494-4900>> Querying address for 'Purdue Boilermaker' again>> Response is:1 University DriveWest Lafayette, IN 47907Phone: (765) 494-4900Spring 2005 ECE450H1S Software Engineering II2.2 Test Web Service using JUnitTest Cases (e.g. AddressBookTestCase.java) can be generated by:• java -cp $AXISCLASSPATH org.apache.axis.wsdl.WSDL2Java -s -d Session -Nurn:AddressFetcher2=samples.addr --testCasesamples/addr/AddressBook.wsdlModify the generated AddressBookTestCase.java :public void doTest () throws Exception {String[] args = {"-p", "9012"};Main.main(args);}Run the following command:• java -cp .:$AXISCLASSPATH junit.textui.TestRunner-noloading samples.addr.AddressBookTestCaseSpring 2005 ECE450H1S Software Engineering IIFeedback from the Unit Test• .- Testing address book sample.• Using proxy without session maintenance.• (queries without session should say: "ADDRESS NOT FOUND!")• >> Storing address for 'Purdue Boilermaker'• >> Querying address for 'Purdue Boilermaker'• >> Response is:• [ADDRESS NOT FOUND!]• >> Querying address for 'Purdue Boilermaker' again• >> Response is:• [ADDRESS NOT FOUND!]• Using proxy with session maintenance.• >> Storing address for 'Purdue Boilermaker'• >> Querying address for 'Purdue Boilermaker'• >> Response is:• 1 University Drive• West Lafayette, IN 47907• Phone: (765) 494-4900• >> Querying address for 'Purdue Boilermaker' again• >> Response is:• 1 University Drive• West Lafayette, IN 47907• Phone: (765) 494-4900• - Test complete.• Time: 1.51• OK (1 test)Spring 2005 ECE450H1S Software Engineering II3. The Show time• On March 9 (next Wednesday), Will be monitored and given an impression mark, 2% for presence, 8% for excellence in Phase B! • Who will be the OMEGraphEditor Idol ?• 11 teams in two rounds– mindz, photons, team2, xteam, lumiere solutions– mugqq, overnight enterprise, team7, websilon, team9, canadiantired• We do Q&A session after the presentations of each round• 5 minutes per team for presentation, 5 minutes for question/answers• Which team will be the star? A small prize will be endowed to the best
View Full Document