4 releases

0.2.2 Apr 16, 2024
0.1.2 Dec 8, 2023
0.1.1 Dec 8, 2023
0.1.0 Dec 8, 2023

#230 in Testing

Download history 22/week @ 2024-02-25 56/week @ 2024-03-03 3/week @ 2024-03-10 13/week @ 2024-03-31 119/week @ 2024-04-14 2/week @ 2024-04-21

121 downloads per month


1.5K SLoC

Rust Slim - Slim server for Rust

Develop Slim Fixtures for rust applications. Based on the Slim Protocol of fitnesse fitnesse .

This is not 100% compliant with the slim protocol right now. Here are some of the features that are known to not be implemented:

It can only handle string symbols and it cannot. It does not support a SUT for features. It does not support Actors. It does not support using the STOUD and STDIN for comunication.

This is currently in an unstable version. The general API can change in the next versions.

For more details, take a look at the documentation


A (not yet complete) implementation of a SlimServer for acceptance testing.

This was implementating using the documentation found here

To add it to your project simply run:

cargo add rust_slim -F macros --dev

Then you need to create your fixtures. The recomended way of doing this is by using the #[fixture] macro. Here is an example:

use rust_slim::fixture;

pub struct Calculator {
    a: i64,
    b: i64,

impl Calculator {
    pub fn set_a(&mut self, a: i64) {
        self.a = a

    pub fn set_b(&mut self, b: i64) {
        self.b = b

    pub fn sum(&self) -> i64 {
        self.a + self.b

    pub fn mul(&self) -> i64 {
        self.a * self.b

    pub fn sub(&self) -> i64 {
        self.a - self.b

    pub fn div(&self) -> i64 {
        self.a / self.b

All methods that are public will be able to be called by the slim server.

Than, we need to add an entrypoint to the slim server so we can run it. There are lot of ways of doing this. One is by creating an example in your project.

So create and example file called calculator.rs and add this:

use rust_slim::SlimServer;
use std::net::TcpListener;
use anyhow::Result;
use std::env::args;

fn main() -> Result<()> {
    let port = args().skip(1).next().unwrap_or("8085".to_string());
    let listener = TcpListener::bind(format!("{port}").to_string()).expect("Error");
    let (stream, _) = listener.accept()?;
    let mut server = SlimServer::new(stream.try_clone()?, stream);

Than, to run it, you simply call cargo run --example calculator. Now you need to configure your test runner (fitnesse, temoc) to call your server


~32K SLoC