0

I found in Scala there is "sequential" to run test in order. How do we do with Java ?

I use the default testing framework with real http server as in the doc https://www.playframework.com/documentation/2.1.0/JavaFunctionalTest

And by the way, how can I make a test wait for Akka schedulers to finish ?

@Test
public void testFlashNeedPictureLog() {
    running(testServer(3333), new Runnable() {
        public void run() {

            //Run in test

            Akka.system().scheduler().schedule(
                    Duration.create(10, TimeUnit.SECONDS),
                    Duration.create(0, TimeUnit.SECONDS),
                    new Runnable() {
                        @Override
                        public void run() {
                            //Dont run
                        }
                    },
                    Akka.system().dispatcher()
            );

        }
    });
}
Julien D
  • 1,259
  • 9
  • 22

1 Answers1

0

As Play! Framework standart framework for testing is jUnit, we can use a fix of jUnit which enables you to set tests order alphabetical only

import org.junit.runners.MethodSorters;

import org.junit.FixMethodOrder;
import org.junit.Test;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class SampleTest {


   @Test
    public void firstTest() {
        System.out.println("first");
    }

    @Test
    public void secondTest() {
        System.out.println("second");
    }
}

(from https://stackoverflow.com/a/13540131/2342528)

Community
  • 1
  • 1
Julien D
  • 1,259
  • 9
  • 22