content.txt 1.39 KB
A Library Table is a table that can be used to install support fixtures so they are available for all pages underneath.

The format of the Library table is similar to the ImportTable.

|Library|
|echo support|
|file support|

The first row contains the word '''Library'''. This is a reserved word so slim knows which table is executed. All subsequent rows are fixtures. In this case !-SliM-! will expect two fixtures: !-EchoSupport-! and !-FileSupport-!. These fixtures will be located the same as "normal" fixtures, meaning it will use the ImportTable's paths to scan.

Whenever a method is called that is '''not''' available on the fixture, then all installed libraries are scanned if that method is available and if so that one will be invoked.

Usage example:

'''File cleanup'''.
{{{
public class FileSupport {
  public void delete(String folder) {
    // do stuff here
  }
}

public class MyFixture {
  public void doBusinessLogic(String folder) {
    myFileCreatingService.createFileInFolder(..);
  }
}
}}}

|Library|
|file support|

|script|my fixture|
|do business logic|/tmp|
|delete|/tmp|


'''Order of method execution'''

The order of method execution is as follows:

1. Find method on fixture, if present execute
2. Find method on SystemUnderTest, if present execute
3. Find method on installed Library in '''reversed''' order of creation. So last one created takes precedence over the ones created earlier.