It is a collection of utilities, to help test automation engineers avoid writing the same code over and over again. It is based on Junit 5 unit test framework.
You can add test-api to your maven pom.xml file using:
<dependency>
<groupId>co.verisoft</groupId>
<artifactId>test-api</artifactId>
<version>0.1.18</version>
</dependency>
Here are the list of features test-api currently has. You can see usage examples in the unit test area. Each of the features has unit test with simple explanations on how to use.
The store object is a thread safe mechanism for shared memory. It assists the developer in passing objects between classes, without coupling or building any connections between them. For instance, you can put an object in store in a Junit 5 extension and use it in your tests or other parts of your code. Example:
String storeExample = "Example";
StoreManager.getStore(StoreType.LOCAL_THREAD).putValueInStore("storeValue", name);
// The next line will put the string 'Example' in receiveName
String receivedName = StoreManager.getStore(StoreType.LOCAL_THREAD).getValueFromStore("storeValue");
A simple and easy way to add an extent report object to your
code, without having to write any initialization / evaluation
or packing code. You just add an extension, and all is done
for you. Just add @ExtentReport on top of the class and your'e done!
@ExtentReport
public class SomeTest {
@Test
public void shouldDoSomething() {
// Write test code here
}
}
Add logging mechanism for test life-cycle.
The Jira x-ray features creates a JSON object during the test process, which contains the test information
There are so many places to report to - logs, functional report, internal report server, external report server. Instead of writing each report seperately, the report observer writes a report once and each report client easily impelments its own integration.
-
During tests, page objects or any other class, whenever you need to write a report, use the
Reportobject. For example:
Report.report(ReportSource.REPORT, ReportLevel.TRACE, "This is a report message");
or simplyReport.report("This is a report message"); -
Implement an observer class, and use the
updatemethod to decide what to do when theReportobject is written and published:public class SampleObserver extends BaseObserver {
public SampleObserver() { super(); } @Override public void update(ReportEntry reportEntry) { System.out.println("SampleObserver data is " + reportEntry.toString()); }}
-
In this basic example,
Report.report("This is a report message");will be to the console