# Project Test Case Updated

## Getting Started

This page will help you with subscribing to the **project-test-case-updated** event.

This event can be used for the following:

* Get details for a retest round which was cancelled on a project, for which you have access to.

## Prerequisites

In order to subscribe to this event, you must have:

* Access to the project-test-case-updated event (see My Events to confirm).
* A working client (see Setting Up Your Client for details).
* Valid API Key (see Authentication for your key).
* Network access to your AttackForge Enterprise tenant.

## Subscribing To Event

* NodeJS
* Python
* .NET
* Java
* Go

### NodeJS

#### NodeJS Prerequisites

In order to subscribe to this event using the NodeJS client, you must have:

* NodeJS v10+ installed
* NPM installed
* A working NodeJS client (see Setting Up Your Client for details).

#### Client configuration

Open a terminal and navigate to the client directory.

From the client directory, run following command, substituting variables below with your configuration details:

{% code overflow="wrap" %}

```
$ TENANT="YOUR-AFE-TENANT" EVENTS="project-test-case-updated" X_SSAPI_KEY="YOUR-API-KEY" node .
```

{% endcode %}

An example is included below for reference:

{% code overflow="wrap" %}

```
$ TENANT="https://demo.attackforge.com" EVENTS="project-test-case-updated" X_SSAPI_KEY="<API-KEY>" node .
```

{% endcode %}

If your client is successfully subscribed to this event, you should see similar output in your terminal:

{% code overflow="wrap" %}

```
Subscribed to the following events: [ 'project-test-case-updated' ]
```

{% endcode %}

Your client is now working and you will see new events output to the terminal as they are pushed from AttackForge.

You can now work on your integration code to start actioning these events. Open **index.js** with a text editor - the file is located in your client directory. Your code will replace the following section within this file:

```
/* ENTER YOUR INTEGRATION CODE HERE */
/* method contains the event type e.g. project-test-case-updated */
/* params contains the event body e.g. JSON object with timestamp & details */
```

### Python

#### Python Prerequisites

In order to subscribe to this event using the Python client, you must have:

* Python3 installed
* PIP installed
* A working Python client (see Setting Up Your Client for details).

#### Client configuration

Open a terminal and navigate to the client directory.

From the client directory, run following command, substituting variables below with your configuration details:

{% code overflow="wrap" %}

```
$ HOSTNAME="YOUR-AFE-HOSTNAME" EVENTS="project-test-case-updated" X_SSAPI_KEY="YOUR-API-KEY" python3 main.py
```

{% endcode %}

An example is included below for reference:

{% code overflow="wrap" %}

```
$ HOSTNAME="demo.attackforge.com" EVENTS="project-test-case-updated" X_SSAPI_KEY="<API-KEY>" python3 main.py
```

{% endcode %}

If your client is successfully subscribed to the events, you should see similar output in your terminal:

```
Subscribed to the following events: [ 'project-test-case-updated' ]
```

Your client is now working and you will see new events output to the terminal as they are pushed from AttackForge.

You can now work on your integration code to start actioning these events. Open **main.py** with a text editor - the file is located in your client directory. Your code will replace the following section within this file:

```
# ENTER YOUR INTEGRATION CODE HERE
# method contains the event type e.g. project-test-case-updated
# params contains the event body e.g. JSON object with timestamp & details
```

### .NET

#### .NET Prerequisites

In order to subscribe to this event using the .NET client, you must have:

