Skip to content

Commit

Permalink
2021 snapshot (#11)
Browse files Browse the repository at this point in the history
- add file dialog to report and data
- sequential estress, todo: parallel mode
- report name, todo: parallel mode
- refactor, icon, log; todo: http refactor
- http refactor, sequential mode; todo: parallel mode
- parallel mode, todo: data rows
- refactor, issues, export, charts, log
  • Loading branch information
jrichardsz committed Jan 21, 2021
1 parent 1700d16 commit 11ede45
Show file tree
Hide file tree
Showing 64 changed files with 2,844 additions and 1,644 deletions.
72 changes: 64 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 5 Minutes Stressor Tool
# Stressify

100% pure Java application designed to stress http endpoints and measure its performance in an easy way.
Basic http stressor tool focused on Rest Apis.

As its name says, you just need 5 minutes to get valuable information related to your APIs timing.
You just need 5 minutes to get valuable information related to your APIs timing.

![logo](./src/main/resources/edu/utec/tools/fiveminutestressor/ui/icon.png)
![logo](./src/main/resources/edu/utec/tools/stressify/ui/icon.png)

# Getting Started

Expand All @@ -18,13 +18,69 @@ What things you need to install the software and how to install them
java 1.7 or later
```

# Human mode
# Install

Follow this instructions ![readme for humans](./README_HUMANS.md)
- Download **stressify.jar** from [here](https://github.com/utec/stressify/releases)

# Developer mode

Follow this instructions ![readme for developers](./README_DEVELOPERS.md)
# Start

```
java -jar stressify.jar
```

# Usage

- File > New Project
- Select some method: get, post, put, delete, enter your url and headers like postman

![https://i.ibb.co/sHHztpP/stressify-headers.png](https://i.ibb.co/sHHztpP/stressify-headers.png)

- In the body tab, enter whatever you need but string
- In Assert Response Script tab, left empty or add something like this to ensure that exist a property in your json with **name** as key and **Duke** as value:

```
def status = jsonPath('$.name')
assertThat(status).isEqualTo('Duke')
```
- In settings you must select the report destination, report name and if you want charts:

![https://i.ibb.co/Tmh2hh5/stressify-settings.png](https://i.ibb.co/Tmh2hh5/stressify-settings.png)

- Finally enter the number of virtual users, select the stress mode(sequential/parallel) and press **Start Stress** button:

![https://i.ibb.co/Hq56pMx/stressify-run.png](https://i.ibb.co/Hq56pMx/stressify-run.png)

# Results

Every time you press the **Start Stress** button, you will have these files:

![https://i.ibb.co/1b2Ccvb/stressify-results.png](https://i.ibb.co/1b2Ccvb/stressify-results.png)

**csv** file will contain valuable data of the stress execution:

![https://i.ibb.co/Wn5Wp4k/stressify-csv-report.png](https://i.ibb.co/Wn5Wp4k/stressify-csv-report.png)


| field | description |
|-------|-------------|
| id | unique id of each http request |
| startDate | start date of http request |
| endDate | end date of http request |
| responseStatus | status of http request |
| totalExecutionMillisTime | how long did the http invocation take |
| log | message when an error is detected on each http invocation |

**log** file will contain the log of each request and or the errors. You can search here the id of some execution in the csv file

**png** file will contain a basic average chart (users vs response time). Red line is the real data and blue the average:

![https://i.ibb.co/f2XH6Wq/stressify-chart.png](https://i.ibb.co/f2XH6Wq/stressify-chart.png)

# Advanced usage

More complex settings and asserts are in the [wiki](https://github.com/utec/stressify/wiki)

## Versioning

Expand Down
125 changes: 0 additions & 125 deletions README_DEVELOPERS.md

This file was deleted.

17 changes: 0 additions & 17 deletions README_HUMANS.md

This file was deleted.

42 changes: 38 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,31 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.utec.tools</groupId>
<artifactId>5minutes-stressor-tool</artifactId>
<version>1.0.0</version>
<artifactId>stressify</artifactId>
<version>1.0.2</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<test.coverage.rate>100</test.coverage.rate>
<cobertura.version>2.7</cobertura.version>
<cobertura.skip>false</cobertura.skip>
<cobertura.skip>false</cobertura.skip>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<!-- <version>2.4.1</version> -->
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
Expand Down Expand Up @@ -52,7 +61,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
Expand Down Expand Up @@ -89,6 +98,31 @@
<artifactId>slf4j-nop</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.2</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.10.7</version>
</dependency>
</dependencies>

</project>
62 changes: 61 additions & 1 deletion src/main/java/edu/utec/common/csv/CSVUtil.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
package edu.utec.common.csv;

import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;

public class CSVUtil {

public String convertListMapToCsvString(List<HashMap<String, Object>> dataList,
String rowDelimiter, String columnDelimiter, List<String> headers) throws Exception {

StringBuilder sb = new StringBuilder();

for (int i = 0; i < dataList.size(); i++) {
HashMap<String, Object> rowMap = dataList.get(i);
if (rowMap != null && !rowMap.isEmpty()) {
String rowString = convertMapToStringWithOrder(rowMap, columnDelimiter, headers);
sb = sb.append(rowString);
if (i != dataList.size() - 1) {
sb.append(rowDelimiter);
}
}
}

String csvString = sb.toString();
if (csvString == null || csvString.isEmpty()) {
throw new Exception("csv generated is null or empty.");
}

return sb.toString();
}

public String convertDataListToCSVString(List<List<String>> dataList, String rowDelimiter,
String columnDelimiter) {
String columnDelimiter) {

StringBuilder sb = new StringBuilder();

Expand All @@ -32,4 +58,38 @@ public String convertListToString(List<String> incomingArray, String delimiter)
return sb.toString();
}

public String convertMapToStringWithOrder(HashMap<String, Object> incomingMap, String delimiter,
List<String> headers) {
StringBuilder sb = new StringBuilder();
int size = incomingMap.size();
int i = 0;

for (String headerName : headers) {
if (incomingMap.get(headerName) != null) {
sb = sb.append(incomingMap.get(headerName));
if (i != size - 1) {
sb.append(delimiter);
}
}
i++;
}

return sb.toString();
}

public String convertMapToString(HashMap<String, Object> incomingMap, String delimiter) {
StringBuilder sb = new StringBuilder();
int size = incomingMap.size();
int i = 0;
for (Entry<String, Object> entry : incomingMap.entrySet()) {
sb = sb.append(entry.getValue());
if (i != size - 1) {
sb.append(delimiter);
}
i++;
}

return sb.toString();
}

}
Loading

0 comments on commit 11ede45

Please sign in to comment.