Original post

Today i release 1.0.0-beta version of at2k – project for manage and run acceptance tests.

It allows you write something like this

BEGIN
    createUserResponse = CREATE USER {"name": "Jim"}

    ASSERT createUserResponse.status EQUALS ok

    userResponse = GET USER ${createUserResponse.hash}

    ASSERT userResponse.status EQUALS ok
    ASSERT userResponse.data.name EQUALS Jim
    ASSERT userResponse.data.hash EQUALS ${createUserResponse.hash}
END

BEGIN
    getNotExistsUserResponse = GET USER not-exists-hash

    ASSERT getNotExistsUserResponse.status EQUALS error
    ASSERT getNotExistsUserResponse.data EQUALS user-not-found
END

To test code like this

users.get('/:hash', (req, res) => {
    const user = usersRepository.find(u => u.hash === req.params.hash);

    if (user) {
        res.status(200).send({
            status: 'ok',
            data: user
        });
    } else {
        res.status(200).send({
            status: 'error',
            data: 'user-not-found'
        });
    }
});

users.post('/', (req, res) => {
    const { name } = req.body;
    const hash = uuid4();

    usersRepository.push({
        hash, name
    });
    res.status(200).send({status: 'ok', hash});
});

I’m quite new in releasing projects (and posting on reddit ;-)). Feel free to review code or write comments here – I’ll be glad to get feedback)

P.S. Web version is available here. Please, don’t overuse it, because server hasn’t have enough of resources to handle “loads” of requests