<commit_before># test-store [![Build Status](https://travis-ci.org/ybonjour/test-store.svg?branch=master)](https://travis-ci.org/ybonjour/test-store)
Stores your test results

## API Usage
### Creating a testsuite
**Request**
```
POST /testsuites
name=My Testsuite
```
**Response**
```
201 Created
{
    "id": "f6da9a37-d7e0-4cfb-b880-a99294c53709",
    "name": "My Testsuite"
}
```

### Store entire run with all results
**Request**
```
POST /testsuites/f6da9a37-d7e0-4cfb-b880-a99294c53709/runs
Content-Type: application/json

{
  "revision": "e46ed71567d5da172b00ece3efd7019aab51d756",
  "time": 1459588895366,
  "results": [
    {
      "testName": "ch.yvu.teststore.integration.insert.InsertControllerTest#canInsertRun",
      "retryNum": 0,
      "passed": true,
      "durationMillis": 1230
    }
  ]
}
```
**Response**
```
200 OK
```

### Create an empty run
**Request**
```
POST /testsuites/f6da9a37-d7e0-4cfb-b880-a99294c53709/runs
revision=e46ed71567d5da172b00ece3efd7019aab51d756
time=2016-04-03T01:30:00.001-0200
```
**Response**
```
201 Created
{
    "id": "1b48b134-bb93-4bcd-9c02-92dd83d89157",
    "testSuite": "f6da9a37-d7e0-4cfb-b880-a99294c53709",
    "revision": "e46ed71567d5da172b00ece3efd7019aab51d756",
    "time": 1459654200001
}
```

### Add results to run using JUnit XML format
**Request**
```
POST /runs/1b48b134-bb93-4bcd-9c02-92dd83d89157/results
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
    <testsuite errors="0" skipped="0" tests="1" failures="0" timestamp="2016-03-31T17:51:02">
        <testcase classname="ch.yvu.teststore.integration.insert.InsertControllerTest" name="canInsertRun" time="1.23"/>
    </testsuite>
</testsuites>
```
**Response**
```
200 OK
```
<commit_msg>Adds rough explanation of how to use the test-store gradle plugin<commit_after># test-store [![Build Status](https://travis-ci.org/ybonjour/test-store.svg?branch=master)](https://travis-ci.org/ybonjour/test-store)
Stores your test results

## API Usage
### Creating a testsuite
**Request**
```
POST /testsuites
name=My Testsuite
```
**Response**
```
201 Created
{
    "id": "f6da9a37-d7e0-4cfb-b880-a99294c53709",
    "name": "My Testsuite"
}
```

### Store entire run with all results
**Request**
```
POST /testsuites/f6da9a37-d7e0-4cfb-b880-a99294c53709/runs
Content-Type: application/json

{
  "revision": "e46ed71567d5da172b00ece3efd7019aab51d756",
  "time": 1459588895366,
  "results": [
    {
      "testName": "ch.yvu.teststore.integration.insert.InsertControllerTest#canInsertRun",
      "retryNum": 0,
      "passed": true,
      "durationMillis": 1230
    }
  ]
}
```
**Response**
```
200 OK
```

### Create an empty run
**Request**
```
POST /testsuites/f6da9a37-d7e0-4cfb-b880-a99294c53709/runs
revision=e46ed71567d5da172b00ece3efd7019aab51d756
time=2016-04-03T01:30:00.001-0200
```
**Response**
```
201 Created
{
    "id": "1b48b134-bb93-4bcd-9c02-92dd83d89157",
    "testSuite": "f6da9a37-d7e0-4cfb-b880-a99294c53709",
    "revision": "e46ed71567d5da172b00ece3efd7019aab51d756",
    "time": 1459654200001
}
```

### Add results to run using JUnit XML format
**Request**
```
POST /runs/1b48b134-bb93-4bcd-9c02-92dd83d89157/results
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
    <testsuite errors="0" skipped="0" tests="1" failures="0" timestamp="2016-03-31T17:51:02">
        <testcase classname="ch.yvu.teststore.integration.insert.InsertControllerTest" name="canInsertRun" time="1.23"/>
    </testsuite>
</testsuites>
```
**Response**
```
200 OK
```

## Use test-store with gradle and git

### Build the plugin
1. Clone the repository `git clone <EMAIL>:ybonjour/test-store`
2. Build the gradle-plugin `cd teststore/gradle-plugin; ../gradlew assemble`
3. Copy the created jar from `build/libs/teststore/gradle-plugin-0.1.jar` into your project (e.g. into the `libs` folder)


## Integrate the gradle plugin into your build
Adapt your build.gradle according to the following template

```
buildscript {
    repositories {
        mavenCentral()
        flatDir dirs: 'libs'
    }
    dependencies {
        classpath 'org.ajoberstar:grgit:1.1.0'
        classpath 'ch.yvu.teststore:gradle-plugin:0.1'
    }
}

teststore {
    host '<your test store host>'
    port  8080
    testSuite '<your test suite id>'
    revision "${->project.ext.revision}"
    xmlReports ~/.*\/test-results\/TEST-.*\.xml/
}
```

## Enjoy
Run `./gradlew storeResults` to store your test results once you have executed your tests.

{'fraction_non_alphanumeric': 0.1647450110864745, 'fraction_numerical': 0.12682926829268293, 'mean_word_length': 4.35748218527316, 'pattern_counts': {'":': 26, '<': 18, '<?xml version=': 2, '>': 19, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '579876', 'n_tokens_mistral': 2124, 'n_tokens_neox': 1762, 'n_words': 317}