Reputation: 35276
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?
Upvotes: 2
Views: 19123
Reputation: 100139
You can specify the same -D
parameters in Run configuration settings. Press "Run" (Alt+Shift+F10 on Windows, Ctrl+Alt+R on Mac), select your run configuration, Right arrow, Edit:
Then specify all -D
parameters under VM options:
After that, the options will be passed to TeaVM Runner just like it works with mvn test
command.
Upvotes: 4
Reputation: 608
If you are new to intellij as I m. I had junits written, only wanted to run them. In eclipse, you go to test class-> right click -> run-> as junit. Somewhat like this we do. Its similar in intellij too. Go to test class right click and run as junits. If such option is not available, then the problem might lie at file->project structure-> module-> source here your tests must not been configured to the test folder of your repo. So, in project structure-> module->sources click on test in module and then select the path to test folder . Then apply-> ok. Now Run as test option will be available on right click on test class.
Upvotes: 0