Skip to content

Commit

Permalink
Deploying to gh-pages from @ 4079a16 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
krmahadevan committed Jan 23, 2024
1 parent 1a6472e commit 1ddbe61
Show file tree
Hide file tree
Showing 47 changed files with 253 additions and 49 deletions.
2 changes: 1 addition & 1 deletion altering_suites.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h3 id="_altering_suites_or_tests">Altering suites (or) tests</h3>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion annotation_transformers.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ <h4 id="_via_your_code">Via your code</h4>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion annotations.html
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ <h3 id="_annotations">Annotations</h3>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion ant.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ <h4 id="_examples">Examples</h4>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion beanshell.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h3 id="_beanshell_and_advanced_group_selection">BeanShell and advanced group se
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion book-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ <h3 id="_appendix_d_migrating_from_junit">Appendix D Migrating from JUnit</h3>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion book.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h3 id="_about_the_author">About the Author</h3>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion class_level_annotations.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h3 id="_class_level_annotations">Class level annotations</h3>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion dependencies.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ <h4 id="_dependencies_in_xml">Dependencies in XML</h4>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion dependency_injection.html
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ <h4 id="_guice_dependency_injection">Guice dependency injection</h4>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -2638,7 +2638,7 @@ <h4 id="_iexecutionlistener">IExecutionListener</h4>
<div class="sect3">
<h4 id="_iexecutionvisualiser">IExecutionVisualiser</h4>
<div class="paragraph">
<p>Documentation To be included.
<p>Refer <a href="execution_visualiser.html">here</a> to learn more.
Javadocs are available {javadocs-base-url}/org/testng/IExecutionVisualiser.html[here]</p>
</div>
</div>
Expand Down Expand Up @@ -4614,7 +4614,7 @@ <h2 id="_logging_framework_integration_in_testng">Logging framework integration
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion download.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ <h4 id="_build_the_testng_eclipse_plugin_from_source_code">Build the TestNG Ecli
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion eclipse.html
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ <h4 id="_m2e_integration">M2E Integration</h4>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
204 changes: 204 additions & 0 deletions execution_visualiser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 2.0.18">
<title>Visualising Executions</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
<link rel="stylesheet" href="./asciidoctor.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css">
</head>
<body class="article toc2 toc-left">
<div id="header">
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel2">
<li><a href="#_visualising_executions">Visualising Executions</a></li>
</ul>
</div>
</div>
<div id="content">
<div class="sect2">
<h3 id="_visualising_executions">Visualising Executions</h3>
<div class="paragraph">
<p>TestNG allows you to visualise the test method executions via the interface <a href="https://javadoc.io/static/org.testng/testng/7.9.0/org/testng/IExecutionVisualiser.html">IExecutionVisualiser</a>.</p>
</div>
<div class="paragraph">
<p>TestNG passes metadata about the current execution state in <a href="https://graphviz.org/doc/info/lang.html">dot</a> representation.</p>
</div>
<div class="paragraph">
<p>Color coding is done as below:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>tests that are yet to run are colored in <strong>yellow</strong>.</p>
</li>
<li>
<p>tests that are currently running are colored in <strong>green</strong>.</p>
</li>
<li>
<p>tests that have completed execution are colored in <strong>grey</strong>.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>This listener should be declared, as explained in the section about <a href="testng_listeners.html">TestNG listeners</a>.</p>
</div>
<div class="paragraph">
<p>Let&#8217;s a sample.</p>
</div>
<div class="sect3">
<h4 id="_setup">Setup</h4>
<div class="ulist">
<ul>
<li>
<p>Follow the instructions detailed in <a href="https://graphviz.org/download/">graphviz</a> website to install <code>graphviz</code>. This binary will help us convert the <code>dot</code> format into <code>png</code> files.</p>
</li>
<li>
<p>Add a dependency to a library such as <a href="https://github.com/square/gifencoder/">gifencoder</a> so that we can convert a bunch of <code>png</code> files into a <code>gif</code> file.</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code data-lang="xml">&lt;dependency&gt;
&lt;groupId&gt;com.squareup&lt;/groupId&gt;
&lt;artifactId&gt;gifencoder&lt;/artifactId&gt;
&lt;version&gt;0.10.1&lt;/version&gt;
&lt;/dependency&gt;</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_code_sample">Code sample</h4>
<div class="paragraph">
<p>Here&#8217;s how a sample implementation could look like:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code data-lang="java">import com.squareup.gifencoder.FloydSteinbergDitherer;
import com.squareup.gifencoder.GifEncoder;
import com.squareup.gifencoder.ImageOptions;
import org.testng.IExecutionVisualiser;
import org.testng.IReporter;
import org.testng.ISuite;
import org.testng.xml.XmlSuite;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.nio.file.*;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

