Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

JohanLorenzo/markdown-testfile-to-json

Repository files navigation

NPM version Build Status Dependency Status Coverage Status

A parser which transform manual tests in Mardown to JSON

As a command line tool

$ ./cli.js test-formated-file.md [test-formated-file2.md...]
$ npm install --global markdown-testfile-to-json
$ markdown-testfile-to-json --help

As a library

Install

$ npm install --save markdown-testfile-to-json

Usage

var markdownTestfileToJson = require('markdown-testfile-to-json');

markdownTestfileToJson([inputFile1, inputFile2]).then(function(testsuites) {
  // Do something with the testsuites
});

Syntax

General structure

# Suite Name

## product.app.test_case_id
`decorator`

Test instructions

Suite name

To be deprecated.

IDs

Valid IDs are lower case. Words are separated by either dots (.) or underscores (_). The recommended format is product.app.test_case_id

Valid
## fxos.sms.send_mms

Not valid
## fxos.sms.send_MMS
## fxos.sms.send-mms

Decorators

They are used to describe the test case right above it (no blank line in the middle). One decorator is recommended (but not mandatory): `bug n`, with n the bug number that introduced the feature on Bugzilla. You can also define the user story that introduced the feature on Aha: `story n`. You can choose to not activate a test with one of these decorator: `draft` `disabled` `xfail`. If none of these decorator is provided, the test will be considered active.

Valid
## fxos.sms.send_mms
`bug 1`

Not valid
## fxos.sms.send_mms

`bug 1`

## fxos.sms.send_mms
`disabled`

Suite matrices

You can specify a set of variable common to many test cases. By defining a markdown table. Put the table at the top of the file. For example:

# SMS suite

 | TMobile | Wi-FI | No Internet | 2G | 3G | Multiple SIMS | Reference Workload | AT&T | Automatic Download | Delivery Reports | Airplane Mode | Dual SIM priority | Multiple Recipient Thread |
:--                                      |:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:
fxos.sms.send_sms                        | x | x | x | x | x | x | x | x | x | x | x | x | x
fxos.sms.send_mms                        | x | x | x | x | x | x | x | x | x | x | x | x | x
fxos.sms.forward_sms                     |   |   | x |   |   |   |   | x |   |   |   |   |
fxos.sms.call_recipient                  |   |   | x |   |   |   |   | x |   |   |   |   |

## fxos.sms.send_sms
`bug 1`

Send a text message to another phone number.

## fxos.sms.send_mms
`bug 2`

Receive a text message from another phone number.

## fxos.sms.forward_sms
`bug 3`

Send an SMS you received to another contact.

## fxos.sms.call_recipient
`bug 4`

From a text conversation, perform a call to your contact.

Please note that the ID must be defined below

Test case matrices

A single test case can have multiple variables.

## fxos.sms.text_new_number
`bug 5`

Create a new text message and add the following recipients:

recipients   | should pass
----         | ----
123          | yes
+++          | no
contact name | yes

Output

Like mentioned in the name of the project, this parser returns a JSON ouput.

Suite matrix example

[{
  "name": "SMS suite",
  "testcases": [{
    "id": "fxos.sms.send_sms",
    "instructions": "Send a text message to another phone number.",
    "state": "active",
    "bug": 1,
    "variablesFromSuite": ["TMobile", "Wi-FI", "No Internet", "2G", "3G", "Multiple SIMS", "Reference Workload", "AT&T", "Automatic Download", "Delivery Reports", "Airplane Mode", "Dual SIM priority", "Multiple Recipient Thread"]
  }, {
    "id": "fxos.sms.send_mms",
    "instructions": "Receive a text message from another phone number.",
    "state": "active",
    "bug": 2,
    "variablesFromSuite": ["TMobile", "Wi-FI", "No Internet", "2G", "3G", "Multiple SIMS", "Reference Workload", "AT&T", "Automatic Download", "Delivery Reports", "Airplane Mode", "Dual SIM priority", "Multiple Recipient Thread"]
  }, {
    "id": "fxos.sms.forward_sms",
    "instructions": "Send an SMS you received to another contact.",
    "state": "active",
    "bug": 3,
    "variablesFromSuite": ["No Internet", "AT&T"]
  }, {
    "id": "fxos.sms.call_recipient",
    "instructions": "From a text conversation, perform a call to your contact.",
    "state": "active",
    "bug": 4,
    "variablesFromSuite": ["No Internet", "AT&T"]
  }]
}]

Test case matrix example

[{
  "name": "SMS suite",
  "testcases": [{
    "id": "fxos.sms.text_new_number",
    "instructions": "Create a new text message and add the following recipients:",
    "state": "active",
    "bug": 5,
    "variables": [{
      "recipients": "123",
      "should pass": "yes"
    }, {
      "recipients": "+++",
      "should pass": "no"
    }, {
      "recipients": "contact name",
      "should pass": "yes"
    }]
  }]
}]

License

MIT

About

A parser which transform manual tests in Mardown to JSON

Resources

Stars

Watchers

Forks

Packages

No packages published