Skip to content

Commit

Permalink
improvement in test control
Browse files Browse the repository at this point in the history
  • Loading branch information
tassiovirginio committed Oct 16, 2023
1 parent 54dae99 commit 793ad5c
Show file tree
Hide file tree
Showing 20 changed files with 130 additions and 82 deletions.
35 changes: 32 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,30 @@
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit</artifactId>-->
<!-- <version>${junit.version}</version>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->

<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-migrationsupport -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-migrationsupport</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>com.github.javaparser</groupId>
<artifactId>javaparser-core</artifactId>
Expand Down Expand Up @@ -139,6 +156,18 @@
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

Expand Down
14 changes: 8 additions & 6 deletions src/test/java/br/ufba/jnose/test/AssertionRouletteTest.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package br.ufba.jnose.test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;


import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.*;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;

import br.ufba.jnose.core.testsmelldetector.testsmell.SmellyElement;
import br.ufba.jnose.core.testsmelldetector.testsmell.smell.AssertionRoulette;


@DisplayName("Assertion Roulette Test")
public class AssertionRouletteTest {

public AssertionRoulette assertionTest;
Expand All @@ -25,13 +25,14 @@ public class AssertionRouletteTest {
SmellyElement smellyElementList;


@Before
@BeforeEach
public void setUp() throws Exception {
assertionTest = new AssertionRoulette();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/AssertionRouletteFixture.java"));
}

@Test
@DisplayName("should get number of tests")
public void should_get_number_of_tests() {
try{
CompilationUnit compilationUnit = JavaParser.parse(fileInputStream);
Expand All @@ -46,6 +47,7 @@ public void should_get_number_of_tests() {
}

@Test
@DisplayName("should get test smells informations")
public void should_get_test_smells_informations() {
try{
CompilationUnit compilationUnit = JavaParser.parse(fileInputStream);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package br.ufba.jnose.test;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
Expand All @@ -22,7 +24,7 @@ public class ConditionalTestLogicTest {
CompilationUnit compilationUnit;
SmellyElement smellyElementList;

@Before
@BeforeEach
public void setUp() throws Exception {
conditionalTest = new ConditionalTestLogic();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/ConditionalFixture.java"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package br.ufba.jnose.test;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
Expand All @@ -22,7 +23,7 @@ public class ConstructorInitializationTest {
CompilationUnit compilationUnit;
SmellyElement smellyElementList;

@Before
@BeforeEach
public void setUp() throws Exception {
constructorTest = new ConstructorInitialization();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/ConstructorFixture.java"));
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/br/ufba/jnose/test/DuplicateAssertTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package br.ufba.jnose.test;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
Expand All @@ -22,7 +23,7 @@ public class DuplicateAssertTest {
CompilationUnit compilationUnit;
SmellyElement smellyElementList;

@Before
@BeforeEach
public void setUp() throws Exception {
duplicateTest = new DuplicateAssert();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/DuplicateAssertFixture.java"));
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/br/ufba/jnose/test/EagerTestTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package br.ufba.jnose.test;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
Expand All @@ -23,7 +24,7 @@ public class EagerTestTest {
CompilationUnit compilationUnit;
SmellyElement smellyElementList;

@Before
@BeforeEach
public void setUp() throws Exception {
eagerTest = new EagerTest();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/EagerFixture.java"));
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/br/ufba/jnose/test/EmptyTestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import br.ufba.jnose.core.testsmelldetector.testsmell.SmellyElement;
import br.ufba.jnose.core.testsmelldetector.testsmell.smell.EmptyTest;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class EmptyTestTest {

Expand All @@ -23,7 +23,7 @@ public class EmptyTestTest {
CompilationUnit compilationUnit;
SmellyElement smellyElementList;

@Before
@BeforeEach
public void setUp() throws Exception {
emptytest = new EmptyTest();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/EmptyFixture.java"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package br.ufba.jnose.test;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
Expand All @@ -22,7 +23,7 @@ public class ExceptionCatchingThrowingTest {
CompilationUnit compilationUnit;
SmellyElement smellyElementList;

@Before
@BeforeEach
public void setUp() throws Exception {
exceptionTest = new ExceptionCatchingThrowing();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/ExceptionFixture.java"));
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/br/ufba/jnose/test/GeneralFixtureTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package br.ufba.jnose.test;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
Expand All @@ -22,7 +23,7 @@ public class GeneralFixtureTest {
CompilationUnit compilationUnit;
SmellyElement smellyElementList;

@Before
@BeforeEach
public void setUp() throws Exception {
generalTest = new GeneralFixture();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/GeneralFixtureFixture.java"));
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/br/ufba/jnose/test/IgnoredTestTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package br.ufba.jnose.test;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
Expand All @@ -22,7 +23,7 @@ public class IgnoredTestTest {
CompilationUnit compilationUnit;
SmellyElement smellyElementList;

@Before
@BeforeEach
public void setUp() throws Exception {
ignoredTest = new IgnoredTest();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/IgnoredFixture.java"));
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/br/ufba/jnose/test/LazyTestTest.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package br.ufba.jnose.test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
Expand All @@ -24,7 +24,7 @@ public class LazyTestTest {
CompilationUnit compilationUnit;
SmellyElement smellyElementList;

@Before
@BeforeEach
public void setUp() throws Exception {
lazyTest = new LazyTest();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/LazyFixture.java"));
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/br/ufba/jnose/test/MagicNumberTestTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package br.ufba.jnose.test;

import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ast.CompilationUnit;
Expand All @@ -22,7 +23,7 @@ public class MagicNumberTestTest {
CompilationUnit compilationUnit;
SmellyElement smellyElementList;

@Before
@BeforeEach
public void setUp() throws Exception {
magicTest = new MagicNumberTest();
fileInputStream = new FileInputStream(new File("src/test/java/br/ufba/jnose/test/fixtures/MagicNumberFixture.java"));
Expand Down
Loading

0 comments on commit 793ad5c

Please sign in to comment.