alexis rivas
alexis rivas

Reputation: 1

How to run junit test using java

Hello I'm launching a Junit test using java using this code:

    JUnitCore junit2 = new JUnitCore();
    Result result2 = junit2.run(thenameoftheclass.class);

but in my junit original test there are some "VM option" (the IDEA window of cofig for junit). this VM options have the configuration to loggin in an app, are like the user and password system params. But I am not able to insert those params when I am trying to run junit using just a java program

Upvotes: 0

Views: 87

Answers (1)

alexis rivas
alexis rivas

Reputation: 1

Well guys I was able to find the answer.

First of all you need to know that my project is not maven based.

This methods are cool --->

JUnitCore junit2 = new JUnitCore(); Result result2 = junit2.run(thenameoftheclass.class);

The problem was that when I was building the Application arguments in Intellij IDE I was filling the app password and user in the field "program arguments" but actually it was meant to be field in "VM Options" becase the java machine uses them in execution time

Upvotes: 0

Related Questions