Skip to content

Commit

Permalink
Merge branch 'master' into feat/integrate-with-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
agusaldasoro authored Jan 14, 2025
2 parents a6a5dff + a26598e commit ad59b44
Show file tree
Hide file tree
Showing 102 changed files with 1,976 additions and 222 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ on:
# - "**"

env:
evomaster-version: 3.3.1
evomaster-version: 3.4.1
# Unfortunately, to use JPackage we need JDK 17 or above :(
# Which is really bad due to the madness of --add-opens.
# Even if hunt down all cases of reflections in EM, there is still the problem of
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- "v*"

env:
evomaster-version: 3.3.1
evomaster-version: 3.4.1
jdk-jar: 1.8
jdk-jpackage: 21
retention-days: 1
Expand Down
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,23 @@ _EvoMaster_ uses several kinds of AI heuristics to improve performance even furt
building on decades of research in the field of [Search-Based Software Testing](https://en.wikipedia.org/wiki/Search-based_software_engineering).


__Key features__:
### 1-Minute Example

On a console, copy&paste the following (requires _Docker_ installed).
It will fuzz the PetClinic example API from Swagger, for 30 seconds.

```
docker run -v "$(pwd)/generated_tests":/generated_tests webfuzzing/evomaster --blackBox true --maxTime 30s --ratePerMinute 60 --bbSwaggerUrl https://petstore.swagger.io/v2/swagger.json
```
Note, if run in a MSYS shell on Windows like _Git Bash_, there is the need of an extra / before the $ (as in the following video).


![](docs/img/evomaster_docker_use.gif)

Once the command is executed, you can inspect the generated files under `generated_tests` folder.


### Key features

* _Web APIs_: At the moment, _EvoMaster_ can generate test cases for __REST__, __GraphQL__ and __RPC__ (e.g., __gRPC__ and __Thrift__) APIs.

Expand All @@ -54,6 +70,10 @@ __Key features__:
If that is going to be higher than your current version of the JVM, if you cannot upgrade or have 2 different JDKs on your machine, then you should not use the uber-jar but rather one of the installers.
When you use one of the installers, keep in mind that currently they do not update the `PATH` variable. This needs to be done manually, [see documentation](docs/download.md).

* _Docker_: _EvoMaster_ is now released via Docker as well, under [webfuzzing/evomaster](https://hub.docker.com/r/webfuzzing/evomaster) on Docker Hub. For more information on how to use _EvoMaster_ via Docker, [see documentation](docs/docker.md).

* _GitHub Action_: it is possible to run _EvoMaster_ in GitHub Actions, as part of Continuous Integration, by using the [following custom action](https://github.com/WebFuzzing/evomaster-action) (which is in a different GitHub repository).

* _State-of-the-art_: an [independent study (2022)](https://arxiv.org/abs/2204.08348), comparing 10 fuzzers on 20 RESTful APIs, shows that _EvoMaster_ gives the best results. Another [independent study (2024)](https://arxiv.org/abs/2410.12547) done by a different research group confirms these results.

* _Schema_: REST APIs must provide a schema in [OpenAPI/Swagger](https://swagger.io)
Expand Down Expand Up @@ -83,7 +103,7 @@ __Key features__:
Besides using fixed HTTP headers,
it is also possible to declaratively specify which login endpoint should be used to dynamically obtain authentication info (e.g., auth tokens or cookies) for each test execution. [See documentation](docs/auth.md).

__Known limitations__:
### Known Limitations

* _Driver_: to be used for _white-box_ testing, users need to write a [driver manually](docs/write_driver.md).
We recommend to try _black-box_ mode first (should just need a few minutes to get it up and running) to get
Expand Down Expand Up @@ -145,6 +165,8 @@ Example of Fortune 500 companies using _EvoMaster_ are:

* [Short presentation](https://youtu.be/iQSAlrr-PZo) (5 minutes) about version 2.0.0.

* [Demonstration of Docker and GitHub Actions support](https://youtu.be/l1ybs7SjvcA).

### Alternatives

In the last few years, several few tools have been proposed in the academic literature and in the open-source community.
Expand Down Expand Up @@ -212,6 +234,7 @@ Otherwise, if you are working in industry on closed-source APIs, we have options
* [Technical notes for developers contributing to EvoMaster](docs/for_developers.md)
* Troubleshooting
* [Windows and networking](docs/troubleshooting/windows.md)
* [java.lang.OutOfMemoryError](docs/troubleshooting/outofmemory.md)
* More Info
* [Academic papers related to EvoMaster](docs/publications.md)
* [Slides of presentations/seminars](docs/presentations.md)
Expand Down
2 changes: 1 addition & 1 deletion client-java/ci-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>evomaster-client-java</artifactId>
<groupId>org.evomaster</groupId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<artifactId>evomaster-ci-utils</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client-java/client-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<artifactId>evomaster-client-java-util</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client-java/controller-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<artifactId>evomaster-client-java-controller-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client-java/controller/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<artifactId>evomaster-client-java-controller</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client-java/dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<groupId>org.evomaster</groupId>
Expand Down
2 changes: 1 addition & 1 deletion client-java/distance-heuristics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<artifactId>evomaster-client-java-distance-heuristics</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.evomaster.client.java.distance.heuristics;

import java.util.Arrays;

public class TruthnessUtils {

/**
Expand All @@ -13,7 +15,7 @@ public static double normalizeValue(double v) {
throw new IllegalArgumentException("Negative value: " + v);
}

if(Double.isInfinite(v) || v == Double.MAX_VALUE){
if (Double.isInfinite(v) || v == Double.MAX_VALUE) {
return 1d;
}

Expand All @@ -26,7 +28,6 @@ public static double normalizeValue(double v) {
}



public static Truthness getEqualityTruthness(int a, int b) {
double distance = DistanceHelper.getDistanceToEquality(a, b);
double normalizedDistance = normalizeValue(distance);
Expand All @@ -45,6 +46,15 @@ public static Truthness getEqualityTruthness(long a, long b) {
);
}


public static Truthness getLessThanTruthness(double a, double b) {
double distance = DistanceHelper.getDistanceToEquality(a, b);
return new Truthness(
a < b ? 1d : 1d / (1.1d + distance),
a >= b ? 1d : 1d / (1.1d + distance)
);
}

public static Truthness getLessThanTruthness(long a, long b) {
double distance = DistanceHelper.getDistanceToEquality(a, b);
return new Truthness(
Expand Down Expand Up @@ -79,4 +89,58 @@ public static Truthness getTruthnessToEmpty(int len) {
}
return t;
}

public static Truthness buildAndAggregationTruthness(Truthness... truthnesses) {
double averageOfTrue = averageOfTrue(truthnesses);
double falseOrAverageFalse = falseOrAverageFalse(truthnesses);
return new Truthness(averageOfTrue, falseOrAverageFalse);
}

private static double averageOfTrue(Truthness... truthnesses) {
checkValidTruthnesses(truthnesses);
double[] getOfTrueValues = Arrays.stream(truthnesses).mapToDouble(Truthness::getOfTrue)
.toArray();
return average(getOfTrueValues);
}

private static void checkValidTruthnesses(Truthness[] truthnesses) {
if (truthnesses == null || truthnesses.length == 0 || Arrays.stream(truthnesses).anyMatch(e -> e == null)) {
throw new IllegalArgumentException("null or empty Truthness instance");
}
}

private static double average(double... values) {
if (values == null || values.length == 0) {
throw new IllegalArgumentException("null or empty values");
}
double total = 0.0;
for (double v : values) {
total += v;
}
return total / values.length;
}

private static double averageOfFalse(Truthness... truthnesses) {
checkValidTruthnesses(truthnesses);
double[] getOfFalseValues = Arrays.stream(truthnesses).mapToDouble(Truthness::getOfFalse)
.toArray();
return average(getOfFalseValues);
}

private static double falseOrAverageFalse(Truthness... truthnesses) {
checkValidTruthnesses(truthnesses);
if (Arrays.stream(truthnesses).anyMatch(t -> t.isFalse())) {
return 1.0d;
} else {
return averageOfFalse(truthnesses);
}
}

public static Truthness buildScaledTruthness(double base, double ofTrueToScale) {
final double scaledOfTrue = DistanceHelper.scaleHeuristicWithBase(ofTrueToScale, base);
final double ofFalse = 1.0d;
return new Truthness(scaledOfTrue, ofFalse);
}


}
2 changes: 1 addition & 1 deletion client-java/instrumentation-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<artifactId>evomaster-client-java-instrumentation-shared</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client-java/instrumentation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<artifactId>evomaster-client-java-instrumentation</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<groupId>org.evomaster</groupId>
Expand Down
2 changes: 1 addition & 1 deletion client-java/sql-dto/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<artifactId>evomaster-client-java-sql-dto</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client-java/sql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.1-SNAPSHOT</version>
</parent>

<artifactId>evomaster-client-java-sql</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public QueryResult(List<VariableDescriptor> variableDescriptorList) {
variableDescriptors.addAll(variableDescriptorList);
}



/**
* WARNING: Constructor only needed for testing
*
Expand Down Expand Up @@ -173,4 +175,17 @@ public QueryResultDto toDto(){

return dto;
}

/**
* Retrieves the table name of this queryResult.
*
* @return the table name of the first {@code VariableDescriptor} in the {@code variableDescriptors} list.
* @throws IllegalStateException if the {@code variableDescriptors} list is empty.
*/
public String getTableName() {
if (variableDescriptors.isEmpty()) {
throw new IllegalStateException("No variable descriptors found");
}
return variableDescriptors.get(0).getTableName();
}
}
Loading

0 comments on commit ad59b44

Please sign in to comment.