FitNesse - TeamDewberry/jmxdatamart GitHub Wiki

##Opening the wiki page using NetBeans and Maven:

  1. Open NetBeans and Open jmxdatamart Project

  2. Open the NetBeans Terminal by going to Window -> Output -> Terminal

  3. Navigate to your jmxdatamart directory in Terminal using "cd" commands. If you are unsure where your directory is, you can mouse-over the project inside your Projects tab (on the top left side of the screen) and it will tell you.

  4. Once you are in your jmxdatamart directory, run

     mvn -Dwiki integration-test
    

    This will automatically start downloading many files, and may take a long time depending on your connection speed. When Finished successfully, a local wiki server will be launched. The Terminal output should look like this:

    Terminal Output

  5. Open a new web browser. Open the following URL:

     http://localhost:8787/DataMartTests
    
  6. This opens the wiki page where you can edit tests, and run all tests using the "Suite" button.

##Car example: Creating MBeans, Assigning values and Validating the bean

First, try running the CarMBeanTest in fitness wiki to see what happens.
Click the "Test" button on the top right hand of the page to run.
The button should change to "Tests Executed OK", and the 4 table cells in the bottom should turn green. This means that the bean was created successfully with correct values.

CarMbeanTest

You can edit this test by going into "Edit" mode from the button on the top right.
In here, you edit the values in the tables.
FitNesse creates the MBeans following the top table.
Then It assigns values according to the middle table.
Finally, it checks if it created the correct bean by using the bottom table.
The "?" mark on the bottom table's "value?" cell indicates that that column is what the bean will be tested against (This is your expected values). Change any value in here and you will see that the test will fail.
When test fails, it will tell you what the expected value was and what it actually got.
You can see that the actual value it found during the test is the value you set using the middle table.

Edit Mode

Each of these tables correspond to .java files in our fitnesse folder.
The table title such as "create MBeans" correspond to "createMbeans.java".
The name of the file must be a concatenated version of the table name, this is a convention of FitNesse.
You can change what attributes a bean has from "CarMBean.java".
If you look inside "CarMBean.java", you can see that the attributes are all declared in here. Declare these attributes with what you want them to store, for example, "NAME" is declared as a String, and "ENGINE" is declared as an int.
When you add a new attribute, you must add corresponding "get" and "set" functions. From convention, these functions must be a name made by concatenating "get" or "set" with the attribute name. In our example, this will be functions "setName(String NAME)" and "getName()". Notice that the "set" function must have their attribute value passed in as an argument. "set" functions as their name suggests, sets the attribute with the passed in value.
"get" functions returns whatever value that is stored in this attribute. After you change the "CarMBean.java" file, don't forget to change the "CarMXBean.java" file so its interface will match the functions contained in "CarMBean.java".

CarMbean.java

Now look at the "attribute" column in the FitNesse wiki. These should match the attributes you declared in "CarMBean.java".
"value" column assigns each of these attributes a value, which is actually passed into the "set" functions in "CarMBean.java".
You can see what this table does by looking at "configureMBeans.java" as the title of the table suggests.