Run JUnit test with IntelliJ

2019-08-20 06:53发布

I'm using IntelliJ 2018.1 and I am trying to run a TeaVM JUnit test but when running the test from CTRL + SHIFT + F10 tests are getting skipped:

@RunWith(TeaVMTestRunner.class)
@SkipJVM
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ShapeTest {

    static final Logger logger = Logger.getLogger(ShapeTest.class.getName());
    @Rule
    public final ExpectedException exception = ExpectedException.none();

    @Test
    public void testGet() {
        System.out.println("ShapeTest - testGet");
        String response = Shape.get("https://httpbin.org/get")
                .header("accept", "application/json")
                .header("Content-Type", "application/json")
                .asJson();

        JSONObject json = new JSONObject(response);
        String url = json.getString("url");
        JSONObject headers = json.getJSONObject("headers");
        assertNotNull(json);
        assertNotNull(url);
        assertNotNull(headers);

        System.out.println(json.toString());
    }

}

But when running from terminal using this command below, it works:

mvn test -Dteavm.junit.target=target/js-tests -Dteavm.junit.js.runner=h
tmlunit -Dteavm.junit.js.threads=2

Any IntelliJ/JUnit expert here that may have some idea why is this happening?

0条回答
登录 后发表回答