jhonycodeia / JunitTest

Documentación de framework con de pruebas de unidad: JUnit 4, Junit 5, Mockito, RabbitMQ , GraphQL,Selenium, Cucumber y Spring Cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JunitTest

Running mvn -U clean verify install -Djava.awt.headless=true -Dtest=MainTestSuite -DfailIfNoTests=false -Dmaven.test.failure.ignore=true mvn test -Dcucumber.options=”src/test/java/Features/smoketest.feature.

Gherkin lenguaje

Spring Boot projects with versions >= 2.2.0 use JUnit 5 by default.

Description JUnit 4 JUnit 5
Test Annotation Changes @Before
@After
@BeforeClass
@AfterClass
@Ignore
@BeforeEach
@AfterEach
@BeforeAll
@AfterAll
@Disabled
Use @ExtendWith instead of @RunWith @RunWith(SpringJUnit4ClassRunner.class)
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(SpringExtension.class)
@ExtendWith(MockitoExtension.class)
Package changes to org.junit.jupiter org.junit.Test;
org.junit.Assert.*;
org.junit.jupiter.api.Test;
org.junit.jupiter.api.Assertions.*;
@RunWith is NOT needed with @SpringBootTest, @WebMvcTest, @DataJpaTest @RunWith(SpringRunner.class)
@SpringBootTest(classes = DemoApplication.class)
@SpringBootTest(classes = DemoApplication.class)

JUnit 5 Upgrades For Different Projects

pom.xml changes

Spring Boot projects with versions >= 2.2.0 use JUnit 5 by default. You should see something like this in your pom.xml

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-test</artifactId>
	<scope>test</scope>
	<exclusions>
		<exclusion>
			<groupId>org.junit.vintage</groupId>
			<artifactId>junit-vintage-engine</artifactId>
		</exclusion>
	</exclusions>
<dependency>

References

About

Documentación de framework con de pruebas de unidad: JUnit 4, Junit 5, Mockito, RabbitMQ , GraphQL,Selenium, Cucumber y Spring Cloud


Languages

Language:Java 95.7%Language:HTML 4.0%Language:Gherkin 0.3%Language:CSS 0.0%