text: == Getting Started
  :sourcedir: ../jgiven-examples/src/test/java/com/tngtech/jgiven/examples/userguide
  :source-language: java
  
  JGiven can be used together with JUnit or TestNG, here we assume you are using JUnit.
  
  === Create a JUnit test class
  
  First of all you create a JUnit test class that inherits from `com.tngtech.jgiven.junit.ScenarioTest`:
  
  [source]
  ----
  include::{sourcedir}/MyShinyJGivenTest.java[tags=header]
  }
  ----
  
  The `ScenarioTest` requires 3 type parameters. Each of these type parameters represents a stage of the Given-When-Then notation. Note that there is also the `SimpleScenarioTest` class that only requires a single type parameter. In that case, all your scenario steps are defined in a single class.
  For scenarios where you only want to differentiate between steps that modify state (setup in `given()`, changes in `when()`) and steps that assert state (`then()`) you can use the `DualScenarioTest` which takes two parameters: a combined `GivenWhen` stage and a single `Then` stage.
  
  
  
  === Create Given, When, and Then classes
  
  To make your class compile, create the following three classes:
  
  [source]
  ----
  include::{sourcedir}/GivenSomeState.java[tags=noPackage]
  ----
  
  [source]
  ----
  include::{sourcedir}/WhenSomeAction.java[tags=noPackage]
  ----
  
  [source]
  ----
  include::{sourcedir}/ThenSomeOutcome.java[tags=noPackage]
  ----
  
  JGiven does not require you to inherit from the Stage class, however, the Stage class already provides some useful methods like and() and self().
  
  === Write your first scenario
  
  Now you can write your first scenario
  
  [source]
  ----
  include::{sourcedir}/MyShinyJGivenTest.java[tags=noPackage]
  ----
  
  === Execute your scenario
  The scenario is then executed like any other JUnit test, for example, by using your IDE or Maven:
  [source,bash]
  ----
  $ mvn test
  ----
  
  === Using JUnit Rules directly instead of deriving from ScenarioTest
  Sometimes it is not possible to derive your test class from the `ScenarioTest` class, because you might already have a common base class that you cannot easily modify.
  In that case you can directly use the JUnit Rules of JGiven. Instead of providing your stage classes as type parameters, you inject the stages into the test class with the `@ScenarioStage` annotation.
  
  [source,java]
  ----
  include::{sourcedir}/UsingRulesTest.java[tags=noPackage]
  ----
  
  Note that your stage classes have to inherit from the `Stage` class in order to have the `given(), when()`, and `then()` methods. 
  You can now also define convenient methods in your test class to get cleaner scenarios if you like:
  
  [source,java]
  ----
  public GivenSomeState given() {
      return someStage.given();
  }
  ----
  
  