All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.etlunit.util.TestSuite Maven / Gradle / Ivy

package org.etlunit.util;

import java.net.InetAddress;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

public class TestSuite
{
	private final String name;
	private long testTime = 0L;
	private int failures = 0;
	private int errors = 0;
	private List cases = new ArrayList();
	private final StringBuilder stdout = new StringBuilder();

	public TestSuite(String n)
	{
		name = n;
	}

	public String getName()
	{
		return name;
	}

	public Set getProperties()
	{
		return System.getProperties().entrySet();
	}

	public List getTestCases()
	{
		return cases;
	}

	public void addTestCase(TestCase casec)
	{
		testTime += casec.getTimeInMillis();

		if (casec.isFailure())
		{
			failures++;
		}
		else if (casec.isError())
		{
			errors++;
		}

		cases.add(casec);
	}

	public double getTestTime()
	{
		return testTime / 1000.0D;
	}

	public String getHostName() throws Exception
	{
		return InetAddress.getLocalHost().getHostAddress();
	}

	public int getErrors()
	{
		return errors;
	}

	public int getFailures()
	{
		return failures;
	}

	public String getTimestamp()
	{
		return new Timestamp(System.currentTimeMillis()).toString();
	}

	public StringBuilder getStdout()
	{
		return stdout;
	}

	public String getStdoutString()
	{
		return stdout.toString();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy