Run Virtual Lab from Test (JSON, Maven)

This section describes how to initialize the lab, control scenarios, and release the lab resources.

Initialize lab

After you configure the virtual lab, you start the lab in the same annotated @BeforeClass method as the lab configuration:

sv.startActiveVirtualLab();
   

Back to top

Control scenarios

Once the lab is started, each test starts a corresponding application scenario:

@Test
public void testHeating() throws Exception {
    sv.runSimulation("winterDay");
    ...    
}
@Test
public void testAirConditioning() throws Exception {
    sv.runSimulation("summerDay");
    ...    
}

Back to top

Release lab resources

When you are done, you need to stop the lab to release the resources. You do this using the following call in an @AfterClass annotated method:

sv.close();

Back to top

See also: