Commit 02f8e8b4 authored by Benedetta Arena's avatar Benedetta Arena
Browse files

Merge branch 'develop' into 86-add-interoperability-test-cases

parents a3cbb850 e8203ed6
Loading
Loading
Loading
Loading
+77 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<testcase id="Robot" xmlns="http://www.gitb.com/tdl/v1/" xmlns:gitb="http://www.gitb.com/core/v1/">
	<metadata>
 		<gitb:name>Robot Tests</gitb:name>
		<gitb:version>1.0</gitb:version>
		<gitb:description>Run ETSI NGSI-LD Robot Tests</gitb:description>
	</metadata>
    <imports>
        <artifact type="binary" encoding="UTF-8" name="freemarkerTemplateFile">ITBTestCases/resources/template.json</artifact>
    </imports>
	<actors>
		<gitb:actor id="ITB" name="ITB" role="SUT"/>
		<gitb:actor id="RobotTestsAPI" name="RobotTestsAPI" role="SIMULATED"/>
	</actors>
	<steps logLevel="DEBUG">
    
        <assign to="parameters{testFolder}">$SYSTEM{testFolder}</assign>
        <assign to="parameters{testName}">$SYSTEM{testName}</assign>
        <assign to="parameters{exclude}">$SYSTEM{exclude}</assign>

        <assign to="parameters{url}">$SYSTEM{endpointAddress}</assign>
        <assign to="parameters{temporalApiUrl}">$SYSTEM{temporalApiUrl}</assign>
        <assign to="parameters{ngsildTestSuiteContext}">$SYSTEM{ngsildTestSuiteContext}</assign>
        <assign to="parameters{notificationServerHost}">$SYSTEM{notificationServerHost}</assign>
        <assign to="parameters{notificationServerPort}">$SYSTEM{notificationServerPort}</assign>
        <assign to="parameters{mqttBrokerHost}">$SYSTEM{mqttBrokerHost}</assign>
        <assign to="parameters{mqttBrokerNonDefaultPort}">$SYSTEM{mqttBrokerNonDefaultPort}</assign>
        <assign to="parameters{contextSourceHost}">$SYSTEM{contextSourceHost}</assign>
        <assign to="parameters{contextSourcePort}">$SYSTEM{contextSourcePort}</assign>
        <assign to="parameters{contextServerHost}">$SYSTEM{contextServerHost}</assign>
        <assign to="parameters{contextServerPort}">$SYSTEM{contextServerPort}</assign>
        <assign to="parameters{coreContext}">$SYSTEM{coreContext}</assign>
        <assign to="parameters{deleteTemporalOnCoreDelete}">$SYSTEM{deleteTemporalOnCoreDelete}</assign>
        
        <assign to="params{Content-Type}">'application/json'</assign>
    
        <process output="body" handler="TemplateProcessor">
            <input name="parameters">$parameters</input>
            <input name="template">$freemarkerTemplateFile</input>
            <input name="syntax">'freemarker'</input>
        </process>
        
        <send id="test" desc="call the API" from="ITB" to="RobotTestsAPI" handler="HttpMessagingV2">
            <input name="method">"POST"</input>
            <input name="uri">"http://robot-processing:8080/api/run-test"</input>
            <input name="headers">$params</input>
            <input name="body">$body</input>
        </send>

        <bptxn txnId="t1" handler="https://www.itb.ec.europa.eu/zip/api/processing?wsdl"/>

            <process txnId="t1" id="unzip" operation="initialize">
                <input name="zip">$test{response}{body}</input>
            </process>

            <process txnId="t1" output="report" operation="extract">
                <input name="path">'report.html'</input>
            </process>

            <process txnId="t1" output="log" operation="extract">
                <input name="path">'log.html'</input>
            </process>

        <eptxn txnId="t1"/>

        <assign to="display{report}">$report{entry}{0}{content}</assign>
        <assign to="display{log}">$log{entry}{0}{content}</assign>
        <assign to="ctype{report}">'text/html'</assign>
        <assign to="ctype{log}">'text/html'</assign>

        <process desc="Download Robot report" hidden="false" handler="DisplayProcessor">
            <input name="parameters">$display</input>
            <input name="contentTypes">$ctype</input>
        </process>

	</steps>
</testcase>
 No newline at end of file
+21 −0
Original line number Diff line number Diff line
{
    "repoUrl": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite.git",
    "testFolder": "${testFolder}",
    "testName": "${testName}",
    "excludeOption": "${exclude}",
    "parameters": {
        "url": "${url}/ngsi-ld/v1",
        "temporal_api_url": "${temporalApiUrl}/ngsi-ld/v1",
        "ngsild_test_suite_context": "${ngsildTestSuiteContext}",
        "notification_server_host": "${notificationServerHost}",
        "notification_server_port": "${notificationServerPort}",
        "mqtt_broker_host": "${mqttBrokerHost}",
        "mqtt_broker_non_default_port": "${mqttBrokerNonDefaultPort}",
        "context_source_host": "${contextSourceHost}",
        "context_source_port": "${contextSourcePort}",
        "context_server_host": "${contextServerHost}",
        "context_server_port": "${contextServerPort}",
        "core_context": "${coreContext}",
        "delete_temporal_on_core_delete": "${deleteTemporalOnCoreDelete}"
    }
}
 No newline at end of file
+19 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<testsuite id="NGSI-LD Robot Tests" xmlns="http://www.gitb.com/tdl/v1/" xmlns:gitb="http://www.gitb.com/core/v1/">
	<metadata>
		<gitb:name>NGSI-LD</gitb:name>
		<gitb:description>Run Robot Tests</gitb:description>
		<gitb:version>1.0</gitb:version>
	</metadata>
	<actors>
		<gitb:actor id="ITB">
			<gitb:name>ITB</gitb:name>
			<gitb:desc>ITB send requests to the API calling Robot Tests</gitb:desc>
		</gitb:actor>
		<gitb:actor id="RobotTestsAPI">
			<gitb:name>RobotTestsAPI</gitb:name>
			<gitb:desc>The API runs the Robot Tests from the provided repository</gitb:desc>
		</gitb:actor>
	</actors>
	<testcase id="Robot"/>
</testsuite>
+18 −0
Original line number Diff line number Diff line
{
    "testName": "${testName}",
    "parameters": {
        "url": "${url}/ngsi-ld/v1",
        "temporal_api_url": "${temporalApiUrl}/ngsi-ld/v1",
        "ngsild_test_suite_context": "${ngsildTestSuiteContext}",
        "notification_server_host": "${notificationServerHost}",
        "notification_server_port": "${notificationServerPort}",
        "mqtt_broker_host": "${mqttBrokerHost}",
        "mqtt_broker_non_default_port": "${mqttBrokerNonDefaultPort}",
        "context_source_host": "${contextSourceHost}",
        "context_source_port": "${contextSourcePort}",
        "context_server_host": "${contextServerHost}",
        "context_server_port": "${contextServerPort}",
        "core_context": "${coreContext}",
        "delete_temporal_on_core_delete": "${deleteTemporalOnCoreDelete}"
    }
}
 No newline at end of file

itb/README.md

0 → 100644
+48 −0
Original line number Diff line number Diff line
# Run ITB locally with Robot testing service

This setup runs ITB + the side service to trigger Robot tests.
Preconfigured with sample Robot tests and MIM1 TDL tests for comparison.

### Start ITB
```cd itb```
```docker compose up --build```

This will run the 4 containers ITB needs (redis, srv, mysql and ui)

- itb-redis is a cache server used for user sessions management.
- itb-mysql is the Test Bed's database
- itb-srv is the Test Bed's backend test engine that executes tests.
- itb-ui is the Test Bed's frontend that users access.

This will also run a service named "robot-processing" which is the external service we developed for this project

Attach your context broker to the ITB network:
```docker network connect itb <broker_name>```

### Access ITB
The ITB UI is available at: http://localhost:9000

```docker logs -f <itb-uiHost:Port>```

In these logs you will find the password for a first connection, the username being by default "admin@itb"

### Import Test Suites

```curl -iX POST 'http://localhost:8080/api/init' -d '{}' -H 'Content-type: application/json'```

This will trigger the initialization of the external service.
This will git clone the ETSI NGSI-LD Robot Framework Test Suite.
From the test files, the service generate their ITB version and deploy them in ITB.

### Configure your SUT

From here, everything is preconfigured in ITB but the SUT configuration.
Community management -> Robot NGSI-LD Testing Community -> Robot NGSI-LD -> Context Broker

Provide the details of your system and to forget to add the endpoint of it going to Additional properties
Don't forget to save your modifications

### Run Tests
Manage tests -> "Robot NGSI-LD" 

Use the filters to find specific test cases
 No newline at end of file
Loading