diff --git a/core/pom.xml b/core/pom.xml index 12633c7fa..51d8248ba 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -1,11 +1,9 @@ - + smart-testing-parent org.arquillian.smart.testing - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT 4.0.0 diff --git a/docs/refcard.adoc b/docs/refcard.adoc index 5b7c422c6..1f92575a0 100644 --- a/docs/refcard.adoc +++ b/docs/refcard.adoc @@ -92,3 +92,4 @@ a|`smart.testing.report.name` |the file name of the generated report a|`smart-testing-report.xml` +|=== diff --git a/functional-tests/git-rules/pom.xml b/functional-tests/git-rules/pom.xml index 43b708d7b..e353e6e30 100644 --- a/functional-tests/git-rules/pom.xml +++ b/functional-tests/git-rules/pom.xml @@ -1,11 +1,9 @@ - + smart-testing-parent org.arquillian.smart.testing - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/functional-tests/test-bed/pom.xml b/functional-tests/test-bed/pom.xml index cade29c9b..71138593d 100644 --- a/functional-tests/test-bed/pom.xml +++ b/functional-tests/test-bed/pom.xml @@ -1,11 +1,9 @@ - + smart-testing-parent org.arquillian.smart.testing - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/functional-tests/test-bed/src/test/java/org/arquillian/smart/testing/ftest/configuration/SurefireForksConfigurationTest.java b/functional-tests/test-bed/src/test/java/org/arquillian/smart/testing/ftest/configuration/SurefireForksConfigurationTest.java index 0da3ecc7a..66b7b1150 100644 --- a/functional-tests/test-bed/src/test/java/org/arquillian/smart/testing/ftest/configuration/SurefireForksConfigurationTest.java +++ b/functional-tests/test-bed/src/test/java/org/arquillian/smart/testing/ftest/configuration/SurefireForksConfigurationTest.java @@ -11,6 +11,7 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import static org.arquillian.smart.testing.Configuration.DEFAULT_REPORT_FILE_NAME; import static org.arquillian.smart.testing.Configuration.ENABLE_REPORT_PROPERTY; @@ -31,6 +32,9 @@ public class SurefireForksConfigurationTest { @Rule public final TestBed testBed = new TestBed(GIT_CLONE); + @Rule + public TestName name= new TestName(); + @Test public void test_with_reuse_forks_false() { verifyTestSuiteExecution("reuseForks", "false"); @@ -79,7 +83,9 @@ private void verifyTestSuiteExecution(String... systemPropertiesPairs){ .options() .withSystemProperties(systemPropertiesPairs) .withSystemProperties(ENABLE_REPORT_PROPERTY, "true") - .configure() + .withSystemProperties("graph.name", name.getMethodName()) + .withSystemProperties("smart.testing.debug", "true") // This will only be propagated to surefire for "not_reusing_forks" option + .configure() .run(); // then softly.assertThat(actualTestResults.accumulatedPerTestClass()).containsAll(expectedTestResults).hasSameSizeAs(expectedTestResults); diff --git a/junit-test-result-parser/pom.xml b/junit-test-result-parser/pom.xml index 0bc39285e..d94dc9570 100644 --- a/junit-test-result-parser/pom.xml +++ b/junit-test-result-parser/pom.xml @@ -1,11 +1,9 @@ - + smart-testing-parent org.arquillian.smart.testing - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT 4.0.0 diff --git a/mvn-extension/pom.xml b/mvn-extension/pom.xml index 8914cea96..70091fab8 100644 --- a/mvn-extension/pom.xml +++ b/mvn-extension/pom.xml @@ -1,11 +1,9 @@ - + org.arquillian.smart.testing smart-testing-parent - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index 53bfa769f..9c1eec3b0 100644 --- a/pom.xml +++ b/pom.xml @@ -1,19 +1,17 @@ - + 4.0.0 org.jboss jboss-parent 24 - + org.arquillian.smart.testing smart-testing-parent - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT pom Smart testing diff --git a/strategies/affected/pom.xml b/strategies/affected/pom.xml index 40eec5f8d..8fa3c2109 100644 --- a/strategies/affected/pom.xml +++ b/strategies/affected/pom.xml @@ -1,11 +1,9 @@ - + smart-testing-parent org.arquillian.smart.testing - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT ../../pom.xml 4.0.0 @@ -31,6 +29,11 @@ org.jgrapht jgrapht-core + + org.jgrapht + jgrapht-ext + ${version.jgrapht} + junit junit diff --git a/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/ClassDependenciesGraph.java b/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/ClassDependenciesGraph.java index b4ce21343..f7c3291e3 100644 --- a/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/ClassDependenciesGraph.java +++ b/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/ClassDependenciesGraph.java @@ -32,6 +32,7 @@ import java.util.Collection; import java.util.List; import java.util.Set; +import java.util.UUID; import java.util.stream.Collectors; import org.arquillian.smart.testing.api.TestVerifier; import org.arquillian.smart.testing.strategies.affected.ast.JavaClass; @@ -75,6 +76,10 @@ void buildTestDependencyGraph(Collection testJavaFiles) { addToIndex(new JavaElement(javaClass), javaClass.getImports()); } } + + if (Boolean.valueOf(System.getProperty("smart.testing.debug", "false"))) { + new GraphExporter().dumpGraph(this.graph, System.getProperty("graph.name", UUID.randomUUID().toString())); + } } private void addToIndex(JavaElement javaElement, String[] imports) { diff --git a/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/GraphExporter.java b/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/GraphExporter.java new file mode 100644 index 000000000..0c4a6bd1d --- /dev/null +++ b/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/GraphExporter.java @@ -0,0 +1,21 @@ +package org.arquillian.smart.testing.strategies.affected; + +import org.jgrapht.DirectedGraph; +import org.jgrapht.ext.DOTExporter; +import org.jgrapht.ext.ExportException; +import org.jgrapht.graph.DefaultEdge; + +import java.io.File; + +class GraphExporter +{ + public void dumpGraph(DirectedGraph graph, String graphName) { + try { + new DOTExporter(component -> "\"" + component.getClassName() + "\"", + null, null) + .exportGraph(graph, new File(System.getProperty("java.io.tmpdir") + "/graph-" + graphName + ".dot")); + } catch (ExportException e) { + throw new RuntimeException(e); + } + } +} diff --git a/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/ast/JavaAssistClassParser.java b/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/ast/JavaAssistClassParser.java index 650c5204e..3ec79d499 100644 --- a/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/ast/JavaAssistClassParser.java +++ b/strategies/affected/src/main/java/org/arquillian/smart/testing/strategies/affected/ast/JavaAssistClassParser.java @@ -78,8 +78,7 @@ private ClassPool getClassPool() { return classPool; } - private URL[] getLoadedClasses() - { + private URL[] getLoadedClasses() { return ((URLClassLoader) (Thread.currentThread().getContextClassLoader())).getURLs(); } diff --git a/strategies/changed/pom.xml b/strategies/changed/pom.xml index 6b5c9297a..ee032fc01 100644 --- a/strategies/changed/pom.xml +++ b/strategies/changed/pom.xml @@ -1,11 +1,9 @@ - + smart-testing-parent org.arquillian.smart.testing - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/strategies/failed/pom.xml b/strategies/failed/pom.xml index fad65b00b..b46bd7d58 100644 --- a/strategies/failed/pom.xml +++ b/strategies/failed/pom.xml @@ -1,11 +1,9 @@ - + smart-testing-parent org.arquillian.smart.testing - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/surefire-provider/pom.xml b/surefire-provider/pom.xml index 20376033a..58a4757d6 100644 --- a/surefire-provider/pom.xml +++ b/surefire-provider/pom.xml @@ -1,11 +1,9 @@ - + smart-testing-parent org.arquillian.smart.testing - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT 4.0.0