Close
Register
Close Window

Masters of Engineering Bridge Course

Chapter 7 Testing and Exceptions

Show Source |    | About   «  6.6. Static, Main, and Exceptions   ::   Contents   ::   7.2. More on Exceptions  »

7.1. Java Unit Testing

7.1.1. Objectives

Upon completion of this module, students will be able to:

  • Identify the basics of a java class including fields, constructors, methods, parameters, and use of the keyword this

  • Run a java program in eclipse

  • Run junit tests in eclipse, debug code, and tinker with code

  • Write a test class with test methods that use junit assert statements

  • Write junit tests that have complete code coverage

7.1.2. Introduction to Hokie Class

7.1.2.1. [6:07] Introduction to Hokie Class Video

<iframe id=”kaltura_player” src=”https://cdnapisec.kaltura.com/p/2375811/sp/237581100/embedIframeJs/uiconf_id/41950791/partner_id/2375811?iframeembed=true&playerId=kaltura_player&entry_id=1_0850nht8&flashvars[streamerType]=auto&amp;flashvars[localizationCode]=en&amp;flashvars[leadWithHTML5]=true&amp;flashvars[sideBarContainer.plugin]=true&amp;flashvars[sideBarContainer.position]=left&amp;flashvars[sideBarContainer.clickToClose]=true&amp;flashvars[chapters.plugin]=true&amp;flashvars[chapters.layout]=vertical&amp;flashvars[chapters.thumbnailRotator]=false&amp;flashvars[streamSelector.plugin]=true&amp;flashvars[EmbedPlayer.SpinnerTarget]=videoHolder&amp;flashvars[dualScreen.plugin]=true&amp;flashvars[hotspots.plugin]=1&amp;flashvars[Kaltura.addCrossoriginToIframe]=true&amp;&wid=1_57q5cew0” width=”560” height=”630” allowfullscreen webkitallowfullscreen mozAllowFullScreen allow=”autoplay *; fullscreen *; encrypted-media *” sandbox=”allow-forms allow-same-origin allow-scripts allow-top-navigation allow-pointer-lock allow-popups allow-modals allow-orientation-lock allow-popups-to-escape-sandbox allow-presentation allow-top-navigation-by-user-activation” frameborder=”0” title=”Kaltura Player”></iframe>

7.1.2.2. Zipped File Example

Download to run and explore on your own in eclipse:

TODO: fix URLS.

Download Link Here

TODO: fix URLS.

This `link <>`_ will direct you to the steps to `download and import <>`_ previously written code into the Eclipse environment.

7.1.2.2.1. Note:

<TODO: CHECK ON THIS> The sample project above requires one or more of the CS 2114 Support Projects (CS2-Support, CS2DataStructuresLib, CS-GraphWindowLib).

Before using the above sample project you must

Complete the configuration steps described in the Pre-Lab part of Lab 2 Download the CS 2114 Support Projects to your machine When you complete the Pre-Lab part of Lab 2 you will be able to download the support projects via eclipse using the blue down arrow icon or using the Project Menu and selecting “Download Assignment…”

7.1.3. Checkpoint 1

7.1.4. Intro to Hokie Class JUnit Testing

7.1.4.1. [19:37] Hokie Class JUnit Testing Video

<iframe id=”kaltura_player” src=”https://cdnapisec.kaltura.com/p/2375811/sp/237581100/embedIframeJs/uiconf_id/41950791/partner_id/2375811?iframeembed=true&playerId=kaltura_player&entry_id=1_35cpol6i&flashvars[streamerType]=auto&amp;flashvars[localizationCode]=en&amp;flashvars[leadWithHTML5]=true&amp;flashvars[sideBarContainer.plugin]=true&amp;flashvars[sideBarContainer.position]=left&amp;flashvars[sideBarContainer.clickToClose]=true&amp;flashvars[chapters.plugin]=true&amp;flashvars[chapters.layout]=vertical&amp;flashvars[chapters.thumbnailRotator]=false&amp;flashvars[streamSelector.plugin]=true&amp;flashvars[EmbedPlayer.SpinnerTarget]=videoHolder&amp;flashvars[dualScreen.plugin]=true&amp;flashvars[hotspots.plugin]=1&amp;flashvars[Kaltura.addCrossoriginToIframe]=true&amp;&wid=1_m8r5pgfb” width=”560” height=”630” allowfullscreen webkitallowfullscreen mozAllowFullScreen allow=”autoplay *; fullscreen *; encrypted-media *” sandbox=”allow-forms allow-same-origin allow-scripts allow-top-navigation allow-pointer-lock allow-popups allow-modals allow-orientation-lock allow-popups-to-escape-sandbox allow-presentation allow-top-navigation-by-user-activation” frameborder=”0” title=”Kaltura Player”></iframe>

TODO: fix URLS.

Java JUnit Testing PPT

7.1.5. Checkpoint 2

7.1.6. Review of Writing JUnit Tests with student.TestCase

<iframe id=”kaltura_player” src=”https://cdnapisec.kaltura.com/p/2375811/sp/237581100/embedIframeJs/uiconf_id/41950791/partner_id/2375811?iframeembed=true&playerId=kaltura_player&entry_id=1_zj2voxbz&flashvars[streamerType]=auto&amp;flashvars[localizationCode]=en&amp;flashvars[leadWithHTML5]=true&amp;flashvars[sideBarContainer.plugin]=true&amp;flashvars[sideBarContainer.position]=left&amp;flashvars[sideBarContainer.clickToClose]=true&amp;flashvars[chapters.plugin]=true&amp;flashvars[chapters.layout]=vertical&amp;flashvars[chapters.thumbnailRotator]=false&amp;flashvars[streamSelector.plugin]=true&amp;flashvars[EmbedPlayer.SpinnerTarget]=videoHolder&amp;flashvars[dualScreen.plugin]=true&amp;flashvars[hotspots.plugin]=1&amp;flashvars[Kaltura.addCrossoriginToIframe]=true&amp;&wid=1_jkkkycol” width=”560” height=”630” allowfullscreen webkitallowfullscreen mozAllowFullScreen allow=”autoplay *; fullscreen *; encrypted-media *” sandbox=”allow-forms allow-same-origin allow-scripts allow-top-navigation allow-pointer-lock allow-popups allow-modals allow-orientation-lock allow-popups-to-escape-sandbox allow-presentation allow-top-navigation-by-user-activation” frameborder=”0” title=”Kaltura Player”></iframe>

7.1.6.1. Course reference for Junit Tests:

TODO: fix URLS.

`Writing Junit Tests With Student TestCase <>`_

7.1.7. Checkpoint 3

   «  6.6. Static, Main, and Exceptions   ::   Contents   ::   7.2. More on Exceptions  »

nsf
Close Window