Skip to content

Commit 862d0f8

Browse files
committed
Merge branch 'develop' into rpc-driver
# Conflicts: # .gitignore
2 parents be1bbaf + a32394b commit 862d0f8

1,711 files changed

Lines changed: 424966 additions & 6660 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ hs_err_pid*
134134
/jdk_8_maven/em/external/graphql/spring-petclinic-graphql/target/
135135
/jdk_8_maven/em/embedded/graphql/spring-petclinic-graphql/src/main/em/
136136
/jdk_8_maven/em/external/graphql/spring-petclinic-graphql/src/main/em/
137+
/jdk_8_maven/cs/graphql/graphql-ncs/target
138+
/jdk_8_maven/cs/graphql/graphql-scs/target
139+
/jdk_8_maven/em/embedded/graphql/graphql-ncs/target
140+
/jdk_8_maven/em/embedded/graphql/graphql-scs/target
141+
/jdk_8_maven/em/external/graphql/graphql-ncs/target
142+
/jdk_8_maven/em/external/graphql/graphql-scs/target
137143

138144
/jdk_11_maven/temp
139145
/jdk_11_maven/cs/rest/cwa-verification-server/target
@@ -146,6 +152,8 @@ hs_err_pid*
146152
/jdk_11_gradle/em/external/graphql/patio-api/build
147153

148154

155+
/jdk_8_maven/em/external/rest/restcountries/target/
156+
/jdk_8_maven/em/embedded/rest/restcountries/target/
149157

150158
### JavaScript
151159
/venv/
@@ -166,25 +174,29 @@ hs_err_pid*
166174
/js_npm/rest/disease-sh-api/build/
167175
/js_npm/rest/disease-sh-api/EvoMasterTest.js
168176
/js_npm/rest/disease-sh-api/redis/
169-
177+
/js_npm/rest/realworld-app/node_modules/
178+
/js_npm/rest/realworld-app/build/
179+
/js_npm/rest/spacex-api/node_modules/
180+
/js_npm/rest/spacex-api/build/
170181

171182

172183
#DotNet
173184
[Dd]ebug/
174185
[Bb]in/
175186
[Oo]bj/
176-
logs/
187+
dotnet_3/em/embedded/rest/SampleProjectDriver/logs/
177188
*.dll
178-
dotnet_3/*/Properties/
179189
.vscode/
190+
.vs/
180191
*.launchSettings.json
192+
*.sln.DotSettings.user
181193

182-
dotnet_3/em/embedded/rest/*/warning.html
183-
dotnet_3/cs/rest/Menu.API/Menu.API/packages.lock.json
184194

185-
*packages.lock.json
186-
*.sln.DotSettings.user
195+
# RPC
187196
/jdk_8_maven/cs/rpc/grpc/artificial/grpc-ncs/target/
188197
/jdk_8_maven/cs/rpc/grpc/artificial/grpc-scs/target/
189198
/jdk_8_maven/cs/rpc/thrift/artificial/thrift-scs/target/
190199
/jdk_8_maven/cs/rpc/thrift/artificial/thrift-ncs/target/
200+
201+
202+

README.md

