Giter Site home page Giter Site logo

gatling-interview-project's Introduction

Gatling Corp Scala interview project

Thank you for applying to Gatling Corp. We use these small exercises in our hiring process.

Please code as you would do in your everyday work. This code will be used to start a conversation about your practices.

Please do NOT fork this repository. You should use it as template (the green button) (GitHub documentation). Note: if you choose to make your repository private, add us as collaborators.

Getting started

Tools:

  • You need to install a JDK, version 8 or later (11 or 17 are fine too).
  • We recommend using IntelliJ IDEA (the free community edition is completely sufficient) as an editor. You will need to install IntelliJ's official Scala plugin.
  • We include the sbtx script which can be used to build, run, or execute tests (using the SBT build tool), so you don't need to install anything else. For instance, running ./sbtx "testOnly io.gatling.SanityCheckTest" in the project directory should successfully run this one test.
  • Note that your Scala code will be automatically formatted every time SBT compiles it.

If you are new to Scala, here are some resources to help get you started quickly:

There are of course plenty of other learning resources to be found on the web, these are merely suggestions.

Pure Scala

Create a "concat" method which takes 2 Option[String]s and concatenate their contents when both exist. A functional style is expected.

def concat(opt1: Option[String],
           opt2: Option[String]): Option[String] = ???

concat(Some("foo"), Some("bar")) // Some("foobar")
concat(Some("foo"), None)        // None
concat(None, Some("bar"))        // None
concat(None, None)               // None

You can solve this in the file src/test/scala/io/gatling/ConcatSpec.scala, and run it in IntelliJ, or in your console:

./sbtx "testOnly io.gatling.ConcatSpec"

Computer Database Webapp

The major library you'll need to use is cats effect. In this exercise, we'll use Smithy4s as well to generate the web server from documentation. New to effect systems? Take a look at this talk.

You can find here the basis of the project. Feel free to modify the architecture to your taste.

The goal of this part is to create a web app that stores and reads data about computers in a file.

A computer is represented by:

  • an id
  • a name
  • an optional introduced date
  • an optional discontinued date

Data is stored in the computers.json file at the root of the project directory.

Run the project

You can run the io.gatling.interview.Main class from IntelliJ, or in your console:

./sbtx run

This will start the web server on port 9000. You can visit localhost:9000. A swagger documentation is automatically added (thanks to smithy4s contracts)

Specifications

  • Add an endpoint to display a single computer (with the ID as parameter)
  • Add an endpoint to add a computer to the file (with the name and optional dates as parameters)

gatling-interview-project's People

Contributors

antoine-morisseau avatar

Watchers

 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.