public class SampleVisualiser implements IExecutionVisualiser, IReporter {

private final AtomicInteger counter = new AtomicInteger(1);
private final Path tmpdir;

private final List&lt;String&gt; pngFiles = new ArrayList&lt;&gt;();

public SampleVisualiser() throws IOException {
tmpdir = Files.createTempDirectory(Paths.get("target"), "dot-");
}

@Override
public void consumeDotDefinition(String dotDefinition) {
String filePrefix = counter.getAndIncrement() + "-" + UUID.randomUUID();
Path input = Path.of(tmpdir.toFile().getAbsolutePath(), filePrefix + "-input.dot");
try {
Files.writeString(input, dotDefinition);
Path output = Path.of(tmpdir.toFile().getAbsolutePath(), filePrefix + "-output.png");
if (generatePngFileFromDotContent(input, output)) {
pngFiles.add(output.toFile().getAbsolutePath());
}
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
}

@Override
public void generateReport(List&lt;XmlSuite&gt; xmlSuites, List&lt;ISuite&gt; suites, String outputDirectory) {
//The GIF image will be created with file name "animation.gif"
File writeTo = new File(tmpdir.toFile().getAbsolutePath(), "animation.gif");
try (FileOutputStream outputStream = new FileOutputStream(writeTo)) {
ImageOptions options = new ImageOptions();

//Set 500ms between each frame
options.setDelay(500, TimeUnit.MILLISECONDS);
//Use Floyd Steinberg dithering as it yields the best quality
options.setDitherer(FloydSteinbergDitherer.INSTANCE);
GifEncoder encoder = new GifEncoder(outputStream, 1600, 1200, 0);
for (String pngFile : pngFiles) {
encoder.addImage(convertImageToArray(new File(pngFile)), options);
}
encoder.finishEncoding();
} catch (IOException e) {
throw new RuntimeException(e);
}
System.err.println("The gif has been generated in :" + writeTo.getAbsolutePath());
}

private int[][] convertImageToArray(File file) throws IOException {
BufferedImage bufferedImage = ImageIO.read(file);
int[][] rgbArray = new int[bufferedImage.getHeight()][bufferedImage.getWidth()];
for (int i = 0; i &lt; bufferedImage.getHeight(); i++) {
for (int j = 0; j &lt; bufferedImage.getWidth(); j++) {
rgbArray[i][j] = bufferedImage.getRGB(j, i);
}
}
return rgbArray;
}

private static boolean generatePngFileFromDotContent(Path input, Path output) throws IOException, InterruptedException {
String[] cmds = {
"dot",
"-Tpng",
input.toFile().getAbsolutePath(),
"-o",
output.toFile().getAbsolutePath()
};
Process process = new ProcessBuilder().command(cmds).start();
handleInputErrorFrom(process);
int exitCode = process.waitFor();
System.err.println("PNG file written to " + output.toFile().getAbsolutePath());
return exitCode == 0;
}

private static void handleInputErrorFrom(Process process) throws IOException {
processStream(process.getInputStream());
processStream(process.getErrorStream());
}

private static void processStream(InputStream stream) throws IOException {
if (stream == null) {
return;
}
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
}
}</code></pre>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion factories.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ <h3 id="_factories">Factories</h3>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion first_section.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h2 id="first-section">First section</h2>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion github.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h3 id="_reportng_a_reporting_tool">ReportNG - A reporting tool</h3>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion gradle.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h4 id="_specifying_your_gradle_build_file">Specifying your Gradle build file</h
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion iconfigurable.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h3 id="_overriding_configuration_methods">Overriding configuration methods</h3>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion idea.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h4 id="_creating_a_testng_rundebug_configuration">Creating a TestNG Run/Debug c
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion ignoring_tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ <h3 id="_ignoring_tests">Ignoring tests</h3>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2024-01-22 08:39:25 UTC
Last updated 2024-01-23 05:18:21 UTC
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
Expand Down
Loading

0 comments on commit 1ddbe61

Please sign in to comment.