Lines changed: 147 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,48 @@
11
# EMB
22
[EvoMaster](http://evomaster.org) Benchmark (EMB):
3-
a set of web/enterprise applications for experimentation in automated system testing.
4-
5-
__WARNING__: This repository is going through a major refactoring.
6-
Most of the documentation is still under construction.
7-
3+
a set of web/enterprise applications for scientific research in Software Engineering.
84

95
We collected several different systems, in different programming languages, like
106
Java, Kotlin, JavaScript and C#.
11-
We also added the drivers for EvoMaster to use those systems.
7+
In this documentation, we will refer to these projects as System Under Test (SUT).
8+
Currently, the SUTs are either _REST_ or _GraphQL_ APIs.
129

13-
Note that some of these open-source projects might be no longer supported, whereas others are still developed and updated.
14-
Once a system is added to EMB, we do not modify nor keep it updated with its current version under development.
15-
The reason is that we want to keep an easy to use, constant set of case studies for experimentation that can be reliably used throughout the years.
10+
For each SUT, we implemented _driver_ classes, which can programmatically _start_, _stop_ and _reset_ the state of SUT (e.g., data in SQL databases).
11+
As well as enable setting up different properties in a _uniform_ way, like choosing TCP port numbers for the HTTP servers.
12+
If a SUT uses any external services (e.g., a SQL database), these will be automatically started via Docker in these driver classes.
13+
14+
15+
This collection of SUTs was originally assembled for easing experimentation with the fuzzer called [EvoMaster](http://evomaster.org).
16+
However, finding this type of applications is not trivial among open-source projects.
17+
Furthermore, it is not simple to sort out all the technical details on how to set these applications up and start them in a simple, uniform approach.
18+
Therefore, this repository provides the important contribution of providing all these necessary scripts for researchers that need this kind of case study.
1619

1720

1821
## License
19-
All the code that is new for this repository is released under Apache 2.0 license.
22+
All the code that is new for this repository (e.g., the driver classes) is released under Apache 2.0 license.
2023
However, this repository contains as well sources from different open-source
2124
projects, each one with its own license, as clarified in more details beneath.
2225

26+
## Example
2327

28+
To see an example of using these drivers with EvoMaster to generate test cases, you can look at this [short video](https://youtu.be/3mYxjgnhLEo) (5 minutes).
29+
2430
## Current Case Studies
2531

32+
The projects were selected based on searches using keywords on GitHub APIs, using convenience sampling.
33+
Several SUTs were looked at, in which we discarded the ones that would not compile, would crash at startup, would use obscure/unpopular libraries with no documentation to get them started, are too trivial, student projects, etc.
34+
Where possible, we tried to prioritize/sort based on number of _stars_ on GitHub.
35+
36+
37+
Note that some of these open-source projects might be no longer supported, whereas others are still developed and updated.
38+
Once a system is added to EMB, we do not modify nor keep it updated with its current version under development.
39+
The reason is that we want to keep an easy to use, constant set of case studies for experimentation that can be reliably used throughout the years.
40+
41+
The SUTs called _NCS_ (Numerical Case Study) and _SCS_ (String Case study) are artificial, developed by us.
42+
They are based on numerical and string-based functions previously used in the literature of unit test generation.
43+
We just re-implemented in different languages, and put them behind a web service.
44+
45+
2646

2747
### REST: Java/Kotlin
2848

@@ -38,33 +58,111 @@ projects, each one with its own license, as clarified in more details beneath.
3858

3959
* News (LGPL), from [https://github.com/arcuri82/testing_security_development_enterprise_systems](https://github.com/arcuri82/testing_security_development_enterprise_systems)
4060

41-
* NCS (not-known license, artificial numerical examples coming from different sources)
42-
43-
* SCS (not-known license, artificial string examples coming from different sources)
44-
4561
* Restcountries (MPL), from [https://github.com/apilayer/restcountries](https://github.com/apilayer/restcountries)
4662

4763
* Languagetool (LGPL), from [https://github.com/languagetool-org/languagetool](https://github.com/languagetool-org/languagetool)
4864

4965
* CWA-Verification-Server (Apache), from [https://github.com/corona-warn-app/cwa-verification-server](https://github.com/corona-warn-app/cwa-verification-server)
5066

67+
* NCS (not-known license, artificial numerical examples coming from different sources)
68+
69+
* SCS (not-known license, artificial string examples coming from different sources)
70+
71+
5172
### REST: JavaScript/TypeScript
5273

5374
* Disease-sh-API (GPL), from [https://github.com/disease-sh/API](https://github.com/disease-sh/API)
5475

5576
* Cyclotron (MIT), from [https://github.com/ExpediaInceCommercePlatform/cyclotron](https://github.com/ExpediaInceCommercePlatform/cyclotron)
5677

78+
* SpaceX-API (Apache-2.0 License), from [https://github.com/r-spacex/SpaceX-API](https://github.com/r-spacex/SpaceX-API)
79+
80+
* Realworld-App (ISC), from [https://github.com/lujakob/nestjs-realworld-example-app](https://github.com/lujakob/nestjs-realworld-example-app)
81+
5782
* NCS (not-known license, artificial numerical examples coming from different sources)
58-
83+
5984
* SCS (not-known license, artificial string examples coming from different sources)
6085

61-
### REST: .Net/C#
86+
87+
### REST: .NET/C#
6288

6389
* Menu.API (not-known license), from [https://github.com/chayxana/Restaurant-App](https://github.com/chayxana/Restaurant-App)
6490

6591
* SampleProject (MIT), from [https://github.com/kgrzybek/sample-dotnet-core-cqrs-api](https://github.com/kgrzybek/sample-dotnet-core-cqrs-api)
6692

67-
* Library (not-known license), from [https://github.com/KevinDockx/DocumentingAspNetCoreApisWithOpenAPI](https://github.com/KevinDockx/DocumentingAspNetCoreApisWithOpenAPI)
93+
* NCS (not-known license, artificial numerical examples coming from different sources)
94+
95+
* SCS (not-known license, artificial string examples coming from different sources)
96+
97+
98+
### GraphQL: Java/Kotlin
99+
100+
* Spring-Pet-Clinic (Apache ), from [https://github.com/spring-petclinic/spring-petclinic-graphql]()
101+
102+
* Patio-Api (GPL), from [https://github.com/patio-team/patio-api]()
103+
104+
* Timbuctoo (GPL), from [https://github.com/HuygensING/timbuctoo]()
105+
106+
* NCS (not-known license, artificial numerical examples coming from different sources)
107+
108+
* SCS (not-known license, artificial string examples coming from different sources)
109+
110+
111+
## Using This Repository
112+
113+
Due to several reasons, the software in this repository is not published as a library (e.g., on Maven and NPM).
114+
To use EMB, you need to clone this repository:
115+
116+
```
117+
git clone https://github.com/EMResearch/EMB.git
118+
```
119+
120+
There are 2 main use cases for EMB:
121+
122+
* Run experiments with _EvoMaster_
123+
124+
* Run experiments with other tools
125+
126+
Everything can be setup by running the script `scripts/dist.py`.
127+
Note that you will need installed at least JDK 8, JDK 11, NPM and .NET 3.x, as well as Docker.
128+
Also, you will need to setup environment variables like `JAVA_HOME_8` and `JAVA_HOME_11`.
129+
The script will issue error messages if any prerequisite is missing.
130+
Once the script is completed, all the SUTs will be available under the `dist` folder, and a `dist.zip` will be created as well (if `scripts/dist.py` is run with `True` as input).
131+
132+
[//]: # (There is also a Docker file to run `dist.py`, named `build.dockerfile`.)
133+
134+
[//]: # (It can be built with:)
135+
136+
[//]: # ()
137+
[//]: # (```)
138+
139+
[//]: # (docker build -f build.dockerfile -t emb .)
140+
141+
[//]: # (```)
142+
143+
[//]: # ()
144+
[//]: # (The `dist` folder with all SUTs will be under `/emb/dist`. )
145+
146+
147+
148+
Note that here the drivers will be built as well besides the SUTs, and the SUT themselves will also have an instrumented version (for white-box testing heuristics) for _EvoMaster_ (this is for JavaScript and .NET, whereas instrumentation for JVM is done at runtime, via an attached JavaAgent).
149+
150+
In the built `dist` folder, the files will be organized as follows:
151+
152+
* For JVM: `<name>-sut.jar` will be the non-instrumented SUTs, whereas their executable drivers will be called `<name>-evomaster-runner.jar`.
153+
Instrumentation can be done at runtime by attaching the `evomaster-agent.jar` JavaAgent. If you are running experiments with EvoMaster, this will be automatically attached when running experiments with `exp.py` (available in the EvoMaster's repository). Or it can be attached manually with JVM option `-Devomaster.instrumentation.jar.path=evomaster-agent.jar` when starting the driver.
154+
* For NodeJS: under the folder `<name>` (for each NodeJS SUT), the SUT is available under `src`, whereas the instrumented version is under `build`.
155+
* For .NET: currently only the instrumented version is available (WORK IN PROGRESS)
156+
157+
Note: the building of .NET SUTs/drivers is disabled by default in `dist.py`.
158+
The reason is that, at the time of this writing, it is _very_ expensive to publish libraries on NuGet (due to the high costs of code certificates).
159+
The EM Driver library for .NET would have to be installed manually on local machine before any of the C# drivers can be used.
160+
161+
162+
163+
For running experiments with EvoMaster, you can also "start" each driver directly from an IDE (e.g., IntelliJ).
164+
Each of these drivers has a "main" method that is running a REST API (binding on default port 40100), where each operation (like start/stop/reset the SUT) can be called via an HTTP message by EvoMaster.
165+
For JavaScript, you need to use the files `em-main.js`.
68166

69167
### RPC (Thrift/gRPC): Java
70168

@@ -73,43 +171,37 @@ projects, each one with its own license, as clarified in more details beneath.
73171
* SCS (not-known license, artificial string examples coming from different sources)
74172

75173

76-
## Build The Systems
174+
You can also build (and install) each module separately, based on needs.
175+
For example, a Maven module can be installed with:
77176

78-
### Build JDK_8_MAVEN
177+
``mvn clean install -DskipTests``
79178

80-
The folder `cs` (*case study*) contains the source code of the different
81-
system under tests (SUT) in this benchmark, for JDK 8 and Maven.
179+
However, it is important to understand how this repository is structured, to be able to effectively navigate through it.
180+
Each folder represents a set of SUTs (and drivers) that can be built using the same tools.
181+
For example, the folder `jdk_8_maven` contains all the SUTs that need JDK 8 and are built with Maven.
182+
On the other hand, the SUTs in the folder `jdk_11_gradle` require JDK 11 and Gradle.
82183

83-
The folder `em` (*EvoMaster*) contains the classes needed to be written to enable
84-
the use of EvoMaster on the SUTs.
85-
In particular, there are `EmbeddedEvoMasterController` and
86-
`ExternalEvoMasterController` class implementations for each SUT.
87-
Note: usually you would write a EvoMaster controller class in the same module
88-
of the SUTs.
89-
Here, they are in different modules just to make clear what is needed to implement
90-
to enable the use of EvoMaster.
184+
For JVM and .NET, each module has 2 submodules, called `cs` (short for "Case Study") and `em` (short for "EvoMaster").
185+
`cs` contains all the source code of the different SUTs, whereas `em` contains all the drivers.
186+
Note: building a top-module will build as well all of its internal submodules.
91187

188+
Regarding JavaScript, unfortunately NodeJS does not have a good handling of multi-module projects.
189+
Each SUT has to be built separately.
190+
However, for each SUT, we put its source code under a folder called `src`, whereas all the code related to the drivers is under `em`.
92191

93-
To compile and generate all the jar files, use the command:
192+
The driver classes for Java and .NET are called `EmbeddedEvoMasterController`.
193+
For JavaScript, they are in a script file called `app-driver.js`.
194+
Note that Java also a different kind of driver called `ExternalEvoMasterController`.
195+
The difference is that in External the SUT is started on a separated process, and not running in the same JVM of the driver itself.
94196

95-
``mvn clean package -DskipTests``
96197

97-
Currently, all the case studies do require JDK __8__.
98-
They will not compile with a different version.
99198

100-
_Note_: the case studies do import EvoMaster as a library. Current SNAPSHOT
101-
versions of the case studies do use the most recent SNAPSHOT version of EvoMaster
102-
(the two versioning numbers are aligned).
103-
We do __NOT__ publish the SNAPSHOT dependencies online.
104-
This means that, if you try to build the project directly, it will fail due to
105-
missing SNAPSHOT dependencies.
199+
## Old Versions
106200

107-
To use such SNAPSHOT versions, you need first a `mvn install` of EvoMaster on your
108-
machine (so that the SNAPSHOT jars are created, and put under your `~/.m2` folder).
109-
However, in the Git repository of EMB, we did tag the versions of EMB that are
110-
using the published versions of EvoMaster.
201+
The release of EMB are linked in version number with the release of EvoMaster, as EvoMaster's libraries are used in the drivers (e.g., to clean databases and configure auth info).
202+
In the Git repository of EMB, we did tag the versions of EMB.
111203
See the [releases](https://github.com/EMResearch/EMB/releases) page.
112-
For example, to use version `X` of EvoMaster, you can check out the Git commit
204+
For example, to use version `X`, you can check out the Git commit
113205
of EMB tagged with version `X`.
114206
To see the current available tags, from a command-line you can execute:
115207

@@ -136,15 +228,20 @@ the following plugin dependency version:
136228
</plugin>
137229
```
138230

139-
Besides JDK 8, to build from Maven you will also need NPM and NodeJS installed
140-
on your machine (as some of the projects have GUIs built with JS).
141231

232+
### Build *develop* Branch
142233

143-
### Build DOTNET_3
234+
Branch *develop* is using the most recent SNAPSHOT version of _EvoMaster_.
235+
As that is not published online, you need to clone its repository, and build
236+
it locally (see its documentation on how to do it).
144237

145-
*Documentation under construction*
238+
To handle JavaScript, unfortunately there is the need for some manual settings.
239+
However, it needs to be done just once.
146240

241+
You need to create _symbolic_ link inside `EMB\js_npm` that points to the `evomaster-client-js` folder in _EvoMaster_.
242+
How to do this, depends on the Operating System.
243+
Note that in the following, `<some-path>` should be replaced with the actual real paths of where you cloned the _EvoMaster_ and _EMB_ repositories.
147244

148-
### Build JS_NPM
245+
Windows: `mklink /D C:\<some-path>\EMB\js_npm\evomaster-client-js C:\<some-path>\EvoMaster\client-js\evomaster-client-js`
149246

150-
*Documentation under construction*
247+
Mac: `ln -s /<some-path>/EvoMaster/client-js/evomaster-client-js /<some-path>/EMB/js_npm/evomaster-client-js`

build.dockerfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
### TODO currently not working
2+
3+
FROM python:3.10
4+
5+
RUN apt-get update
6+
RUN apt-get install -y software-properties-common
7+
8+
# https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/generic-linux-install.html
9+
RUN wget -O- https://apt.corretto.aws/corretto.key | apt-key add -
10+
RUN add-apt-repository 'deb https://apt.corretto.aws stable main'
11+
12+
#https://docs.microsoft.com/en-us/dotnet/core/install/linux-debian
13+
RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
14+
RUN dpkg -i packages-microsoft-prod.deb
15+
RUN rm packages-microsoft-prod.deb
16+
RUN apt-get install -y apt-transport-https
17+
18+
RUN apt-get update
19+
RUN apt-get install -y dotnet-sdk-3.1 maven java-1.8.0-amazon-corretto-jdk java-11-amazon-corretto-jdk
20+
#ca-certificates-java
21+
RUN apt-get clean
22+
#RUN update-ca-certificates -f
23+
24+
# https://github.com/nodesource/distributions/blob/master/README.md
25+
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
26+
RUN apt-get install -y nodejs
27+
28+
29+
ENV JAVA_HOME_8 /usr/lib/jvm/java-1.8.0-amazon-corretto
30+
RUN export JAVA_HOME_8
31+
ENV JAVA_HOME_11 /usr/lib/jvm/java-11-amazon-corretto
32+
RUN export JAVA_HOME_11
33+
34+
WORKDIR /emb
35+
36+
COPY dotnet_3 dotnet_3
37+
COPY jdk_8_maven jdk_8_maven
38+
COPY jdk_11_maven jdk_11_maven
39+
COPY jdk_11_gradle jdk_11_gradle
40+
COPY js_npm js_npm
41+
COPY scripts scripts
42+
43+
44+
### TODO
45+
### Currently failing due to SNAPSHOT dependencies and link to client-js.
46+
### Might try again once published .Net libs.
47+
### But, anyway, would not work on "develop" branch
48+
#RUN python3 scripts/dist.py
49+
50+
CMD ["bash"]
51+
52+
53+
# export DOCKER_BUILDKIT=0
54+
# docker build -f build.dockerfile -t emb .
55+
# docker run --entrypoint bash -it emb

0 commit comments

Comments
 (0)