IGL Course

Running your tests

Go back

This section is supposed to help your getting started and running your tests.

Starting from the teacher generated sources

  • Open a Papyrus (I'm using 4.8.0 without any plugins/... for reference)
  • Create a new Java project
  • You may switch to Java Perspective
  • Click on src > show in > system explorer
  • Copy the second of the src folder in xtend generated sources, inside our src folder
  • Right-click on our src > refresh
  • Follow the steps in the next section

Starting from your sources

If you are starting with your generated sources, then you are almost good.

  • Right-click on your root folder > new > Source folder > "tests"
  • Create packages testvalidation/testunitaire inside
  • Create a class: testvalidation > TestStartTemperatureManager
public class TestStartTemperatureManager {
	public void SampleTest() {
  • Then, hover "Test", and either fix it by adding JUnit4 or Junit5 in the class path
  • Complete the method (use CTRL+space for autocompletion)
// import org.junit.jupiter.api.Assertions;
public void SampleTest() {
  • Right-Click on the file in the explorer > Run as > JUnit Test
  • Done

Starting in your IDE

In my case, I opened the sources in IntelliJ, but you may use VSCode. Anyway, I won't make a tutorial for this, but once you did your tests and are planning to check if this is working in Papyrus. We are expecting that you got something like this in Papyrus.

Starting in your IDE - Papyrus - tests

  • Right-click on tests > Build path > use a source folder
  • Now JUnit is missing
    • Simply hover Test > Add Junit4 or Junit5 in the classPath
    • Or you can hover the import > Fix project setup > Add Junit5 in the classPath
  • Right-Click on the file in the explorer > Run as > JUnit Test
  • Done