first commit
This commit is contained in:
commit
b3bdeda722
121 changed files with 2290 additions and 0 deletions
22
.classpath
Normal file
22
.classpath
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="tst"/>
|
||||
<classpathentry kind="src" path="testclasses"/>
|
||||
<classpathentry kind="src" path="jacoco"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<accessrules>
|
||||
<accessrule kind="accessible" pattern="sun/reflect/**"/>
|
||||
</accessrules>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="lib" path="lib/org.jacoco.ant-0.7.1.20140427-1606.jar"/>
|
||||
<classpathentry kind="lib" path="lib/org.jacoco.core-0.7.1.20140427-1606.jar"/>
|
||||
<classpathentry kind="lib" path="lib/org.jacoco.report-0.7.1.20140427-1606.jar"/>
|
||||
<classpathentry kind="lib" path="lib/asm-all-5.0.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/mockito-all-1.9.5.jar"/>
|
||||
<classpathentry kind="lib" path="lib/javassist.jar" sourcepath="C:/dev/javassist-3.18.0-GA/src/main"/>
|
||||
<classpathentry kind="lib" path="lib/xstream-1.4.7.jar"/>
|
||||
<classpathentry kind="lib" path="lib/xpp3_min-1.1.4c.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
.project
Normal file
17
.project
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>autounit</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
95
.settings/org.eclipse.jdt.core.prefs
Normal file
95
.settings/org.eclipse.jdt.core.prefs
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
BIN
bin/nl/jssl/autounit/AutoTester.class
Normal file
BIN
bin/nl/jssl/autounit/AutoTester.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/Configuration.class
Normal file
BIN
bin/nl/jssl/autounit/Configuration.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/CoverageAnalyser.class
Normal file
BIN
bin/nl/jssl/autounit/CoverageAnalyser.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/ExecutionException.class
Normal file
BIN
bin/nl/jssl/autounit/ExecutionException.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/InAndOutput.class
Normal file
BIN
bin/nl/jssl/autounit/InAndOutput.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/InvocationResult.class
Normal file
BIN
bin/nl/jssl/autounit/InvocationResult.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/ManualTest.class
Normal file
BIN
bin/nl/jssl/autounit/ManualTest.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/MethodCallResults.class
Normal file
BIN
bin/nl/jssl/autounit/MethodCallResults.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/MethodcallExecutor.class
Normal file
BIN
bin/nl/jssl/autounit/MethodcallExecutor.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/Player.class
Normal file
BIN
bin/nl/jssl/autounit/Player.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/PrimtiveTypeTests.class
Normal file
BIN
bin/nl/jssl/autounit/PrimtiveTypeTests.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/Recorder.class
Normal file
BIN
bin/nl/jssl/autounit/Recorder.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/ResultsWriter.class
Normal file
BIN
bin/nl/jssl/autounit/ResultsWriter.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/StringTypeTests.class
Normal file
BIN
bin/nl/jssl/autounit/StringTypeTests.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/ArgumentsForSingleCall.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/ArgumentsForSingleCall.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/BooleanInputsFactory.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/BooleanInputsFactory.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/ByteInputsFactory.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/ByteInputsFactory.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/CombinedInputSetFactory.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/CombinedInputSetFactory.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/DoubleInputsFactory.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/DoubleInputsFactory.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/FloatInputsFactory.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/FloatInputsFactory.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/InputsFactory.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/InputsFactory.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/IntegerInputsFactory.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/IntegerInputsFactory.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/LongInputsFactory.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/LongInputsFactory.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/MocksFactory.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/MocksFactory.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/SingleTypeInputs.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/SingleTypeInputs.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inputs/StringInputsFactory.class
Normal file
BIN
bin/nl/jssl/autounit/inputs/StringInputsFactory.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/inspect/ConstantpoolReaderTest.class
Normal file
BIN
bin/nl/jssl/autounit/inspect/ConstantpoolReaderTest.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/testclasses/BooleanArguments.class
Normal file
BIN
bin/nl/jssl/autounit/testclasses/BooleanArguments.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/testclasses/ByteArguments.class
Normal file
BIN
bin/nl/jssl/autounit/testclasses/ByteArguments.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/testclasses/FloatArguments.class
Normal file
BIN
bin/nl/jssl/autounit/testclasses/FloatArguments.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/testclasses/IntArguments.class
Normal file
BIN
bin/nl/jssl/autounit/testclasses/IntArguments.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/testclasses/MethodSignatureMaker.class
Normal file
BIN
bin/nl/jssl/autounit/testclasses/MethodSignatureMaker.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/testclasses/MyMethod.class
Normal file
BIN
bin/nl/jssl/autounit/testclasses/MyMethod.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/testclasses/StringArguments.class
Normal file
BIN
bin/nl/jssl/autounit/testclasses/StringArguments.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/utils/ArgumentsConverter.class
Normal file
BIN
bin/nl/jssl/autounit/utils/ArgumentsConverter.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/utils/ConstantpoolReader.class
Normal file
BIN
bin/nl/jssl/autounit/utils/ConstantpoolReader.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/utils/Permutator.class
Normal file
BIN
bin/nl/jssl/autounit/utils/Permutator.class
Normal file
Binary file not shown.
BIN
bin/nl/jssl/autounit/utils/SilentObjectCreator.class
Normal file
BIN
bin/nl/jssl/autounit/utils/SilentObjectCreator.class
Normal file
Binary file not shown.
BIN
bin/org/jacoco/examples/CoreTutorial$MemoryClassLoader.class
Normal file
BIN
bin/org/jacoco/examples/CoreTutorial$MemoryClassLoader.class
Normal file
Binary file not shown.
BIN
bin/org/jacoco/examples/CoreTutorial$TestTarget.class
Normal file
BIN
bin/org/jacoco/examples/CoreTutorial$TestTarget.class
Normal file
Binary file not shown.
BIN
bin/org/jacoco/examples/CoreTutorial.class
Normal file
BIN
bin/org/jacoco/examples/CoreTutorial.class
Normal file
Binary file not shown.
191
jacoco/org/jacoco/examples/CoreTutorial.java
Normal file
191
jacoco/org/jacoco/examples/CoreTutorial.java
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009, 2014 Mountainminds GmbH & Co. KG and Contributors
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Marc R. Hoffmann - initial API and implementation
|
||||
*
|
||||
*******************************************************************************/
|
||||
package org.jacoco.examples;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jacoco.core.analysis.Analyzer;
|
||||
import org.jacoco.core.analysis.CoverageBuilder;
|
||||
import org.jacoco.core.analysis.IClassCoverage;
|
||||
import org.jacoco.core.analysis.ICounter;
|
||||
import org.jacoco.core.data.ExecutionDataStore;
|
||||
import org.jacoco.core.data.SessionInfoStore;
|
||||
import org.jacoco.core.instr.Instrumenter;
|
||||
import org.jacoco.core.runtime.IRuntime;
|
||||
import org.jacoco.core.runtime.LoggerRuntime;
|
||||
import org.jacoco.core.runtime.RuntimeData;
|
||||
|
||||
/**
|
||||
* Example usage of the JaCoCo core API. In this tutorial a single target class will be instrumented and executed.
|
||||
* Finally the coverage information will be dumped.
|
||||
*/
|
||||
public final class CoreTutorial {
|
||||
|
||||
/**
|
||||
* The test target we want to see code coverage for.
|
||||
*/
|
||||
public static class TestTarget implements Runnable {
|
||||
|
||||
public void run() {
|
||||
System.out.println("25 " + isPrime(25));
|
||||
System.out.println("23 " + isPrime(23));
|
||||
System.out.println("12 " + isPrime(12));
|
||||
}
|
||||
|
||||
private boolean isPrime(final int n) {
|
||||
for (int i = 2; i * i <= n; i++) {
|
||||
if ((n % i) == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A class loader that loads classes from in-memory data.
|
||||
*/
|
||||
public static class MemoryClassLoader extends ClassLoader {
|
||||
|
||||
private final Map<String, byte[]> definitions = new HashMap<String, byte[]>();
|
||||
|
||||
/**
|
||||
* Add a in-memory representation of a class.
|
||||
*
|
||||
* @param name name of the class
|
||||
* @param bytes class definition
|
||||
*/
|
||||
public void addDefinition(final String name, final byte[] bytes) {
|
||||
definitions.put(name, bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
|
||||
final byte[] bytes = definitions.get(name);
|
||||
if (bytes != null) {
|
||||
return defineClass(name, bytes, 0, bytes.length);
|
||||
}
|
||||
return super.loadClass(name, resolve);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final PrintStream out;
|
||||
|
||||
/**
|
||||
* Creates a new example instance printing to the given stream.
|
||||
*
|
||||
* @param out stream for outputs
|
||||
*/
|
||||
public CoreTutorial(final PrintStream out) {
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run this example.
|
||||
*
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
public void execute() throws Exception {
|
||||
final String targetName = TestTarget.class.getName();
|
||||
|
||||
// For instrumentation and runtime we need a IRuntime instance
|
||||
// to collect execution data:
|
||||
final IRuntime runtime = new LoggerRuntime();
|
||||
|
||||
// The Instrumenter creates a modified version of our test target class
|
||||
// that contains additional probes for execution data recording:
|
||||
final Instrumenter instr = new Instrumenter(runtime);
|
||||
final byte[] instrumented = instr.instrument(getTargetClass(targetName), targetName);
|
||||
|
||||
// Now we're ready to run our instrumented class and need to startup the
|
||||
// runtime first:
|
||||
final RuntimeData data = new RuntimeData();
|
||||
runtime.startup(data);
|
||||
|
||||
// In this tutorial we use a special class loader to directly load the
|
||||
// instrumented class definition from a byte[] instances.
|
||||
final MemoryClassLoader memoryClassLoader = new MemoryClassLoader();
|
||||
memoryClassLoader.addDefinition(targetName, instrumented);
|
||||
final Class<?> targetClass = memoryClassLoader.loadClass(targetName);
|
||||
|
||||
// Here we execute our test target class through its Runnable interface:
|
||||
final Runnable targetInstance = (Runnable) targetClass.newInstance();
|
||||
targetInstance.run();
|
||||
|
||||
// At the end of test execution we collect execution data and shutdown
|
||||
// the runtime:
|
||||
final ExecutionDataStore executionData = new ExecutionDataStore();
|
||||
final SessionInfoStore sessionInfos = new SessionInfoStore();
|
||||
data.collect(executionData, sessionInfos, false);
|
||||
runtime.shutdown();
|
||||
|
||||
// Together with the original class definition we can calculate coverage
|
||||
// information:
|
||||
final CoverageBuilder coverageBuilder = new CoverageBuilder();
|
||||
final Analyzer analyzer = new Analyzer(executionData, coverageBuilder);
|
||||
analyzer.analyzeClass(getTargetClass(targetName), targetName);
|
||||
|
||||
// Let's dump some metrics and line coverage information:
|
||||
for (final IClassCoverage cc: coverageBuilder.getClasses()) {
|
||||
out.printf("Coverage of class %s%n", cc.getName());
|
||||
|
||||
printCounter("instructions", cc.getInstructionCounter());
|
||||
printCounter("branches", cc.getBranchCounter());
|
||||
printCounter("lines", cc.getLineCounter());
|
||||
printCounter("methods", cc.getMethodCounter());
|
||||
printCounter("complexity", cc.getComplexityCounter());
|
||||
|
||||
for (int i = cc.getFirstLine(); i <= cc.getLastLine(); i++) {
|
||||
out.printf("Line %s: %s%n", Integer.valueOf(i), getColor(cc.getLine(i).getStatus()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private InputStream getTargetClass(final String name) {
|
||||
final String resource = '/' + name.replace('.', '/') + ".class";
|
||||
return getClass().getResourceAsStream(resource);
|
||||
}
|
||||
|
||||
private void printCounter(final String unit, final ICounter counter) {
|
||||
final Integer missed = Integer.valueOf(counter.getMissedCount());
|
||||
final Integer total = Integer.valueOf(counter.getTotalCount());
|
||||
out.printf("%s of %s %s missed%n", missed, total, unit);
|
||||
}
|
||||
|
||||
private String getColor(final int status) {
|
||||
switch (status) {
|
||||
case ICounter.NOT_COVERED:
|
||||
return "red";
|
||||
case ICounter.PARTLY_COVERED:
|
||||
return "yellow";
|
||||
case ICounter.FULLY_COVERED:
|
||||
return "green";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry point to run this examples as a Java application.
|
||||
*
|
||||
* @param args list of program arguments
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
public static void main(final String[] args) throws Exception {
|
||||
new CoreTutorial(System.out).execute();
|
||||
}
|
||||
|
||||
}
|
||||
BIN
lib/asm-all-5.0.2.jar
Normal file
BIN
lib/asm-all-5.0.2.jar
Normal file
Binary file not shown.
BIN
lib/javassist.jar
Normal file
BIN
lib/javassist.jar
Normal file
Binary file not shown.
BIN
lib/mockito-all-1.9.5.jar
Normal file
BIN
lib/mockito-all-1.9.5.jar
Normal file
Binary file not shown.
BIN
lib/org.jacoco.ant-0.7.1.20140427-1606.jar
Normal file
BIN
lib/org.jacoco.ant-0.7.1.20140427-1606.jar
Normal file
Binary file not shown.
BIN
lib/org.jacoco.core-0.7.1.20140427-1606.jar
Normal file
BIN
lib/org.jacoco.core-0.7.1.20140427-1606.jar
Normal file
Binary file not shown.
BIN
lib/org.jacoco.report-0.7.1.20140427-1606.jar
Normal file
BIN
lib/org.jacoco.report-0.7.1.20140427-1606.jar
Normal file
Binary file not shown.
BIN
lib/xpp3_min-1.1.4c.jar
Normal file
BIN
lib/xpp3_min-1.1.4c.jar
Normal file
Binary file not shown.
BIN
lib/xstream-1.4.7.jar
Normal file
BIN
lib/xstream-1.4.7.jar
Normal file
Binary file not shown.
16
nl.jssl.autounit.testclasses.BooleanArguments.xml
Normal file
16
nl.jssl.autounit.testclasses.BooleanArguments.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<map>
|
||||
<entry>
|
||||
<string>public java.lang.String getText(boolean arg1,boolean arg2)</string>
|
||||
<results>
|
||||
<contents>
|
||||
<case>
|
||||
<input class="args">
|
||||
<arg1>false</arg1>
|
||||
<arg1>false</arg1>
|
||||
</input>
|
||||
<output class="string">falsefalse</output>
|
||||
</case>
|
||||
</contents>
|
||||
</results>
|
||||
</entry>
|
||||
</map>
|
||||
21
nl.jssl.autounit.testclasses.ByteArguments.xml
Normal file
21
nl.jssl.autounit.testclasses.ByteArguments.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<map>
|
||||
<entry>
|
||||
<string>public int getDouble(byte arg1)</string>
|
||||
<results>
|
||||
<contents>
|
||||
<case>
|
||||
<input class="args">
|
||||
<arg1>-128</arg1>
|
||||
</input>
|
||||
<output class="int">-256</output>
|
||||
</case>
|
||||
<case>
|
||||
<input class="args">
|
||||
<arg1>0</arg1>
|
||||
</input>
|
||||
<output class="int">11</output>
|
||||
</case>
|
||||
</contents>
|
||||
</results>
|
||||
</entry>
|
||||
</map>
|
||||
15
nl.jssl.autounit.testclasses.FloatArguments.xml
Normal file
15
nl.jssl.autounit.testclasses.FloatArguments.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<map>
|
||||
<entry>
|
||||
<string>public int round(float arg1)</string>
|
||||
<results>
|
||||
<contents>
|
||||
<case>
|
||||
<input class="args">
|
||||
<arg1>-Infinity</arg1>
|
||||
</input>
|
||||
<output class="int">-2147483648</output>
|
||||
</case>
|
||||
</contents>
|
||||
</results>
|
||||
</entry>
|
||||
</map>
|
||||
34
nl.jssl.autounit.testclasses.IntArguments.xml
Normal file
34
nl.jssl.autounit.testclasses.IntArguments.xml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<map>
|
||||
<entry>
|
||||
<string>public int randomOther(int arg1)</string>
|
||||
<results>
|
||||
<contents>
|
||||
<case>
|
||||
<input class="args">
|
||||
<arg1>-1974141712</arg1>
|
||||
</input>
|
||||
<output class="int">0</output>
|
||||
</case>
|
||||
</contents>
|
||||
</results>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>public java.lang.String evenOrUneven(int arg1)</string>
|
||||
<results>
|
||||
<contents>
|
||||
<case>
|
||||
<input class="args">
|
||||
<arg1>-2052986116</arg1>
|
||||
</input>
|
||||
<output class="string">even</output>
|
||||
</case>
|
||||
<case>
|
||||
<input class="args">
|
||||
<arg1>-861970233</arg1>
|
||||
</input>
|
||||
<output class="string">uneven</output>
|
||||
</case>
|
||||
</contents>
|
||||
</results>
|
||||
</entry>
|
||||
</map>
|
||||
43
src/nl/jssl/autounit/AutoTester.java
Normal file
43
src/nl/jssl/autounit/AutoTester.java
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package nl.jssl.autounit;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* record: records in and outputs
|
||||
*
|
||||
* assertUnchangedBehaviour: raises an error when recorded inputs do no lead to
|
||||
* recorded outputs
|
||||
*/
|
||||
public class AutoTester {
|
||||
ResultsWriter resultsWriter = new ResultsWriter();
|
||||
|
||||
public Map<String, MethodCallResults> record(Class instance) {
|
||||
Map<String, MethodCallResults> results = new Recorder(instance).record();
|
||||
resultsWriter.write(instance.getName(), results);
|
||||
return results;
|
||||
}
|
||||
|
||||
// public void assertUnchangedBehaviour(Object instance) {
|
||||
// Map<String, MethodCallResults> recordedResults =
|
||||
// load(getClassname(instance));
|
||||
// for (Entry<String, MethodCallResults> entry : recordedResults.entrySet())
|
||||
// {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
private Map<String, MethodCallResults> load(String classname) {
|
||||
try {
|
||||
ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(classname + ".dat"));
|
||||
Map<String, MethodCallResults> results = (Map<String, MethodCallResults>) objectInputStream.readObject();
|
||||
objectInputStream.close();
|
||||
return results;
|
||||
} catch (IOException | ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
16
src/nl/jssl/autounit/Configuration.java
Normal file
16
src/nl/jssl/autounit/Configuration.java
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package nl.jssl.autounit;
|
||||
|
||||
import javassist.ClassPool;
|
||||
import javassist.NotFoundException;
|
||||
|
||||
public class Configuration {
|
||||
public static ClassPool getClassPool() {
|
||||
ClassPool classPool = new ClassPool();
|
||||
try {
|
||||
classPool.appendClassPath("c:\\workspaces\\autounit\\autounit\\bin");
|
||||
} catch (NotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return classPool;
|
||||
}
|
||||
}
|
||||
102
src/nl/jssl/autounit/CoverageAnalyser.java
Normal file
102
src/nl/jssl/autounit/CoverageAnalyser.java
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
package nl.jssl.autounit;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import nl.jssl.autounit.utils.SilentObjectCreator;
|
||||
|
||||
import org.jacoco.core.analysis.Analyzer;
|
||||
import org.jacoco.core.analysis.CoverageBuilder;
|
||||
import org.jacoco.core.analysis.IClassCoverage;
|
||||
import org.jacoco.core.data.ExecutionDataStore;
|
||||
import org.jacoco.core.data.SessionInfoStore;
|
||||
import org.jacoco.core.instr.Instrumenter;
|
||||
import org.jacoco.core.runtime.IRuntime;
|
||||
import org.jacoco.core.runtime.LoggerRuntime;
|
||||
import org.jacoco.core.runtime.RuntimeData;
|
||||
import org.jacoco.examples.CoreTutorial.MemoryClassLoader;
|
||||
|
||||
public class CoverageAnalyser {
|
||||
private IRuntime runtime;
|
||||
private RuntimeData data = new RuntimeData();
|
||||
|
||||
public <T> T instrument(Class<T> testTarget) {
|
||||
try {
|
||||
String targetName = testTarget.getName();
|
||||
|
||||
runtime = new LoggerRuntime();
|
||||
|
||||
Instrumenter instr = new Instrumenter(runtime);
|
||||
byte[] instrumented = instr.instrument(getTargetClass(targetName), targetName);
|
||||
|
||||
data = new RuntimeData();
|
||||
runtime.startup(data);
|
||||
|
||||
MemoryClassLoader memoryClassLoader = new MemoryClassLoader();
|
||||
memoryClassLoader.addDefinition(targetName, instrumented);
|
||||
Class<T> targetClass = (Class<T>) memoryClassLoader.loadClass(targetName);
|
||||
|
||||
return SilentObjectCreator.create(targetClass);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public <T> InvocationResult analyse(T instrumentedTestTarget, Method method, Object[] inputs) {
|
||||
try {
|
||||
Method instanceMethod = getInstrumentedMethod(instrumentedTestTarget, method);
|
||||
Object output = invoke(instrumentedTestTarget, inputs, instanceMethod);
|
||||
|
||||
// jacoco stuff
|
||||
ExecutionDataStore executionData = new ExecutionDataStore();
|
||||
SessionInfoStore sessionInfos = new SessionInfoStore();
|
||||
data.collect(executionData, sessionInfos, false);
|
||||
runtime.shutdown();
|
||||
|
||||
CoverageBuilder coverageBuilder = new CoverageBuilder();
|
||||
Analyzer analyzer = new Analyzer(executionData, coverageBuilder);
|
||||
String targetName = instrumentedTestTarget.getClass().getName();
|
||||
analyzer.analyzeClass(getTargetClass(targetName), targetName);
|
||||
|
||||
return new InvocationResult(coverageBuilder.getClasses().iterator().next(), output);
|
||||
} catch (Exception e) {
|
||||
throw new ExecutionException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> Method getInstrumentedMethod(T testTarget, Method method) throws NoSuchMethodException {
|
||||
return testTarget.getClass().getDeclaredMethod(method.getName(), method.getParameterTypes());
|
||||
}
|
||||
|
||||
private <T> Object invoke(T testTarget, Object[] inputs, Method newInstanceMethod) throws IllegalAccessException {
|
||||
Object output;
|
||||
try {
|
||||
output = newInstanceMethod.invoke(testTarget, inputs);
|
||||
} catch (InvocationTargetException i) {
|
||||
StackTraceElement stacktraceElement = i.getTargetException().getStackTrace()[0];
|
||||
String info = stacktraceElement.getClassName() + ":" + stacktraceElement.getLineNumber();
|
||||
output = i.getTargetException().getClass().getName() + "(" + i.getTargetException().getMessage() + ") at "
|
||||
+ info;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
private InputStream getTargetClass(String name) {
|
||||
String resource = '/' + name.replace('.', '/') + ".class";
|
||||
return getClass().getResourceAsStream(resource);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class InvocationResult {
|
||||
public final IClassCoverage coverage;
|
||||
public final Object output;
|
||||
|
||||
public InvocationResult(IClassCoverage coverage, Object output) {
|
||||
super();
|
||||
this.coverage = coverage;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
}
|
||||
25
src/nl/jssl/autounit/ExecutionException.java
Normal file
25
src/nl/jssl/autounit/ExecutionException.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package nl.jssl.autounit;
|
||||
@SuppressWarnings("serial")
|
||||
public class ExecutionException extends RuntimeException {
|
||||
|
||||
public ExecutionException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ExecutionException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
public ExecutionException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ExecutionException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ExecutionException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
||||
19
src/nl/jssl/autounit/InAndOutput.java
Normal file
19
src/nl/jssl/autounit/InAndOutput.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package nl.jssl.autounit;
|
||||
|
||||
public class InAndOutput {
|
||||
private final Object input;
|
||||
private final Object output;
|
||||
|
||||
public InAndOutput(Object input, Object output) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public Object getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public Object getOutput() {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
57
src/nl/jssl/autounit/MethodCallResults.java
Normal file
57
src/nl/jssl/autounit/MethodCallResults.java
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package nl.jssl.autounit;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jacoco.core.analysis.IClassCoverage;
|
||||
|
||||
public class MethodCallResults {
|
||||
private transient Object testinstance;
|
||||
private transient Method executedMethod;
|
||||
private List<InAndOutput> contents = new ArrayList<InAndOutput>();
|
||||
private transient IClassCoverage coverageResult;
|
||||
|
||||
public MethodCallResults(Object testClass, Method m) {
|
||||
super();
|
||||
this.testinstance = testClass;
|
||||
this.executedMethod = m;
|
||||
}
|
||||
|
||||
public void addResult(Object input, Object output) {
|
||||
contents.add(new InAndOutput(input, output));
|
||||
}
|
||||
|
||||
public List<InAndOutput> getContents() {
|
||||
return contents;
|
||||
}
|
||||
|
||||
public Object getTestinstance() {
|
||||
return testinstance;
|
||||
}
|
||||
|
||||
public Method getExecutedMethod() {
|
||||
return executedMethod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getReport();
|
||||
}
|
||||
|
||||
public void setCoverageResult(IClassCoverage coverageResult) {
|
||||
this.coverageResult = coverageResult;
|
||||
}
|
||||
|
||||
public IClassCoverage getCoverageResult() {
|
||||
return coverageResult;
|
||||
}
|
||||
|
||||
public String getReport() {
|
||||
StringBuilder s = new StringBuilder();
|
||||
for (InAndOutput inAndOutput : contents) {
|
||||
s.append(inAndOutput.getInput() + " => " + inAndOutput.getOutput() + "\n");
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
}
|
||||
56
src/nl/jssl/autounit/MethodcallExecutor.java
Normal file
56
src/nl/jssl/autounit/MethodcallExecutor.java
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
package nl.jssl.autounit;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import nl.jssl.autounit.inputs.ArgumentsForSingleCall;
|
||||
|
||||
/**
|
||||
* voert 1 methode uit met wisselende input parameters en bewaart het resultaat.
|
||||
*
|
||||
*/
|
||||
public class MethodcallExecutor {
|
||||
private Object instrumentedTestTarget;
|
||||
private Method m;
|
||||
CoverageAnalyser coverageAnalyser = new CoverageAnalyser();
|
||||
private MethodCallResults result;
|
||||
|
||||
public MethodcallExecutor(Class<?> testClass, Method m) {
|
||||
super();
|
||||
this.instrumentedTestTarget = coverageAnalyser.instrument(testClass);
|
||||
this.m = m;
|
||||
this.result = new MethodCallResults(instrumentedTestTarget, m);
|
||||
}
|
||||
|
||||
public MethodCallResults execute(List<ArgumentsForSingleCall> inputs) {
|
||||
int missedLines = Integer.MAX_VALUE;
|
||||
InvocationResult lastInvocationResult = null, previous = null;
|
||||
for (ArgumentsForSingleCall input : inputs) {
|
||||
previous = lastInvocationResult;
|
||||
lastInvocationResult = analyseMethodCall(m, input);
|
||||
int missedCount = lastInvocationResult.coverage.getLineCounter().getMissedCount();
|
||||
if (missedCount < missedLines) { // coverage increases, this is an
|
||||
// interesting input
|
||||
missedLines = missedCount;
|
||||
result.addResult(input, lastInvocationResult.output);
|
||||
}
|
||||
if (missedCount == 0) { // coverage = 100%: done
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (previous == null) {
|
||||
result.setCoverageResult(lastInvocationResult.coverage);
|
||||
} else {
|
||||
result.setCoverageResult(previous.coverage);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private InvocationResult analyseMethodCall(Method m, ArgumentsForSingleCall input) {
|
||||
return coverageAnalyser.analyse(instrumentedTestTarget, m, input.toArray());
|
||||
}
|
||||
|
||||
public MethodCallResults getResult() {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
31
src/nl/jssl/autounit/Player.java
Normal file
31
src/nl/jssl/autounit/Player.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package nl.jssl.autounit;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class Player {
|
||||
final private Object testinstance;
|
||||
|
||||
private Player(Object testinstance) {
|
||||
super();
|
||||
this.testinstance = testinstance;
|
||||
}
|
||||
|
||||
public void playback(Map<String, List<MethodCallResults>> recordedResults) {
|
||||
for (Entry<String, List<MethodCallResults>> entry: recordedResults.entrySet()) {
|
||||
getInputs(entry.getValue());
|
||||
// new Executor(testinstance,getMethod(entry.getKey()))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void getInputs(List<MethodCallResults> value) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
// private Method getMethod(String key) {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// }
|
||||
}
|
||||
61
src/nl/jssl/autounit/Recorder.java
Normal file
61
src/nl/jssl/autounit/Recorder.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package nl.jssl.autounit;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import nl.jssl.autounit.inputs.ArgumentsForSingleCall;
|
||||
import nl.jssl.autounit.inputs.CombinedInputSetFactory;
|
||||
|
||||
public class Recorder {
|
||||
private Class<?> testTarget;
|
||||
|
||||
public Recorder(Class<?> testTarget) {
|
||||
this.testTarget = testTarget;
|
||||
}
|
||||
|
||||
public Map<String, MethodCallResults> record() {
|
||||
Map<String, MethodCallResults> classresults = new HashMap<String, MethodCallResults>();
|
||||
for (Method m : getPublicMethods()) {
|
||||
MethodCallResults methodresults = recordMethod(m);
|
||||
classresults.put(getMethodSignature(m), methodresults);
|
||||
}
|
||||
return classresults;
|
||||
}
|
||||
|
||||
private String getMethodSignature(Method m) {
|
||||
String signature = Modifier.toString(m.getModifiers()) + " " + m.getReturnType().getName() + " " + m.getName()
|
||||
+ "(";
|
||||
int index = 1;
|
||||
Class<?>[] parameterTypes = m.getParameterTypes();
|
||||
for (Class<?> type : parameterTypes) {
|
||||
signature += type.getName() + " arg" + (index++);
|
||||
if (index <= parameterTypes.length) {
|
||||
signature += ",";
|
||||
}
|
||||
}
|
||||
signature += ")";
|
||||
return signature;
|
||||
}
|
||||
|
||||
private MethodCallResults recordMethod(Method m) {
|
||||
List<ArgumentsForSingleCall> inputSet = new CombinedInputSetFactory().getInputs(testTarget, m);
|
||||
MethodcallExecutor methodcallExecutor = new MethodcallExecutor(testTarget, m);
|
||||
methodcallExecutor.execute(inputSet);
|
||||
return methodcallExecutor.getResult();
|
||||
}
|
||||
|
||||
List<Method> getPublicMethods() {
|
||||
List<Method> publicMethods = new ArrayList<Method>();
|
||||
for (Method m : testTarget.getDeclaredMethods()) {
|
||||
if (Modifier.isPublic(m.getModifiers())) {
|
||||
publicMethods.add(m);
|
||||
}
|
||||
}
|
||||
return publicMethods;
|
||||
}
|
||||
|
||||
}
|
||||
34
src/nl/jssl/autounit/ResultsWriter.java
Normal file
34
src/nl/jssl/autounit/ResultsWriter.java
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package nl.jssl.autounit;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import nl.jssl.autounit.inputs.ArgumentsForSingleCall;
|
||||
import nl.jssl.autounit.utils.ArgumentsConverter;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
public class ResultsWriter {
|
||||
XStream xstream = new XStream();
|
||||
|
||||
public ResultsWriter() {
|
||||
setup();
|
||||
}
|
||||
|
||||
private void setup() {
|
||||
xstream.alias("case", InAndOutput.class);
|
||||
xstream.alias("results", MethodCallResults.class);
|
||||
xstream.alias("args", ArgumentsForSingleCall.class);
|
||||
xstream.registerConverter(new ArgumentsConverter());
|
||||
}
|
||||
|
||||
public void write(String classname, Map<String, MethodCallResults> results) {
|
||||
try {
|
||||
xstream.toXML(results, new FileOutputStream(classname + ".xml"));
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
7
src/nl/jssl/autounit/inputs/ArgumentsForSingleCall.java
Normal file
7
src/nl/jssl/autounit/inputs/ArgumentsForSingleCall.java
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ArgumentsForSingleCall extends ArrayList<Object> {
|
||||
|
||||
}
|
||||
12
src/nl/jssl/autounit/inputs/BooleanInputsFactory.java
Normal file
12
src/nl/jssl/autounit/inputs/BooleanInputsFactory.java
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
public class BooleanInputsFactory implements InputsFactory<Boolean> {
|
||||
|
||||
public SingleTypeInputs<Boolean> getInputs(Class<?> testTarget) {
|
||||
SingleTypeInputs<Boolean> inputs = new SingleTypeInputs<Boolean>();
|
||||
inputs.add(Boolean.FALSE);
|
||||
inputs.add(Boolean.TRUE);
|
||||
return inputs;
|
||||
}
|
||||
|
||||
}
|
||||
13
src/nl/jssl/autounit/inputs/ByteInputsFactory.java
Normal file
13
src/nl/jssl/autounit/inputs/ByteInputsFactory.java
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
public class ByteInputsFactory implements InputsFactory<Byte> {
|
||||
|
||||
public SingleTypeInputs<Byte> getInputs(Class<?> testTarget) {
|
||||
SingleTypeInputs<Byte> inputs = new SingleTypeInputs<Byte>();
|
||||
for (byte i = Byte.MIN_VALUE; i < Byte.MAX_VALUE; i++) {
|
||||
inputs.add(i);
|
||||
}
|
||||
return inputs;
|
||||
}
|
||||
|
||||
}
|
||||
105
src/nl/jssl/autounit/inputs/CombinedInputSetFactory.java
Normal file
105
src/nl/jssl/autounit/inputs/CombinedInputSetFactory.java
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import nl.jssl.autounit.utils.Permutator;
|
||||
|
||||
public class CombinedInputSetFactory {
|
||||
private final Map<Class<?>, InputsFactory<?>> primitivesFactories;
|
||||
|
||||
public CombinedInputSetFactory() {
|
||||
primitivesFactories = new HashMap<>();
|
||||
populateFactories();
|
||||
}
|
||||
|
||||
public List<ArgumentsForSingleCall> getInputs(Class<?> testTarget, Method m) {
|
||||
return combine(getInputSetsForAllArguments(testTarget, m));
|
||||
}
|
||||
|
||||
private List<ArgumentsForSingleCall> combine(List<SingleTypeInputs<?>> inputSetsForAllArguments) {
|
||||
int nrOfParameters = inputSetsForAllArguments.size();
|
||||
if (nrOfParameters == 1) {
|
||||
// simple case
|
||||
return makeArgumentsForSingleParameterCall(inputSetsForAllArguments);
|
||||
} else {
|
||||
List<ArgumentsForSingleCall> allPossibleArguments = new ArrayList<>();
|
||||
|
||||
for (SingleTypeInputs<?> inputs : inputSetsForAllArguments) {
|
||||
// make list of all permutations of first argument values
|
||||
List<?> permutatedInputs = Permutator.permute(inputs);
|
||||
int index = 0;
|
||||
for (Object variable : permutatedInputs) {
|
||||
// all lists ("columns") are combined into "rows"
|
||||
if (index >= allPossibleArguments.size()) {
|
||||
ArgumentsForSingleCall a = new ArgumentsForSingleCall();
|
||||
a.add(variable);
|
||||
allPossibleArguments.add(a);
|
||||
} else {
|
||||
ArgumentsForSingleCall argumentsForSingleCall = allPossibleArguments.get(index);
|
||||
argumentsForSingleCall.add(variable);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
// the row view
|
||||
return allPossibleArguments;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<ArgumentsForSingleCall> makeArgumentsForSingleParameterCall(
|
||||
List<SingleTypeInputs<?>> generatedInputSetsForAllArguments) {
|
||||
List<ArgumentsForSingleCall> allPossibleArguments = new ArrayList<ArgumentsForSingleCall>();
|
||||
|
||||
SingleTypeInputs<?> generatedInputs = generatedInputSetsForAllArguments.iterator().next();
|
||||
|
||||
for (Object variable : generatedInputs) {
|
||||
ArgumentsForSingleCall argument = new ArgumentsForSingleCall();
|
||||
argument.add(variable);
|
||||
allPossibleArguments.add(argument);
|
||||
}
|
||||
return allPossibleArguments;
|
||||
}
|
||||
|
||||
private List<SingleTypeInputs<?>> getInputSetsForAllArguments(Class<?> testTarget, Method m) {
|
||||
List<SingleTypeInputs<?>> singleInputSets = new ArrayList<>();
|
||||
for (Class<?> parametertype : m.getParameterTypes()) {
|
||||
SingleTypeInputs<?> inputs = tryPrimitives(testTarget, parametertype);
|
||||
|
||||
if (inputs == null) {
|
||||
inputs = new MocksFactory().getMockInputs(testTarget, parametertype);
|
||||
}
|
||||
if (inputs != null) {
|
||||
singleInputSets.add(inputs);
|
||||
}
|
||||
}
|
||||
return singleInputSets;
|
||||
}
|
||||
|
||||
private SingleTypeInputs<?> tryPrimitives(Class<?> testTarget, Class<?> parametertype) {
|
||||
InputsFactory<?> inputsFactory = primitivesFactories.get(parametertype);
|
||||
if (inputsFactory != null) {
|
||||
return inputsFactory.getInputs(testTarget);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void populateFactories() {
|
||||
primitivesFactories.put(int.class, new IntegerInputsFactory());
|
||||
primitivesFactories.put(Integer.class, new IntegerInputsFactory());
|
||||
primitivesFactories.put(double.class, new DoubleInputsFactory());
|
||||
primitivesFactories.put(Double.class, new DoubleInputsFactory());
|
||||
primitivesFactories.put(float.class, new FloatInputsFactory());
|
||||
primitivesFactories.put(Float.class, new FloatInputsFactory());
|
||||
primitivesFactories.put(byte.class, new ByteInputsFactory());
|
||||
primitivesFactories.put(Byte.class, new ByteInputsFactory());
|
||||
primitivesFactories.put(Boolean.class, new BooleanInputsFactory());
|
||||
primitivesFactories.put(boolean.class, new BooleanInputsFactory());
|
||||
primitivesFactories.put(String.class, new StringInputsFactory());
|
||||
}
|
||||
}
|
||||
21
src/nl/jssl/autounit/inputs/DoubleInputsFactory.java
Normal file
21
src/nl/jssl/autounit/inputs/DoubleInputsFactory.java
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
|
||||
public class DoubleInputsFactory implements InputsFactory<Double> {
|
||||
|
||||
public SingleTypeInputs<Double> getInputs(Class<?> testTarget) {
|
||||
SingleTypeInputs<Double> inputs = new SingleTypeInputs<Double>();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
inputs.add(((2 * Math.random() - 2) * Double.MAX_VALUE));
|
||||
}
|
||||
inputs.add(Double.MIN_VALUE);
|
||||
inputs.add(-2D);
|
||||
inputs.add(-1D);
|
||||
inputs.add(0D);
|
||||
inputs.add(1D);
|
||||
inputs.add(2D);
|
||||
inputs.add(Double.MAX_VALUE);
|
||||
return inputs;
|
||||
}
|
||||
|
||||
}
|
||||
20
src/nl/jssl/autounit/inputs/FloatInputsFactory.java
Normal file
20
src/nl/jssl/autounit/inputs/FloatInputsFactory.java
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
|
||||
public class FloatInputsFactory implements InputsFactory<Float> {
|
||||
|
||||
public SingleTypeInputs<Float> getInputs(Class<?> testTarget) {
|
||||
SingleTypeInputs<Float> inputs = new SingleTypeInputs<Float>();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
inputs.add((float) ((2 * Math.random() - 2) * Float.MAX_VALUE));
|
||||
}
|
||||
inputs.add(Float.MIN_VALUE);
|
||||
inputs.add(-2F);
|
||||
inputs.add(-1F);
|
||||
inputs.add(0F);
|
||||
inputs.add(1F);
|
||||
inputs.add(2F);
|
||||
inputs.add(Float.MAX_VALUE);
|
||||
return inputs;
|
||||
}
|
||||
}
|
||||
5
src/nl/jssl/autounit/inputs/InputsFactory.java
Normal file
5
src/nl/jssl/autounit/inputs/InputsFactory.java
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
public interface InputsFactory<T> {
|
||||
SingleTypeInputs<T> getInputs(Class<?> testTarget);
|
||||
}
|
||||
20
src/nl/jssl/autounit/inputs/IntegerInputsFactory.java
Normal file
20
src/nl/jssl/autounit/inputs/IntegerInputsFactory.java
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
public class IntegerInputsFactory implements InputsFactory<Integer> {
|
||||
|
||||
public SingleTypeInputs<Integer> getInputs(Class<?> testTarget) {
|
||||
SingleTypeInputs<Integer> inputs = new SingleTypeInputs<Integer>();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
inputs.add((int) ((2 * Math.random() - 2) * Integer.MAX_VALUE));
|
||||
}
|
||||
inputs.add(Integer.MIN_VALUE);
|
||||
inputs.add(-2);
|
||||
inputs.add(-1);
|
||||
inputs.add(0);
|
||||
inputs.add(1);
|
||||
inputs.add(2);
|
||||
inputs.add(Integer.MAX_VALUE);
|
||||
return inputs;
|
||||
}
|
||||
|
||||
}
|
||||
21
src/nl/jssl/autounit/inputs/LongInputsFactory.java
Normal file
21
src/nl/jssl/autounit/inputs/LongInputsFactory.java
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
|
||||
public class LongInputsFactory implements InputsFactory<Long> {
|
||||
|
||||
public SingleTypeInputs<Long> getInputs(Class<?> testTarget) {
|
||||
SingleTypeInputs<Long> inputs = new SingleTypeInputs<Long>();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
inputs.add((long) ((2 * Math.random() - 2) * Long.MAX_VALUE));
|
||||
}
|
||||
inputs.add(Long.MIN_VALUE);
|
||||
inputs.add(-2L);
|
||||
inputs.add(-1L);
|
||||
inputs.add(0L);
|
||||
inputs.add(1L);
|
||||
inputs.add(2L);
|
||||
inputs.add(Long.MAX_VALUE);
|
||||
return inputs;
|
||||
}
|
||||
|
||||
}
|
||||
25
src/nl/jssl/autounit/inputs/MocksFactory.java
Normal file
25
src/nl/jssl/autounit/inputs/MocksFactory.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class MocksFactory {
|
||||
CombinedInputSetFactory inputSetFactory = new CombinedInputSetFactory();
|
||||
|
||||
public SingleTypeInputs<?> getMockInputs(Class<?> testTarget, Class<?> parametertype) {
|
||||
SingleTypeInputs<Object> inputs = new SingleTypeInputs<>();
|
||||
setExpectations(parametertype);
|
||||
// inputs.add(mock);
|
||||
return inputs;
|
||||
}
|
||||
|
||||
private void setExpectations(Class<?> parametertype) {
|
||||
Method[] declaredMethods = parametertype.getDeclaredMethods();
|
||||
for (Method m : declaredMethods) {
|
||||
// Set<SingleTypeInputs<?>> inputs =
|
||||
// inputSetFactory.getInputs(parametertype, m);
|
||||
}
|
||||
Object mock = Mockito.mock(parametertype);
|
||||
}
|
||||
}
|
||||
6
src/nl/jssl/autounit/inputs/SingleTypeInputs.java
Normal file
6
src/nl/jssl/autounit/inputs/SingleTypeInputs.java
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SingleTypeInputs<T> extends ArrayList<T> {
|
||||
}
|
||||
18
src/nl/jssl/autounit/inputs/StringInputsFactory.java
Normal file
18
src/nl/jssl/autounit/inputs/StringInputsFactory.java
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package nl.jssl.autounit.inputs;
|
||||
|
||||
import nl.jssl.autounit.Configuration;
|
||||
import nl.jssl.autounit.utils.ConstantpoolReader;
|
||||
|
||||
public class StringInputsFactory implements InputsFactory<String> {
|
||||
private static ConstantpoolReader constantpoolReader = new ConstantpoolReader(Configuration.getClassPool());
|
||||
|
||||
@Override
|
||||
public SingleTypeInputs<String> getInputs(Class<?> testTarget) {
|
||||
SingleTypeInputs<String> inputs = new SingleTypeInputs<String>();
|
||||
inputs.add(null);
|
||||
inputs.add("some");
|
||||
inputs.addAll(constantpoolReader.scanStrings(testTarget));
|
||||
return inputs;
|
||||
}
|
||||
|
||||
}
|
||||
32
src/nl/jssl/autounit/utils/ArgumentsConverter.java
Normal file
32
src/nl/jssl/autounit/utils/ArgumentsConverter.java
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package nl.jssl.autounit.utils;
|
||||
|
||||
import nl.jssl.autounit.inputs.ArgumentsForSingleCall;
|
||||
|
||||
import com.thoughtworks.xstream.converters.Converter;
|
||||
import com.thoughtworks.xstream.converters.MarshallingContext;
|
||||
import com.thoughtworks.xstream.converters.UnmarshallingContext;
|
||||
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
|
||||
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
||||
|
||||
public class ArgumentsConverter implements Converter {
|
||||
|
||||
public boolean canConvert(Class clazz) {
|
||||
return (clazz == ArgumentsForSingleCall.class);
|
||||
}
|
||||
|
||||
public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {
|
||||
ArgumentsForSingleCall person = (ArgumentsForSingleCall) value;
|
||||
int index = 1;
|
||||
for (Object arg : person) {
|
||||
writer.startNode("arg" + index);
|
||||
writer.setValue(arg.toString());
|
||||
writer.endNode();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
46
src/nl/jssl/autounit/utils/ConstantpoolReader.java
Normal file
46
src/nl/jssl/autounit/utils/ConstantpoolReader.java
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package nl.jssl.autounit.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
import javassist.bytecode.ConstPool;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ConstantpoolReader {
|
||||
|
||||
private ClassPool pool;
|
||||
|
||||
public ConstantpoolReader(ClassPool pool) {
|
||||
this.pool = pool;
|
||||
}
|
||||
|
||||
public List<String> scanStrings(Class<?> target) {
|
||||
CtClass ctClass;
|
||||
try {
|
||||
ctClass = pool.get(target.getName());
|
||||
List<String> strings = new ArrayList<>();
|
||||
if (isScannable(ctClass)) {
|
||||
ConstPool constPool = ctClass.getClassFile().getConstPool();
|
||||
int size = constPool.getSize();
|
||||
for (int i = 1; i < size; i++) {
|
||||
int tag = constPool.getTag(i);
|
||||
if (tag == ConstPool.CONST_String) {
|
||||
strings.add(constPool.getStringInfo(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
return strings;
|
||||
} catch (NotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isScannable(CtClass ctClass) {
|
||||
return !ctClass.isFrozen();
|
||||
}
|
||||
|
||||
}
|
||||
25
src/nl/jssl/autounit/utils/Permutator.java
Normal file
25
src/nl/jssl/autounit/utils/Permutator.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package nl.jssl.autounit.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class Permutator {
|
||||
public static List<?> permute(List<? extends Object> arr) {
|
||||
List<Object> all = new ArrayList<>();
|
||||
permute(new ArrayList<Object>(arr), 0, all);
|
||||
return all;
|
||||
}
|
||||
|
||||
private static void permute(List<?> arr, int k, List<Object> all) {
|
||||
for (int i = k; i < arr.size(); i++) {
|
||||
Collections.swap(arr, i, k);
|
||||
permute(arr, k + 1, all);
|
||||
Collections.swap(arr, k, i);
|
||||
}
|
||||
if (k == arr.size() - 1) {
|
||||
all.addAll(arr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
29
src/nl/jssl/autounit/utils/SilentObjectCreator.java
Normal file
29
src/nl/jssl/autounit/utils/SilentObjectCreator.java
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package nl.jssl.autounit.utils;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import sun.reflect.ReflectionFactory;
|
||||
|
||||
/**
|
||||
* Creates Objects from any class.
|
||||
*
|
||||
* Kindly copied from http://www.javaspecialists.eu/archive/Issue175.html
|
||||
*/
|
||||
public class SilentObjectCreator {
|
||||
public static <T> T create(Class<T> clazz) {
|
||||
return create(clazz, Object.class);
|
||||
}
|
||||
|
||||
public static <T> T create(Class<T> clazz, Class<? super T> parent) {
|
||||
try {
|
||||
ReflectionFactory rf = ReflectionFactory.getReflectionFactory();
|
||||
Constructor<?> objDef = parent.getDeclaredConstructor();
|
||||
Constructor<T> intConstr = rf.newConstructorForSerialization(clazz, objDef);
|
||||
return clazz.cast(intConstr.newInstance());
|
||||
} catch (RuntimeException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Cannot create object", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
71
test-output/Default suite/Default test.html
Normal file
71
test-output/Default suite/Default test.html
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>TestNG: Default test</title>
|
||||
<link href="../testng.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../my-testng.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<style type="text/css">
|
||||
.log { display: none;}
|
||||
.stack-trace { display: none;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function flip(e) {
|
||||
current = e.style.display;
|
||||
if (current == 'block') {
|
||||
e.style.display = 'none';
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
e.style.display = 'block';
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleBox(szDivId, elem, msg1, msg2)
|
||||
{
|
||||
var res = -1; if (document.getElementById) {
|
||||
res = flip(document.getElementById(szDivId));
|
||||
}
|
||||
else if (document.all) {
|
||||
// this is the way old msie versions work
|
||||
res = flip(document.all[szDivId]);
|
||||
}
|
||||
if(elem) {
|
||||
if(res == 0) elem.innerHTML = msg1; else elem.innerHTML = msg2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function toggleAllBoxes() {
|
||||
if (document.getElementsByTagName) {
|
||||
d = document.getElementsByTagName('div');
|
||||
for (i = 0; i < d.length; i++) {
|
||||
if (d[i].className == 'log') {
|
||||
flip(d[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h2 align='center'>Default test</h2><table border='1' align="center">
|
||||
<tr>
|
||||
<td>Tests passed/Failed/Skipped:</td><td>0/0/0</td>
|
||||
</tr><tr>
|
||||
<td>Started on:</td><td>Wed Apr 30 16:34:43 CEST 2014</td>
|
||||
</tr>
|
||||
<tr><td>Total time:</td><td>0 seconds (5 ms)</td>
|
||||
</tr><tr>
|
||||
<td>Included groups:</td><td></td>
|
||||
</tr><tr>
|
||||
<td>Excluded groups:</td><td></td>
|
||||
</tr>
|
||||
</table><p/>
|
||||
<small><i>(Hover the method name to see the test class name)</i></small><p/>
|
||||
</body>
|
||||
</html>
|
||||
4
test-output/Default suite/Default test.xml
Normal file
4
test-output/Default suite/Default test.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated by org.testng.reporters.JUnitXMLReporter -->
|
||||
<testsuite hostname="PCZW0141" tests="0" failures="0" timestamp="30 Apr 2014 14:34:43 GMT" time="0.005" errors="0">
|
||||
</testsuite>
|
||||
BIN
test-output/bullet_point.png
Normal file
BIN
test-output/bullet_point.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 356 B |
BIN
test-output/collapseall.gif
Normal file
BIN
test-output/collapseall.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 157 B |
2
test-output/emailable-report.html
Normal file
2
test-output/emailable-report.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>TestNG Report</title><style type="text/css">table {margin-bottom:10px;border-collapse:collapse;empty-cells:show}th,td {border:1px solid #009;padding:.25em .5em}th {vertical-align:bottom}td {vertical-align:top}table a {font-weight:bold}.stripe td {background-color: #E6EBF9}.num {text-align:right}.passedodd td {background-color: #3F3}.passedeven td {background-color: #0A0}.skippedodd td {background-color: #DDD}.skippedeven td {background-color: #CCC}.failedodd td,.attn {background-color: #F33}.failedeven td,.stripe .attn {background-color: #D00}.stacktrace {white-space:pre;font-family:monospace}.totop {font-size:85%;text-align:center;border-bottom:2px solid #000}</style></head><body><table><tr><th>Test</th><th># Passed</th><th># Skipped</th><th># Failed</th><th>Time (ms)</th><th>Included Groups</th><th>Excluded Groups</th></tr><tr><th colspan="7">Default suite</th></tr><tr><td><a href="#t0">Default test</a></td><td class="num">0</td><td class="num">0</td><td class="num">0</td><td class="num">5</td><td></td><td></td></tr></table><table><thead><tr><th>Class</th><th>Method</th><th>Start</th><th>Time (ms)</th></tr></thead><tbody><tr><th colspan="4">Default suite</th></tr></tbody><tbody id="t0"></tbody></table><h2>Default test</h2></body></html>
|
||||
BIN
test-output/failed.png
Normal file
BIN
test-output/failed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 977 B |
191
test-output/index.html
Normal file
191
test-output/index.html
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>TestNG reports</title>
|
||||
|
||||
<link type="text/css" href="testng-reports.css" rel="stylesheet" />
|
||||
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
|
||||
<script type="text/javascript" src="testng-reports.js"></script>
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
<script type='text/javascript'>
|
||||
google.load('visualization', '1', {packages:['table']});
|
||||
google.setOnLoadCallback(drawTable);
|
||||
var suiteTableInitFunctions = new Array();
|
||||
var suiteTableData = new Array();
|
||||
</script>
|
||||
<!--
|
||||
<script type="text/javascript" src="jquery-ui/js/jquery-ui-1.8.16.custom.min.js"></script>
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="top-banner-root">
|
||||
<span class="top-banner-title-font">Test results</span>
|
||||
<br/>
|
||||
<span class="top-banner-font-1">1 suite</span>
|
||||
</div> <!-- top-banner-root -->
|
||||
<div class="navigator-root">
|
||||
<div class="navigator-suite-header">
|
||||
<span>All suites</span>
|
||||
<a href="#" class="collapse-all-link" title="Collapse/expand all the suites">
|
||||
<img class="collapse-all-icon" src="collapseall.gif">
|
||||
</img> <!-- collapse-all-icon -->
|
||||
</a> <!-- collapse-all-link -->
|
||||
</div> <!-- navigator-suite-header -->
|
||||
<div class="suite">
|
||||
<div class="rounded-window">
|
||||
<div class="suite-header light-rounded-window-top">
|
||||
<a href="#" class="navigator-link" panel-name="suite-Default_suite">
|
||||
<span class="suite-name border-passed">Default suite</span>
|
||||
</a> <!-- navigator-link -->
|
||||
</div> <!-- suite-header light-rounded-window-top -->
|
||||
<div class="navigator-suite-content">
|
||||
<div class="suite-section-title">
|
||||
<span>Info</span>
|
||||
</div> <!-- suite-section-title -->
|
||||
<div class="suite-section-content">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#" class="navigator-link " panel-name="test-xml-Default_suite">
|
||||
<span>C:\Users\shautvast\AppData\Local\Temp\testng-eclipse-435806294\testng-customsuite.xml</span>
|
||||
</a> <!-- navigator-link -->
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="navigator-link " panel-name="testlist-Default_suite">
|
||||
<span class="test-stats">1 test</span>
|
||||
</a> <!-- navigator-link -->
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="navigator-link " panel-name="group-Default_suite">
|
||||
<span>0 groups</span>
|
||||
</a> <!-- navigator-link -->
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="navigator-link " panel-name="times-Default_suite">
|
||||
<span>Times</span>
|
||||
</a> <!-- navigator-link -->
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="navigator-link " panel-name="reporter-Default_suite">
|
||||
<span>Reporter output</span>
|
||||
</a> <!-- navigator-link -->
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="navigator-link " panel-name="ignored-methods-Default_suite">
|
||||
<span>Ignored methods</span>
|
||||
</a> <!-- navigator-link -->
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="navigator-link " panel-name="chronological-Default_suite">
|
||||
<span>Chronological view</span>
|
||||
</a> <!-- navigator-link -->
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- suite-section-content -->
|
||||
<div class="result-section">
|
||||
<div class="suite-section-title">
|
||||
<span>Results</span>
|
||||
</div> <!-- suite-section-title -->
|
||||
<div class="suite-section-content">
|
||||
<ul>
|
||||
<li>
|
||||
<span class="method-stats">0 methods, </span>
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- suite-section-content -->
|
||||
</div> <!-- result-section -->
|
||||
</div> <!-- navigator-suite-content -->
|
||||
</div> <!-- rounded-window -->
|
||||
</div> <!-- suite -->
|
||||
</div> <!-- navigator-root -->
|
||||
<div class="wrapper">
|
||||
<div class="main-panel-root">
|
||||
<div panel-name="suite-Default_suite" class="panel Default_suite">
|
||||
</div> <!-- panel Default_suite -->
|
||||
<div panel-name="test-xml-Default_suite" class="panel">
|
||||
<div class="main-panel-header rounded-window-top">
|
||||
<span class="header-content">C:\Users\shautvast\AppData\Local\Temp\testng-eclipse-435806294\testng-customsuite.xml</span>
|
||||
</div> <!-- main-panel-header rounded-window-top -->
|
||||
<div class="main-panel-content rounded-window-bottom">
|
||||
<pre>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||
<suite name="Default suite">
|
||||
<test verbose="2" name="Default test">
|
||||
<classes>
|
||||
<class name="AutoTesterTest"/>
|
||||
</classes>
|
||||
</test> <!-- Default test -->
|
||||
</suite> <!-- Default suite -->
|
||||
</pre>
|
||||
</div> <!-- main-panel-content rounded-window-bottom -->
|
||||
</div> <!-- panel -->
|
||||
<div panel-name="testlist-Default_suite" class="panel">
|
||||
<div class="main-panel-header rounded-window-top">
|
||||
<span class="header-content">Tests for Default suite</span>
|
||||
</div> <!-- main-panel-header rounded-window-top -->
|
||||
<div class="main-panel-content rounded-window-bottom">
|
||||
<ul>
|
||||
<li>
|
||||
<span class="test-name">Default test (1 class)</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- main-panel-content rounded-window-bottom -->
|
||||
</div> <!-- panel -->
|
||||
<div panel-name="group-Default_suite" class="panel">
|
||||
<div class="main-panel-header rounded-window-top">
|
||||
<span class="header-content">Groups for Default suite</span>
|
||||
</div> <!-- main-panel-header rounded-window-top -->
|
||||
<div class="main-panel-content rounded-window-bottom">
|
||||
</div> <!-- main-panel-content rounded-window-bottom -->
|
||||
</div> <!-- panel -->
|
||||
<div panel-name="times-Default_suite" class="panel">
|
||||
<div class="main-panel-header rounded-window-top">
|
||||
<span class="header-content">Times for Default suite</span>
|
||||
</div> <!-- main-panel-header rounded-window-top -->
|
||||
<div class="main-panel-content rounded-window-bottom">
|
||||
<div class="times-div">
|
||||
<script type="text/javascript">
|
||||
suiteTableInitFunctions.push('tableData_Default_suite');
|
||||
function tableData_Default_suite() {
|
||||
var data = new google.visualization.DataTable();
|
||||
data.addColumn('number', 'Number');
|
||||
data.addColumn('string', 'Method');
|
||||
data.addColumn('string', 'Class');
|
||||
data.addColumn('number', 'Time (ms)');
|
||||
data.addRows(0);
|
||||
window.suiteTableData['Default_suite']= { tableData: data, tableDiv: 'times-div-Default_suite'}
|
||||
return data;
|
||||
}
|
||||
</script>
|
||||
<div id="times-div-Default_suite">
|
||||
</div> <!-- times-div-Default_suite -->
|
||||
</div> <!-- times-div -->
|
||||
</div> <!-- main-panel-content rounded-window-bottom -->
|
||||
</div> <!-- panel -->
|
||||
<div panel-name="reporter-Default_suite" class="panel">
|
||||
<div class="main-panel-header rounded-window-top">
|
||||
<span class="header-content">Reporter output for Default suite</span>
|
||||
</div> <!-- main-panel-header rounded-window-top -->
|
||||
<div class="main-panel-content rounded-window-bottom">
|
||||
</div> <!-- main-panel-content rounded-window-bottom -->
|
||||
</div> <!-- panel -->
|
||||
<div panel-name="ignored-methods-Default_suite" class="panel">
|
||||
<div class="main-panel-header rounded-window-top">
|
||||
<span class="header-content">0 ignored methods</span>
|
||||
</div> <!-- main-panel-header rounded-window-top -->
|
||||
<div class="main-panel-content rounded-window-bottom">
|
||||
</div> <!-- main-panel-content rounded-window-bottom -->
|
||||
</div> <!-- panel -->
|
||||
<div panel-name="chronological-Default_suite" class="panel">
|
||||
<div class="main-panel-header rounded-window-top">
|
||||
<span class="header-content">Methods in chronological order</span>
|
||||
</div> <!-- main-panel-header rounded-window-top -->
|
||||
<div class="main-panel-content rounded-window-bottom">
|
||||
</div> <!-- main-panel-content rounded-window-bottom -->
|
||||
</div> <!-- panel -->
|
||||
</div> <!-- main-panel-root -->
|
||||
</div> <!-- wrapper -->
|
||||
</body>
|
||||
</html>
|
||||
4
test-output/jquery-1.7.1.min.js
vendored
Normal file
4
test-output/jquery-1.7.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
test-output/navigator-bullet.png
Normal file
BIN
test-output/navigator-bullet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 352 B |
1
test-output/old/Default suite/Default test.properties
Normal file
1
test-output/old/Default suite/Default test.properties
Normal file
|
|
@ -0,0 +1 @@
|
|||
[SuiteResult context=Default test]
|
||||
6
test-output/old/Default suite/classes.html
Normal file
6
test-output/old/Default suite/classes.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<table border='1'>
|
||||
<tr>
|
||||
<th>Class name</th>
|
||||
<th>Method name</th>
|
||||
<th>Groups</th>
|
||||
</tr></table>
|
||||
1
test-output/old/Default suite/groups.html
Normal file
1
test-output/old/Default suite/groups.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<h2>Groups used for this test run</h2>
|
||||
6
test-output/old/Default suite/index.html
Normal file
6
test-output/old/Default suite/index.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<html><head><title>Results for Default suite</title></head>
|
||||
<frameset cols="26%,74%">
|
||||
<frame src="toc.html" name="navFrame">
|
||||
<frame src="main.html" name="mainFrame">
|
||||
</frameset>
|
||||
</html>
|
||||
2
test-output/old/Default suite/main.html
Normal file
2
test-output/old/Default suite/main.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<html><head><title>Results for Default suite</title></head>
|
||||
<body>Select a result on the left-hand pane.</body></html>
|
||||
2
test-output/old/Default suite/methods-alphabetical.html
Normal file
2
test-output/old/Default suite/methods-alphabetical.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<h2>Methods run, sorted chronologically</h2><h3>>> means before, << means after</h3><p/><br/><em>Default suite</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
|
||||
</table>
|
||||
2
test-output/old/Default suite/methods-not-run.html
Normal file
2
test-output/old/Default suite/methods-not-run.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<h2>Methods that were not run</h2><table>
|
||||
</table>
|
||||
2
test-output/old/Default suite/methods.html
Normal file
2
test-output/old/Default suite/methods.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<h2>Methods run, sorted chronologically</h2><h3>>> means before, << means after</h3><p/><br/><em>Default suite</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
|
||||
</table>
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue