Skip to content

Commit

Permalink
Added help docs for junit plugin, and add docs about the maven test g…
Browse files Browse the repository at this point in the history
…oal.
  • Loading branch information
davsclaus committed Dec 10, 2013
1 parent 6c0b5c4 commit 085a471
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 3 deletions.
32 changes: 32 additions & 0 deletions docs/MavenPlugins.md
Expand Up @@ -28,6 +28,10 @@
<td>camel-blueprint</td>
<td>The same as the camel goal but needed when using OSGi Blueprint Camel applications.</td>
</tr>
<tr>
<td>test</td>
<td>This goal run the unit tests of the Maven project. Can be used together with the <a href"http://hawt.io/plugins/junit.html">JUnit</a> plugin to run unit tests from within hawtio console as well. This plugin is currently <strong>Work in progress</strong>, and subject for changes.</td>
</tr>
</table>


Expand Down Expand Up @@ -177,6 +181,34 @@ The camel goal extends the run goal and provides the following additional option
</tr>
</table>

### test Maven Goal configuration

The test **hawtio** Maven Plugins provides the following common options:

<table class="table">
<tr>
<th>Option</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td>className</td>
<td></td>
<td>Optional to select a specific unit test class to start testing (must specific class name as fully qualified classname)</td>
</tr>
<tr>
<td>testName</td>
<td></td>
<td>Optional to select a specific test method(s) to filter and use for testing. You can use * as wildcard to match multiple test methods.</td>
</tr>
</table>

If no **className** has been specified then **hawtio** is started up included the projects test classpath, and the <a href="hawt.io/plugins/junit">junit plugin</a> can be used to select tests to run from within **hawtio** console itself.

If a **className** has been specified then unit testing of the selected class happens when **hawtio** has been started, **but** the unit test will not tear down until the user press enter in the shell. This is on purpose allowing using **hawtio** to inspect the state of the JVM during and after testing. For example to look at the Camel plugin to see route diagrams and profiles with metrics from the completed unit tests.

Pressing enter in the shell runs the tear down of the unit tests, which for example could unregister Camel from JMX and therefore remove the CamelContext used during testing. When using the <a href="hawt.io/plugins/junit">junit plugin</a> to run unit tests, then these tests will tear down immediately when they complete, and therefore remove any CamelContexts during testing. This may change in the future, allows to keep the CamelContexts alive after testing, giving end users time to inspect the data; and then tear down by pressing a button.


## Configuring hawtio Maven Plugin in pom.xml

Expand Down
5 changes: 5 additions & 0 deletions docs/Plugins.md
Expand Up @@ -111,6 +111,11 @@ documents from indices.</td>
<td>Provides the core <a href="http://www.oracle.com/technetwork/java/javase/tech/javamanagement-140525.html">JMX</a> support for interacting with MBeans, viewing real time attributes, charting and invoking operations.</td>
<td><a href="https://github.com/hawtio/hawtio/tree/master/hawtio-web/src/main/webapp/app/jmx">jmx</a></td>
</tr>
<tr>
<td><a href="http://hawt.io/plugins/junit/">junit</a></td>
<td>Adds support for running JUnit tests from wihtin hawtio.</td>
<td><a href="https://github.com/hawtio/hawtio/tree/master/hawtio-web/src/main/webapp/app/junit">junit</a></td>
</tr>
<tr>
<td><a href="http://hawt.io/plugins/jvm/">jvm</a></td>
<td>The jvm plugin allows you to connect to local or remote JVMs, and as well install the Jolokia JVM agent into the JVMs.</td>
Expand Down
33 changes: 33 additions & 0 deletions hawtio-web/src/main/webapp/app/junit/doc/help.md
@@ -0,0 +1,33 @@
### JUnit

The [JUnit](#/junit/tests/) plugin in [hawtio](http://hawt.io "hawtio") gives a raw view of the underlying JMX metric data, allowing access to the entire JMX domain tree of MBeans.

##### JUnit Tree #####

The topmost level of the JUnit tree view lists all the JUnit @Test classed currently within the running JVM.

![JUnit Tree](app/junit/doc/img/junit-tree.png "JUnit Tree")

Click the <i class='icon-chevron-right'></i> icon to expand a tree item and further navigate into Java packages.


##### Testing #####

On the main view area is a table that lists all the unit test classes from the selected Java package in the JUnit Tree (will list all test classes by default).

![JUnit Tests](app/junit/doc/img/junit-tests.png "JUnit Tests")

You can select any number of unit test classes to run as unit tests.

During testing there is a test summary which reports the progress.

![JUnit Testing](app/junit/doc/img/junit-testing.png "JUnit Testing")

.. and when the tests finishes the failed tests is listed, which can be expanded, to see any stacktrace with the failure.


##### Other Functionality #####

The [JUnit](#/junit/) can be used together with the [Test Maven Plugin](http://hawt.io/maven/) which can be used to startup
the hawtio console of a given Maven project, with unit test classes included in the classpath, allowing the [JUnit](#/junit/)
to be used to start the tests, while using the rest of the functionality of hawtio to inspect live data while the test runs.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions hawtio-web/src/main/webapp/app/junit/js/junitPlugin.ts
Expand Up @@ -19,11 +19,10 @@ module JUnit {
run(($location:ng.ILocationService, workspace:Workspace, viewRegistry, layoutFull, helpRegistry) => {

viewRegistry['junit'] = 'app/junit/html/layoutJUnitTree.html';
/*

helpRegistry.addUserDoc('junit', 'app/junit/doc/help.md', () => {
return isJUnitPluginEnabled(workspace);
});
*/

workspace.topLevelTabs.push({
content: "JUnit",
Expand Down
2 changes: 1 addition & 1 deletion website/pom.xml
Expand Up @@ -125,7 +125,7 @@
find src/main/webapp/app -name "img" | grep "/doc/"
then removing the prefix and postfix :)
-->
<ac:for list="camel,core,forcegraph,jboss,jetty,jmx,tomcat" param="file" xmlns:ac="antlib:net.sf.antcontrib">
<ac:for list="camel,core,forcegraph,jboss,jetty,jmx,junit,tomcat" param="file" xmlns:ac="antlib:net.sf.antcontrib">
<sequential>
<echo>Processing plugin @{file}</echo>
<mkdir dir="${project.build.directory}/sitegen/plugins/@{file}/app/@{file}"/>
Expand Down
9 changes: 9 additions & 0 deletions website/src/plugins/junit/index.page
@@ -0,0 +1,9 @@
---
title: hawtio JUnit plugin
--- pipeline:ssp,markdown
<div id="content-header">
<div class="container">
${unescape(loadText(new FileInputStream(app_dir + "/junit/doc/help.md")))}

</div>
</div>

0 comments on commit 085a471

Please sign in to comment.