There are no free boating license tests available, online or in-person. However, there are some organizations that offer free safety courses for either beginner or advanced boaters, such as the one offered at Boat US.
The price of a license test varies according to the state at which it is taken. For complete details on what is required for a boating license, check the local states office.
Although the tests are not free, there are study guides that can be accessed through online databases, such as Boat Us. These study guides are not limited to license exams, but include safety courses and other advanced marine classes.