I'm building my package with maven (runs without problems) and then I try to make a Mockito test for a class.
Dependencies in the pom.xml are as follows:
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
The mockito-test looks like this:
package Person;
import static org.mockito.Mockito.*;
import java.io.IOException;
public class AppTest {
public void test() throws IOException{
PersonManagement mockedPM = mock(PersonManagement.class);
//automatically creates an instance variable of type person
mockedPM.updatePerson("test","test");
//updates this.person
verify(mockedPM).updatePerson("test","test");
}
}
After launching mvn package the test results show, that no test were run (the file including the test is found and recognized, because when I put syntax mistakes there, compiler recognizes these)
I would appreciate any help, thanks
Mockito is not a testing framework. It's a mocking API. Use JUnit or TestNG. These are testing frameworks. Both simply require some annotations to be placed on test methods.
And of course, your JUnit or TestNG tests will use the Mockito API internally, to mock dependencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With