* .NET 5.0 SDK installed
* A working .NET client (see [Setting Up Your Client](https://localhost:3000/#!/app/ss/event-getting-started#setting-up) for details).

#### Client configuration

Open a terminal and navigate to the client directory.

From the client directory, run following command, substituting variables below with your configuration details:

{% code overflow="wrap" %}

```
$ HOSTNAME="YOUR-AFE-HOSTNAME" EVENTS="project-test-case-updated" X_SSAPI_KEY="YOUR-API-KEY" dotnet run
```

{% endcode %}

An example is included below for reference:

{% code overflow="wrap" %}

```
$ HOSTNAME="demo.attackforge.com" EVENTS="project-test-case-updated" X_SSAPI_KEY="<API-KEY>" dotnet run
```

{% endcode %}

If your client is successfully subscribed to the events, you should see similar output in your terminal:

```
Subscribed to the following events: [ 'project-test-case-updated' ]
```

Your client is now working and you will see new events output to the terminal as they are pushed from AttackForge.

You can now work on your integration code to start actioning these events. Open **Program.cs** with a text editor from your client directory. Your code will replace the following section within this file:

```
/* ENTER YOUR INTEGRATION CODE HERE */
/* method contains the event type e.g. project-test-case-updated */
/* params contains the event body e.g. JSON object with timestamp & details */
```

### Java

#### Java Prerequisites

In order to subscribe to this event using the Java client, you must have:

* OpenJDK 11 installed
* Maven installed
* A working Java client (see Setting Up Your Client for details).

#### Client configuration

Open a terminal and navigate to the client directory.

From the client directory, run following command, substituting variables below with your configuration details:

{% code overflow="wrap" %}

```
$ HOSTNAME="YOUR-AFE-HOSTNAME" EVENTS="project-test-case-updated" X_SSAPI_KEY="YOUR-API-KEY" java -jar target/afe-ssapi-events-java-client-1.0-SNAPSHOT-jar-with-dependencies.jar
```

{% endcode %}

An example is included below for reference:

{% code overflow="wrap" %}

```
$ HOSTNAME="demo.attackforge.com" EVENTS="project-test-case-updated" X_SSAPI_KEY="<API-KEY>" java -jar target/afe-ssapi-events-java-client-1.0-SNAPSHOT-jar-with-dependencies.jar
```

{% endcode %}

If your client is successfully subscribed to the events, you should see similar output in your terminal:

```
Subscribed to the following events: [ 'project-test-case-updated' ]
```

Your client is now working and you will see new events output to the terminal as they are pushed from AttackForge.

You can now work on your integration code to start actioning these events. Open **./src/main/java/com/attackforge/App.java** with a text editor from your client directory. Your code will replace the following section within this file:

```
/* ENTER YOUR INTEGRATION CODE HERE */
/* method contains the event type e.g. project-test-case-updated */
/* params contains the event body e.g. JSON object with timestamp & details */
```

### Go

#### Go Prerequisites

In order to subscribe to this event using the Go client, you must have:

* Go installed
* A working Go client (see Setting Up Your Client for details).

#### Client configuration

Open a terminal and navigate to the client directory.

From the client directory, run following command, substituting variables below with your configuration details:

{% code overflow="wrap" %}

```
$ HOSTNAME="YOUR-AFE-HOSTNAME" EVENTS="project-test-case-updated" X_SSAPI_KEY="YOUR-API-KEY" ./afe-ssapi-events-go-client
```

{% endcode %}

An example is included below for reference:

{% code overflow="wrap" %}

```
$ HOSTNAME="demo.attackforge.com" EVENTS="project-test-case-updated" X_SSAPI_KEY="<API-KEY>" ./afe-ssapi-events-go-client
```

{% endcode %}

If your client is successfully subscribed to this event, you should see similar output in your terminal:

```
Subscribed to the following events: [ 'project-test-case-updated' ]
```

Your client is now working and you will see new events output to the terminal as they are pushed from AttackForge.

You can now work on your integration code to start actioning these events. Open **main.go** with a text editor from your client directory. Your code will replace the following section within this file:

```
/* ENTER YOUR INTEGRATION CODE HERE */
/* method contains the event type e.g. project-test-case-updated */
/* params contains the event body e.g. JSON object with timestamp & details */
```

## Example Response

The event emitted will include the following information:

```json
{
  "method": "project-test-case-updated",
  "params": {
    "timestamp": "2021-01-01T00:00:00.000Z",
    "user": {
      "user_id": "60d0fe4f5311236168a109ca"
    },
    "data": {
      "id": "60fe2f7747d2c400306bd809",
      "created": "2021-01-01T06:22:14.713Z",
      "modified": "2021-01-01T06:22:14.713Z",
      "is_deleted": false,
      "title": "Access Token Manipulation",
      "details": "Lorem ipsum...",
      "details_html": "&lt;p&gt;Lorem ipsum...&lt;/p&gt;",
      "code": "TEST_CASE_001",
      "tags": [
        "..."
      ],
      "execution_flow": [
        {
          "title": "...",
          "details": "Lorem ipsum...",
          "details_html": "&lt;p&gt;Lorem ipsum...&lt;/p&gt;"
        }
      ],
      "assigned_to": {
        "user_id": "60d59ce05e2fc4002e1a1b1a"
      },
      "status": "Testing In Progress",
      "outcome": "Passed",
      "assigned_assets": [
        "string"
      ],
      "locked": false,
      "project": {
        "project_id": "61959171af11f3003c31eb70"
      },
      "testsuite": {
        "testsuite_id": "65a346e3c00fa27054ac362b"
      },
      "user": {
        "user_id": "60d59ce05e2fc4002e1a1b1c"
      },
      "vulnerabilities": [
        {
          "vulnerability_id": "60fe2f7747d2c400306bd808"
        }
      ],
      "project_testcase_custom_fields": [
        {
          "key": "...",
          "value": "..."
        }
      ],
      "testcase_custom_fields": [
        {
          "key": "...",
          "value": "..."
        }
      ],
      "file": {
        "id": "60d59ce05e2fc4002f1f0b0d",
        "created": "",
        "file_name": "screenshot.png",
        "file_name_custom": "screenshot.png",
        "storage_name": "123hkjas...",
        "file_type": "image/png",
        "file_size_kb": 6480
      }
    }
  }
}
```
