Below you find some examples of how to create and use Loadcoder tests.
The examples are written as unit tests using the @Test (JUnit or TestNG) annotation with only the essential parts included, i e the imports are left out.
The package com.loadcoder.statics contains all the static imports that the Loadcoder test will need in various situations. Add them to your test class import list:
import static com.loadcoder.statics.Time.*;
import static com.loadcoder.statics.ThrottleMode.*;
import static com.loadcoder.statics.StopDesisions.*;
import static com.loadcoder.statics.LogbackLogging.*;
import static com.loadcoder.statics.SummaryUtils.*;
Hello World
This is a Loadcoder test in it's simplest form. One thread will run the defined Loadscenario 10 times
public void helloWorldLoadTest() {

  // Implement the LoadScenario to define what the load should consist of
  LoadScenario loadScenario = new LoadScenario() {
	public void loadScenario() {
	  // Use load method to define a transaction
	  load("helloWorld", ()->{System.out.println("hello World");}).perform();

  Load load = new LoadBuilder(loadScenario)

    //run 10 iterations of the LoadScenario
  // Start the test and wait until it finishes
  new ExecutionBuilder(load).build().execute().andWait();
Extended test
This Loadcoder test shows how the transaction can be be handled after it's done, using the handleResult method, as well as showing all the methods in the LoadBuilder. Additionally, a RuntimeChart is created and set in the execution as the runtimeResultUser
public void extendedTest() {
  ThreadLocal threadLocal = new ThreadLocal<>();
  LoadScenario ls = new LoadScenario() {

    public void loadScenario() {
      byte[] response = load("getBytes", () -> "aString".getBytes())
        //the return type for getResponse will be the same as for the transaction
        byte[] transactionRespone = resultmodel.getResponse();
        //use it to take decision about status
        if(transactionRespone.length == 0) {
          resultmodel.setMessage("Response was empty");

        if(resultmodel.getResponseTime() > 100) {
	          resultmodel.setMessage("This transaction took way too long");
      // Use the respone from the first transaction in the second
      load("newString", () -> new String(response)).perform();
  Load load = new LoadBuilder(ls)
      // 10 threads
      //each thread will be throttled at a limit of 20 transactions/second
      .throttle(20, PER_SECOND, PER_THREAD) 
      //start the 10 threads under 30 seconds
      .rampup(30 * SECOND)
      //execute the test under 60 seconds
      .stopDecision(duration(60 * SECOND))
      //perform pre and post actions for each of the threads
      .preExecution(()->{threadLocal.set("Pre execution variable");})

  RuntimeChart chart = new RuntimeChart();	  
  new ExecutionBuilder(load).runtimeResultUser(chart).build().execute().andWait();

  //wait here until the chart is closed