Write a test

The following example tests updating of user's profile on an example application:

package it.user;

import net.sf.lightair.LightAir;
import net.sf.lightair.annotation.Setup;
import net.sf.lightair.annotation.Verify;

import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(LightAir.class)
@Setup
@Verify
public class ProfileUpdateIT {

  @Test
  public void test() {
    // invoke the actual update of the user's profile
    // (call a REST API, call a SOAP web service, or trigger the UI).
  }

}

With TestNG, use the Listeners annotation instead of the RunWith annotation:

@Listeners(LightAirNGListener.class)
@Setup
@Verify
public class ProfileUpdateIT {
  ...

Next to the class (in the same package), create ProfileUpdateIT.xml file to setup the database before the test:

<?xml version='1.0' encoding='UTF-8'?>
<dataset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../dataset.xsd">
  <user id="1" version="1" email="email1" name="Name 1" password="pwd1"/>
</dataset>

Finally, create ProfileUpdateIT-verify.xml file to verify database was properly updated:

<?xml version='1.0' encoding='UTF-8'?>
<dataset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../dataset.xsd">
  <user id="1" version="2" email="email1" name="Name 1 updated" password="pwd1" />
</dataset>
Next: Features >>