Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Lab 6-7 of COMP220 COMP220: Software Development Tools Please, AVOID using Ecpilse (until explicitly required)!! The point is that working jointly with Eclipse and Ant without experience may be overcomplicated and may serve as a source of possible mistakes. Lab 6-7: Ant and JUnit Lab test will take place from 11:00 till 13:00. 13:00 is the deadline for electronic submission. The details will be available before Lab Test. That is, the ordinary Wednesday's lab session will be devoted to the Lab Test and will take 2 hours instead of one. Consider the following instructions on constructing directories and files in dynamics. This will facilitate your understanding. In particular, you will be creating step-by-step a build file   H:\Antbook\ch04\mybuild.xml and a system of subdirectories and Java files and JUnit test cases under ch04. (Use exactly those directory names in your drive H: as suggested here and in slides.) Thereby you will follow some general instructions and ideas. mybuild.xml is important file (also for the Lab Test). Please work on it very carefully with making experimental Ant runs of this file as required in the slides. Build file mybuild.xml will contain many targets devoted to JUnit testing some of which just extend previous to demonstrate more abilities of these targets. That is, each new such a testing target will be an improvement of the previous. The previous version of a testing target will not be just rewritten but will be retained for easier comparisons with the new ones. From the point of view of dependencies between these testing targets they will be isolated one from another but will depend on other targets like init, test-init, compile, test-compile. You should (and already can) decide yourselves which such kind of preliminary running targets do you need for your testing targets to work appropriately and automatically. You will also need to create some properties, and a path to be used in your mybuild.xml file appropriately. You should also realize that this build file is created for the exercise only. It is not an example of a good, full-fledged build file. But it should function appropriately. IMPORTANT REQUIREMENTS An addition to old requirement on using only your personal package declarations like surname.firstName.ID123456789: All your property names like build.test.dir should be personalised like build.test.dir123456789 where instead of 123456789 there should stay your personal ID. The same for the name of mybuild.xml. Use your personalised file name mybuild123456789.xml with your ID. The same for the ID test.casspath. Use test.casspath123456789 with your ID for digits. Your Build file should start with echo message saying that it is your personal build file running by mentioning your first and last names and your personal ID. Note that the above requirement on using your IDs in property names for directories does not mean that your directories like build and build\classes, etc. should involve your IDs. Only directories related with your package names can involve your IDs. These are STRICT requirements related with your future LAB TEST! General advise on these requirements. Using your ID in a package declaration like FirsName.Surname123456789 is not allowed by Java. So, use FirsName.Surname.ID123456789 to start your ID with some letter(s). Since your IDs and other details used in these requirements can have some different writing by any reason (some of you use symbol "_" in some cases but not actually always do that (e.g. use "-" instead), some can make misprint doing that manually). Most reliable way to use, e.g. src.dir123456789 many times in your build file is copy-paste. Remember, any minor mistake can make your build file or java file not working properly. Requirement on formatting and comments Formating of Java source files (and test cases) is as usual. Make also appropriate clarifying comments. Comment any essential step and details (besides those comments present in lecture slides) to demonstrate your personal understanding. Build files should also contain comments either in the form . The lack of comments (either in Java or build files) or only primitive comments will decrease your mark. Thus, comment all essential points, thereby demonstrating your understanding. Note that echo messages outside targets will run before all targets. Thus, if you want to show what a particular target is doing, put echo message appropriately within the target. Formatting for Build file: Sub-elements of an elements should be shifted to the right by 2-3 white spaces (no more! do not use tab key; too big shift resulting in too long lines and makes it difficult to read). Attributes of an element, if put one under another, should be alighned. This allows to make the lines of your build file not too long thereby improving its readability. In the Lab Test you will need to have also MSWord version of your build XML file. Long lines will be shown in this file not in the way you intend. Poor formatting will decrease the mark. Junit Primer and imitation of the command line JUnit work in Ant Please, follow slides Ant, Testing and JUnit (1). Start with creating file SimpleTest.java from Slide 6 under   H:\Antbook\ch04\test and then compile and run this java class from the command line according to Slides 11,12 with the described variations. Of course, you should read and understand all the relevant explanations. Follow the slides and do all the exercises. Start creating   H:\Antbook\ch04\mybuild.xml from Slide 14 to imitate by this build file compile and run commands considered above. Of course, you should include several additional targets, properties, etc. in this build file to make it working. General comment on mybuild.xml: If something does not work, the reason may be not only your possible syntactic error in following instructions from Slides (where we stressed only on the most essential components of mybuild.xml). Some other important components of mybuild.xml may be not presented explicitly in the slides. You should apply your previous knowledge on the main concepts of Ant to make reasonable suggestion on what is missing. Your goal is to make working what is suggested in slides. This way you will revise the whole material and will really understand Ant. This is also the best way to prepare to Exam. Just for example, your init target should look like                                           with using the property build.classes.dir123456789 for the directory build\classes. This also means that you should set this property (and many others) somewhere at the beginning of your build file by using task. You should use in your file only properties with ${...} instead of straightforward directory names! You will surely need an isolated clean target. What do you intend (or it makes sense) to regularly clean? Please, follow slides Ant, Testing and JUnit (2) and do all actions suggested there. In particular, create and run JUnit test case setUpTearDownTest.java under   H:\Antbook\ch04\test as in Slides 6-8. Pay attention to annotations @Test, @Before, @After, methods setUp(), tearDown(), testXXX() and assertions methods used. Also pay attention to the correspondence of the package of this test case to the directory structure under H:\Antbook\ch04\test. Read also preceding and following slides to understand all the concepts and do all required actions. Capturing test results Please, follow slides Ant, Testing and JUnit - Capturing test results. Try to follow all exercises in these slides step-by-step, with understanding each step. The culminating point which you should necessarily achieve to succeed in Lab Test should be the automated creating HTML report of your tests. Note, that all the preliminary steps are very important to understanding how we have approached to the final version (the target test on Slides 20, 21). Now, instead of not so pleasant extracting from a console the results of testing we will have testing reports in a very convenient HTML form!