ATS : Sending data to Test Explorer database

Introduction

We have listed here different REST calls which can be used to communicate with the HTTP DB Logger application which in turn will persist your events in a Test Explorer database.



Natural order of the events

It is important to state that by default the events have some ordering.

First you must have a Run, then you can have a Suite, then you can have a Testcase, then you can your messages logged in your Testcase.

An additional limitation is that you cannot have more than one opened Suites or Testcases.



Bypassing the natural order of the events

There is a way to bypass the natural order of the events. This is needed, for example, when your testing framework is capable of running many simultaneous tests.

All events support a parentId . The parentId tells the server the parent of this event. For example if you specify a parentId of a startTestcase event, then the server knows where to attach this new testcase. This way you can start many tests. Then your insertMessage events will provide a parentId which will point to the testcase(one of mant) they belong to. Finally the endTestcase event will provide a testcaseId , so the right testcase is closed.



Start a Run

startRun event is executed as the very first event. It initializes the database connection and start a new run and creates a new session at the server side.

body parameters description optional
dbHost DB host
dbName DB name
dbUser DB user
dbPassword DB password
runName Run name
productName Product name
versionName Product version
buildName Product build
osName OS
userNote Some note Y
timestamp Timestamp in ms Y

It returns the new session ID token in the response body. The session ID must be send back on every following request, so each new event is properly connected to same session.

It also returns the new runID



Start a Suite

startSuite event is executed when a number of similar tests are to started. In java world the SUITE corresponds to the java class which contains some tests


body parameters description optional
sessionId session id
timestamp time Y
suiteName Name of suite.
This could be a name of a java class

packageName

Domain of the suite.

This could be a java package


parentId DB ID of the parent RUN Y

It returns the new suiteID



Start a Testcase

startTestcase event says a test is to be started. In java world this is fired when the java test method is starting

body parameters description optional
sessionId session id
timestamp time Y
testcaseName Name of the testcase
scenarioName Name of the scenario
scenarioDescription Description
parentId DB ID of the parent SUITE Y

It returns the new testcaseID

Test Explorer make difference between test scenario and testcase

Scenario is the definition of the test. For example test1()

Testcase is one execution of the test. It could be the same as the scenario, but in some case you might executed same scenario many times. For example test1(FTP, 21, file1.txt), test1(HTTP, 80, file1.txt), test1(SFTP, 22, file1.txt) ...



Insert a message

insertMessage attaches a message usually to a Testcase, but potentially to a Run or a Suite as well

body parameters description optional
sessionId session id
timestamp time Y
message the message content
level

a log4j level:

TRACE|DEBUG|INFO|WARN|ERROR|FATAL


machineName The host this message is coming from
threadName The thread this message is coming from
parentID DB ID of the parent Y
parentType

If this message belongs to a RUN or SUITE or TESTCASE:

RUN|SUITE|TESTCASE

Y

The message may be attached to a RUN, a SUITE or a TESTCASE.

If you do not provide a parentId and parentType, the message will go to the currently opened RUN, SUITE or TESTCASE.

If you provide a parentId and parentType, the message will be attached to that parent.



Insert many messages at once

insertMessages attaches many message at once


body parameters description optional
sessionId session Id
timestamp time Y
parentID DB ID of the parent Y
parentType

If this message belongs to a RUN or SUITE or TESTCASE:

RUN|SUITE|TESTCASE

Y
messages array of messages - same format as when sending one message at a time



Attach a File

attachFile event allows you to attach a file to the current testcase or other ( pointed with the exact testcaseId ).

It is expected to use a multipart PUT.


End a Testcase

endTestcase event says if the test passed, failed or was skipped.

body parameters description optional
sessionId session Id
timestamp time Y
result

The result of the test execution

FAILED|PASSED|SKIPPED


testcaseId The id of the testcase to end Y

This closes the current testcase . If testcaseId is provided, then this is the testcase to close.


End a Suite

endSuite event closes the suite. In java world this event comes after the last test from a java class is completed

body parameters description optional
sessionId session Id
timestamp time Y
suiteId The id of the suite to end Y

This closes the current suite If suiteId is provided, then this is the suite to close.


End a Run

endRun is the last event. It ends the execution of the run.

body parameters description optional
sessionId session Id
timestamp time Y



Other not so often used events

Following is a list of events that are not used that much, but are considered as very useful at times



Update a Run

updateRun updates the current run with all data provided

body parameters description optional
sessionID session id
runName Run name Y
productName Product name Y
versionName Product version Y
buildName Product build Y
osName OS Y
userNote Some note Y



Add a Run meta information

It applies some key-value information to a Run.

The metainfo is intended to change the behavior of Test Explorer, but currently the only key that will affect the Test Explorer's work is the "type".

The significance of this event will probably grow in future.

body parameters description optional
sessionID session id
metaKey Name of meta key
metaValue Value of meta key

Insert a Run message

There are two ways to attach a message(s) to the level of a run by simply calling insertMessage or insertMessages events:

  • A message is attached to a RUN if currently a Run is started(and not a Suite or Testcase)
  • A message is attached to a RUN if parentType is set to " RUN " and parentId is set to point to the run's db id



Update a Suite

updateSuite updates the current suite with all data provided

If suiteId is provided, we point directly to the suite to update. Otherwise the current suite is updated.

body parameters description optional
sessionID session id
suiteId Suite id Y
suiteName Suite name Y
userNote Some note Y

Insert a Suite message

There are two ways to attach a message(s) to the level of a suite by simply calling insertMessage or insertMessages events:

  • A message is attached to a SUITE if currently a Suite is started(and not a Run or Testcase)
  • A message is attached to a SUITE if parentType is set to " SUITE " and parentId is set to point to the suites's db id



Add a Scenario meta information

It applies some key-value information to a Scenario.

The metainfo is intended to change the behavior of Test Explorer mainly in allowing to filter scenarios for some reporting purposes. The significance of this event will probably grow in future.

body parameters description optional
sessionID session id
metaKey Name of meta key
metaValue Value of meta key



Add a Testcase meta information

It applies some key-value information to a Testcase.

body parameters description optional
sessionID session id
metaKey Name of meta key
metaValue Value of meta key



Back to parent page

Go to Table of Contents