Coder Social home page Coder Social logo

claudiodelariva / emb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from webfuzzing/emb

0.0 0.0 0.0 150.86 MB

EvoMaster Benchmark (EMB): a set of web/enterprise applications for experimentation in automated system testing

License: Apache License 2.0

Shell 0.22% JavaScript 19.29% Ruby 0.01% Python 0.55% Perl 0.35% Java 64.72% R 0.01% C# 1.33% Kotlin 0.26% Awk 0.08% TypeScript 2.97% XSLT 0.08% CSS 0.71% TeX 0.01% Thrift 0.01% HTML 8.97% Smarty 0.01% Lex 0.01% Jupyter Notebook 0.40% Dockerfile 0.03%

emb's Introduction

EMB

DOI

EvoMaster Benchmark (EMB): a set of web/enterprise applications for scientific research in Software Engineering.

We collected several different systems, in different programming languages, like Java, Kotlin, JavaScript and C#. In this documentation, we will refer to these projects as System Under Test (SUT). Currently, the SUTs are either REST or GraphQL APIs.

For each SUT, we implemented driver classes, which can programmatically start, stop and reset the state of SUT (e.g., data in SQL databases). As well as enable setting up different properties in a uniform way, like choosing TCP port numbers for the HTTP servers. If a SUT uses any external services (e.g., a SQL database), these will be automatically started via Docker in these driver classes.

This collection of SUTs was originally assembled for easing experimentation with the fuzzer called EvoMaster. However, finding this type of applications is not trivial among open-source projects. 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. Therefore, this repository provides the important contribution of providing all these necessary scripts for researchers that need this kind of case study.

A video providing some high level overview of EMB can be found here.

EMB YouTube Video

License

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

Example

To see an example of using these drivers with EvoMaster to generate test cases, you can look at this short video (5 minutes).

Citation

If you are using EMB in an academic work, you can cite the following:

A. Arcuri, M. Zhang, A. Golmohammadi, A. Belhadi, J. P. Galeotti, B. Marculescu, S. Seran.
EMB: A Curated Corpus of Web/Enterprise Applications And Library Support for Software Testing Research.
In IEEE International Conference on Software Testing, Validation and Verification (ICST), 2023.

Current Case Studies

The projects were selected based on searches using keywords on GitHub APIs, using convenience sampling. 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. Where possible, we tried to prioritize/sort based on number of stars on GitHub.

Note that some of these open-source projects might be no longer supported, whereas others are still developed and updated. Once a system is added to EMB, we do not modify nor keep it updated with its current version under development. 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.

The SUTs called NCS (Numerical Case Study) and SCS (String Case study) are artificial, developed by us. They are based on numerical and string-based functions previously used in the literature of unit test generation. We just re-implemented in different languages, and put them behind a web service.

For the RESTful APIs, each API has an endpoint where the OpenAPI/Swagger schemas can be downloaded from. For simplicity, all schemas are also available as JSON/YML files under the folder openapi-swagger.

REST: Java/Kotlin

REST: JavaScript/TypeScript

REST: .NET/C#

GraphQL: Java/Kotlin

GraphQL: JavaScript/TypeScript

RPC (Thrift/gRPC): Java

  • NCS (not-known license, artificial numerical examples coming from different sources)

  • SCS (not-known license, artificial string examples coming from different sources)

Using This Repository

Due to several reasons, the software in this repository is not published as a library (e.g., on Maven and NPM). To use EMB, you need to clone this repository:

git clone https://github.com/EMResearch/EMB.git

There are 2 main use cases for EMB:

  • Run experiments with EvoMaster

  • Run experiments with other tools

Everything can be setup by running the script scripts/dist.py. Note that you will need installed at least JDK 8, JDK 11, NPM and .NET 3.x, as well as Docker. Also, you will need to setup environment variables like JAVA_HOME_8 and JAVA_HOME_11. The script will issue error messages if any prerequisite is missing. 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).

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).

In the built dist folder, the files will be organized as follows:

  • For JVM: <name>-sut.jar will be the non-instrumented SUTs, whereas their executable drivers will be called <name>-evomaster-runner.jar. 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.
  • For NodeJS: under the folder <name> (for each NodeJS SUT), the SUT is available under src, whereas the instrumented version is under instrumented. If the SUT is written in TypeScript, then the compiled version will be under build.
  • For .NET: currently only the instrumented version is available (WORK IN PROGRESS)

For running experiments with EvoMaster, you can also "start" each driver directly from an IDE (e.g., IntelliJ). 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. For JavaScript, you need to use the files em-main.js under the instrumented/em folders.

You can also build (and install) each module separately, based on needs. For example, a Maven module can be installed with:

mvn clean install -DskipTests

However, it is important to understand how this repository is structured, to be able to effectively navigate through it. Each folder represents a set of SUTs (and drivers) that can be built using the same tools. For example, the folder jdk_8_maven contains all the SUTs that need JDK 8 and are built with Maven. On the other hand, the SUTs in the folder jdk_11_gradle require JDK 11 and Gradle.

For JVM and .NET, each module has 2 submodules, called cs (short for "Case Study") and em (short for "EvoMaster"). cs contains all the source code of the different SUTs, whereas em contains all the drivers. Note: building a top-module will build as well all of its internal submodules.

Regarding JavaScript, unfortunately NodeJS does not have a good handling of multi-module projects. Each SUT has to be built separately. 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. Currently, both NodeJS 14 and 16 should work on these SUTs.

The driver classes for Java and .NET are called EmbeddedEvoMasterController. For JavaScript, they are in a script file called app-driver.js. Note that Java also a different kind of driver called ExternalEvoMasterController. 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.

Old Versions

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). In the Git repository of EMB, we did tag the versions of EMB. See the releases page. For example, to use version X, you can check out the Git commit of EMB tagged with version X. To see the current available tags, from a command-line you can execute:

git tag

Then, to switch to a specific tag X (e.g., v1.0.0), you can run:

git checkout tags/v1.0.0

Finally, if for any reason you need to switch back to the latest snapshot version, you can run:

git checkout master

There is an issue if you try to checkout an old version. Not only Java broke backward compatibility with JDK 9, but also Maven... If you try to build with Maven and get an error regarding maven-processor-plugin, you might have to add manually the following plugin dependency version:

<plugin>
    <groupId>org.bsc.maven</groupId>
    <artifactId>maven-processor-plugin</artifactId>
    <version>3.3.3</version>
</plugin>

Build develop Branch

Branch develop is using the most recent SNAPSHOT version of EvoMaster. As that is not published online, you need to clone its repository, and build it locally (see its documentation on how to do it).

To handle JavaScript, unfortunately there is the need for some manual settings. However, it needs to be done just once.

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

Windows: mklink /D C:\<some-path>\EMB\js_npm\evomaster-client-js C:\<some-path>\EvoMaster\client-js\evomaster-client-js

Mac: ln -s /<some-path>/EvoMaster/client-js/evomaster-client-js /<some-path>/EMB/js_npm/evomaster-client-js

emb's People

Contributors

arcuri82 avatar man-zhang avatar amidgol avatar asmab89 avatar jgaleotti avatar seran avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.