sangrahah

An annotated approach to building TestNG suites instead of working with xmls.

Лицензия

Лицензия

Группа

Группа

com.rationaleemotions
Идентификатор

Идентификатор

sangrahah
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

sangrahah
An annotated approach to building TestNG suites instead of working with xmls.
Ссылка на сайт

Ссылка на сайт

http://rationaleemotions.com
Система контроля версий

Система контроля версий

https://github.com/RationaleEmotions/sangrahah

Скачать sangrahah

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.rationaleemotions/sangrahah/ -->
<dependency>
    <groupId>com.rationaleemotions</groupId>
    <artifactId>sangrahah</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.rationaleemotions/sangrahah/
implementation 'com.rationaleemotions:sangrahah:1.0.0'
// https://jarcasting.com/artifacts/com.rationaleemotions/sangrahah/
implementation ("com.rationaleemotions:sangrahah:1.0.0")
'com.rationaleemotions:sangrahah:jar:1.0.0'
<dependency org="com.rationaleemotions" name="sangrahah" rev="1.0.0">
  <artifact name="sangrahah" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.rationaleemotions', module='sangrahah', version='1.0.0')
)
libraryDependencies += "com.rationaleemotions" % "sangrahah" % "1.0.0"
[com.rationaleemotions/sangrahah "1.0.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.testng : testng jar 7.1.0

test (1)

Идентификатор библиотеки Тип Версия
org.assertj : assertj-core jar 3.12.2

Модули Проекта

Данный проект не имеет модулей.

Sangrahah (means Collection).

This library is an answer to a TestNG defect.

Sangrahah lets you define a suite via a class using annotations as a means to creating an aggregation for execution.

Its similar to what already exists in JUnit.

Instead of creating a TestNG suite via an xml file, Sangrahah lets you define a suite file via a bunch of annotations.

Pre-requisites:

  • JDK8
  • TestNG 7.1.0 (or) higher.

To consume this library add the below as a maven dependency:

<dependency>
  <groupId>com.rationaleemotions</groupId>
  <artifactId>sangrahah</artifactId>
  <version>1.0.0</version>
</dependency>

Some examples are as below:

A simple example to start with

@XmlSuite(name = "Example_Suite",
    testClasses = {
        SampleTestCase.class,
        SampleTestCase2.class
    }
)
public class SuiteClass {
}

That's it. This class now doubles up as a full fledged TestNG suite xml. This class be directly executed via the surefire plugin (by configuring surefire plugin to pick up this class without a suite xml file)

An example of a suite file with detained class definitions.

import com.rationaleemotions.annotations.XmlSuite;
import com.rationaleemotions.annotations.internal.XmlClass;
import com.rationaleemotions.annotations.internal.XmlMethod;
import com.rationaleemotions.annotations.internal.XmlParameter;

@XmlSuite(name = "Example_Suite",
    classDefinitions = {
        @XmlClass(classToRun = SampleTestCase.class),
        @XmlClass(classToRun = SampleTestCase3.class,
            methods = {
                @XmlMethod(include = "anotherTestMethod",
                    parameters = {
                        @XmlParameter(name = "flag", value = "false")
                    }
                )
            }
        )
    }
)
public class SuiteClassWithClassDefinitions {

}

An example of a suite file with two different <test> tags.

import com.rationaleemotions.annotations.XmlSuite;
import com.rationaleemotions.annotations.internal.XmlTest;

@XmlSuite(name = "Example_Suite",
    tests = {
        @XmlTest(name = "Example_Test_One", testClasses = {
            SampleTestCase.class,
        }),
        @XmlTest(name = "Example_Test_Two", testClasses = {
            SampleTestCase2.class,
        })
    }
)
public class SuiteClassWithTwoTestTags {
}

An example of a suite with groups

import com.rationaleemotions.annotations.XmlSuite;
import com.rationaleemotions.annotations.internal.XmlGroup;
import com.rationaleemotions.annotations.internal.XmlRun;
import com.rationaleemotions.annotations.internal.XmlTest;

@XmlSuite(name = "Example_Suite",
    groups = @XmlGroup(
        run = @XmlRun(include = "run")
    ),
    tests = {
        @XmlTest(name = "Example_Test",
            testClasses = {
                SampleTestCase.class,
                SampleTestCase2.class
            }
        )
    }
)
public class SuiteClassWithGroupsAtSuiteLevel {

}

An example of a suite with group definitions

import com.rationaleemotions.annotations.XmlSuite;
import com.rationaleemotions.annotations.internal.XmlDefine;
import com.rationaleemotions.annotations.internal.XmlGroup;
import com.rationaleemotions.annotations.internal.XmlRun;
import com.rationaleemotions.annotations.internal.XmlTest;

@XmlSuite(name = "Example_Suite",
    tests = {
        @XmlTest(name = "Example_Test",
            groups = @XmlGroup(
                define = @XmlDefine(
                    name = "runtime",
                    include = "run"
                ),
                run = @XmlRun(
                    include = "runtime"
                )
            ),
            testClasses = {
                SampleTestCase.class,
                SampleTestCase2.class
            }
        )
    }
)
public class SuiteClassWithGroupsDefinitionSpecifiedAtTestTagLevel {

}

An example of specifying parameters at <suite> level

import com.rationaleemotions.annotations.XmlSuite;
import com.rationaleemotions.annotations.internal.XmlParameter;

@XmlSuite(
    name = "Example_Suite",
    parameters = {
        @XmlParameter(name = "age", value = "24")
    },
    testClasses = {SampleTestCase.class}
)
public class SuiteClassWithSuiteLevelParameters {

}

An example of specifying parameters at <test> level

import com.rationaleemotions.annotations.XmlSuite;
import com.rationaleemotions.annotations.internal.XmlParameter;
import com.rationaleemotions.annotations.internal.XmlTest;

@XmlSuite(
    name = "Example_Suite",
    tests = {
        @XmlTest(name = "Example_Test_Three",
            parameters = {
                @XmlParameter(name = "age", value = "24")
            },
            testClasses = {SampleTestCase.class}
        )
    }
)
public class SuiteClassWithTestTagLevelParameters {

}

An example of specifying parameters for individual classes

import com.rationaleemotions.annotations.XmlSuite;
import com.rationaleemotions.annotations.internal.XmlClass;
import com.rationaleemotions.annotations.internal.XmlParameter;
import com.rationaleemotions.annotations.internal.XmlTest;

@XmlSuite(
    name = "Example_Suite",
    tests = {
        @XmlTest(name = "Example_Test_One",
            classDefinitions = {
                @XmlClass(classToRun = SampleTestCase.class,
                    parameters = {
                        @XmlParameter(name = "age", value = "42")
                    }
                )
            }
        )
    }
)
public class SuiteClassWithClassLevelParameters {

}
com.rationaleemotions

Rationale Emotions

This organization houses all the projects that are being built by @krmahadevan

Версии библиотеки

Версия
1.0.0