Java程序辅导

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

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
SE 6367: Software Testing, Validation, and Verification | Prof. Mark Gabel | Fall 2011 October 10, 2011 
 
Page 1 
 
  
HOMEWORK 1: INTELLIJ SETUP AND WARMUP 
Due:  Tuesday, October 18, 2011 via Email 
OBJECTIVES 
1. Set up and install a functional Java development environment 
2. Familiarize yourself with IntelliJ IDEA 
SUMMARY 
Our class project will make use of the Java programming language and the IntelliJ IDEA integrated development 
environment (IDE).  This assignment serves as the first step in our class project: you will install the software and 
begin to familiarize yourself with its features.  Grading will be a simple Pass/Fail. 
INSTRUCTIONS 
If you intend to do this project on your own computer (and I highly recommend you do), start with step 1 below.  If 
you plan to use a lab machine, you may skip steps 1) and 2) below, but do make sure you start with the “one time 
setup” (Step 3). 
1. INSTALL A JAVA DEVELOPMENT KIT (JDK) 
Windows and Linux Users: Download and install a 6-series Oracle JDK from:  
http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u27-download-440405.html 
Mac OS X Users: A suitable JDK is available directly from Apple.  Use the “Software Update” feature to install it and 
ensure it is up to date.  (It may be installed by default on 10.6+, but I am not sure.) 
Note to all users: ensure you download and install a JDK (a development kit), not just a JRE. (Note that the JDK 
does include a JRE, though.) 
2. INSTALL INTELLIJ IDEA ULTIMATE EDITION 
A. Download and install IntelliJ IDEA Ultimate Edition for your platform. 
http://www.jetbrains.com/idea/download/ 
Note: do not install Community Edition.  It lacks the features we need for our project. 
B. Launch IntelliJ IDEA.  When prompted for a license key, log in to eLearning and retrieve our classroom 
license key.  Our user name is “University of Texas at Dallas”. 
C. You may accept all the default setup options (next, next, …, finish) during the first launch. 
3. ONE-TIME IDEA/JDK SETUP 
We must manually tell IntelliJ where you installed the JDK, linking the two together.  This is a one-time process; 
you will not have to perform this setup each time you use IDEA.  
SE 6367: Software Testing, Validation, and Verification | Prof. Mark Gabel | Fall 2011 October 10, 2011 
 
Page 2 
 
  
A. At the IDEA welcome screen, go to the File menu and choose Project Structure.  
B. The Project item in the left pane should be selected by default.  If it is not, select it. 
C. Under Project SDK, select the New button.  (The drop-down next to it should read ). 
D. Select “JSDK”. 
E. Select the directory where you installed the JDK.  
a. Windows users: the default path is C:\Program Files\Java\jdk1.6.0_27.  If you are on a lab 
machine, a slightly different build of Java 1.6 may be installed instead, which will be perfectly 
fine.  It should also be installed under C:\Program Files\Java\, but make sure you select the JDK 
and not the JRE. 
b. Linux users: if you installed the Oracle JVM, this will likely be /usr/java/default (a symlink to 1.6). 
c. Mac users: I cannot confirm the exact location, but the Apple-provided JDK may be located at: 
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK (a symlink to 1.6)  
F. If all goes well, the SDK will be added.  Under Project SDK, you should now see 1.6 in the drop-down 
menu.  Press OK to continue and close the dialog.  
4. SET UP A SAMPLE PROJECT 
A. Download and fully unpack the Homework 1 Sample Project from one of these two locations: 
a. zip: http://www.utdallas.edu/~mark.gabel/teaching/se6367f11/SampleProject.zip 
b. tar.gz: http://www.utdallas.edu/~mark.gabel/teaching/se6367f11/SampleProject.tar.gz 
B. With IDEA open, select Open Project from IDEA home page (or from the File menu). 
C. Navigate to the location where you unpacked the sample project files.  The SampleProject folder should 
display a blue and red IJ icon indicating that it is an IntelliJ project.  Select this directory and choose OK. 
D. Wait for the project indices to build. 
E. The workspace should open with a Project pane on the left and two Code Tabs on the right: one for 
SampleClass one for SampleClassTest.  You may recognize this code from our lecture on condition and 
decision coverage. 
5. MEASURE CODE COVERAGE 
SampleClassTest is a simple test driver for the lone function defined in SampleClass.java.  In this step, we will run 
these tests and use IntelliJ to measure the code coverage. 
A. I have pre-built a run configuration for you.  Select “SampleClassTest” from the drop down at the top of 
the screen (it may already be selected) and select the green Run button. 
 
 
SE 6367: Software Testing, Validation, and Verification | Prof. Mark Gabel | Fall 2011 October 10, 2011 
 
Page 3 
 
  
B. Select the “SampleClass.java” tab and note that IntelliJ has now annotated each line with coverage 
information. 
C. Observe the Project pane (left) and note that IntelliJ has annotated “SampleClass” with two coverage 
metrics: % methods and % lines covered. 
6. SUBMIT! 
At this point, you have completed the most important part of the assignment: IntelliJ is up and running and you 
can run and modify Java projects.  Now, submit proof of completion by carefully following the following 
instructions: 
 Email the TA, Gao (Ricky) Ruizhi, at gao.ruizhi@utdallas.edu 
 In the subject line, include the word SE6367HW1 
 In the body of the message, include as proof of completion the two code coverage metrics for the 
SampleClass class.  After executing, they should be visible in the Project pane.  This should be of the form 
o nn% methods covered 
o nn% lines covered 
(Note: these are just the values that appear when you run the project in its initial state.  I am not asking 
you to write more tests.  Everyone, in theory, should be submitting the same numbers.) 
RESOURCES AND FURTHER STUDY 
Though ungraded, I encourage you to spend some time exploring Java and IntelliJ.  The more time and effort you 
put in, the easier the project (which will be assigned very soon) will be. 
To start, you may want to attempt to add more tests to SampleClassTest and drive coverage up to 100%.  You may 
also want to experiment by modifying SampleClass with different statements and Boolean conditions. 
You may want to browse the IntelliJ wiki: http://wiki.jetbrains.net/intellij/ 
Users of Eclipse may find the following useful: http://wiki.jetbrains.net/intellij/Eclipse_FAQ 
Explore the “Help” menu in the software.  In particular, check out the “Productivity Guide.” It lists all major 
features of the IDE and records how often you use them.  The Keymap reference is a must, too.