Introduction, Setup, and Running Tests - aapowers/BroadleafCommerce GitHub Wiki
According to their GitHub README,
BroadleafCommerce is an e-commerce framework written entirely in Java and leveraging the Spring framework. It is targeted at facilitating the development of enterprise-class, commerce-driven sites by providing a robust data model, services and specialized tooling that take care of most of the "heavy lifting" work.
BroadleafCommerce provided the e-commerce platform for the Container Store, O'Reilly Auto Parts, and more. Because e-commerce platforms handle money, financial information, and personal client information, it is important that they are well tested.
As of release broadleaf-5.2.15.2-GA, BroadleafCommerce contains over 184,000 lines of code and has over 1.1k forks and 1.4k stars on GitHub.
For more information, please see the BroadleafCommerce website.
Fork and clone the BroadleafCommerce repository on GitHub.
Open the project in IntelliJ IDEA. When you first open the project, mvn install
may run automatically for you.
If not, run mvn install
in the root directory of the project in order to compile.
It should say BUILD SUCCESS
towards the end of the output:
As of release broadleaf-5.2.15.2-GA, there are 488 existing jUnit test cases in the integration test suite, and numerous other jUnit tests that are not part of the integration test suite. Many modules have 100% code coverage. However, there are some modules that could benefit from additional testing, particiularly with individual unit tests (outside of the integration test suite).
Running mvn install
runs all of the tests, but does not give detailed output.
Running mvn integration-test
runs all the tests in the integration suite and outputs the total number of tests.
For a nice interface to view the status of tests as they are run, set up a Maven Configuration in IntelliJ.
Configuration:
After setting up the Configuration, click run
and watch the tests pass (or fail):
Running the tests also generates the code coverage for the modules, which can be found under
path-to-module/target/site/jacobo/jacobo-sessions.html
for most modules.
Opening the jacobo-sessions.html
file in a browser provides a simple interface for viewing the
code coverage for the module.
The code coverage is shown in percentages by class or file with aditional data:
Clicking on one of the classes or files shows the code coverage with colorful highlighting in a line-by-line view:
To run individual unit tests or all the unit tests in one specific class, right click on the test or class function
name and select Run <name>
: