An important part of programming is ensuring that your program can handle all possible test cases. Maven has built in support for unit testing. It works with JUnit to easily allow you to create and run your test cases. When we first created our program using the archetype quickstart to get our project created, it automatically created a test directory with a test application. Let’s look at that file now. As you can see, this is not a very robust program and therefore the test case is also very simple. It simply returns assertTrue(true) every time.
- [Instructor] Let's talk a little bit about unit testing.…As I'm sure you'll agree, unit testing is a critical step…in any programming project.…What's really nice about Maven is that it provides…built-in support for unit testing.…JUnit plug-in is used to easily test our application.…When we first created our project…using the archetype quick start to get our project created,…it automatically created a test directory…with a test application.…Let's take a look at that file now.…Remember, that application simply printed "Hello world."…The name of my program was Sample.…
I'm gonna open up Sample, and at first…I wanna open up the POM file.…I need to right click on the POM file…and say edit with Notepad++.…Notice it automatically has the dependency of JUnit.…That was done by Maven for us.…Okay, let's go back into the SRC…for the sample program and into Test.…Inside Test, Java, com, lynda.…Here is our program called AppTest…that was created automatically for us.…
I did not write this code.…Let's open it up.…As you can see it has the package com.lynda on line one.…
- Downloading Maven
- Installing Maven
- Understanding the lifecycle and dependencies of Maven
- Working with the Project Object Model (POM)
- Defining project relationships
- Using Maven plugins
- Creating a sample project with Maven
- Writing tests in Maven
- Packaging your app
Skill Level Intermediate
Java Database Integration with JDBCwith David Gassner2h 51m Intermediate
Java EE Essentials: Enterprise JavaBeanswith Patrick Royal1h 45m Intermediate
1. Get Started with Maven
2. Understand Maven
3. Project Object Model (POM)
4. Maven Plugins
5. Create a Project with Maven
6. Test with Maven
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.