Skip to main content

Comparison

Tesmon harnesses the power of its custom language, TesmonLang, to facilitate test authoring. Built upon the foundations of YAML and Python, TesmonLang strikes a perfect balance between simplicity and power. This language empowers users to define tests with ease while offering the flexibility to incorporate dynamic behaviors through Python scripts.

With TesmonLang, you can seamlessly express your test scenarios using familiar YAML syntax while leveraging the robust capabilities of Python for advanced customization. This unique combination enables you to create tests that are both straightforward to write and capable of handling complex testing scenarios.

Test

A test in TesmonLang is the fundamental functional element and consists of a list of defined tasks executed sequentially. A test requires at least one task and can have multiple tasks.

drawing

Example code

tests:
test1:
tasks:
- ...
- ...

Test execution phases

A test has three execution phases: beforeAll, tests, and afterAll.

  • The beforeAll phase is executed before the tests in the test run. This phase can be used to set up the application state before running the tests.
  • The tests phase is where the actual tests are run.
  • The afterAll phase is executed after the tests in the test run. This phase can be used to reset or clean up the application state after running the tests.

drawing

Task

A task is a functional element that performs a specific action, such as making an HTTP request or running a query on a database. A task has several execution phases, including resource, beforeScript, action, validate, and afterScript.

Execution phases of a task

A task in TesmonLang has five execution phases: resources, beforeScript, action, validate, and afterScript.

  • resources phase is the first phase of the task execution and is used to establish a connection to a resource, such as a database or Kafka.
  • beforeScript phase is executed before the action in the task and is used to set up the state before the action is executed.
  • action phase is the actual action of the task, such as HTTP call or database query.
  • validate phase is executed after the action in the task and is used to validate the action output.
  • afterScript phase is executed after the action in the task and is used to set up the context for the next task.

drawing

Example code

tasks:
- beforeScript: ...
resource: ...
action: ...
afterScript: ...
validate: ...

📄️ Files

When using TesmonLang to make HTTP requests or to send messages with Kafka, you can include the content of a file as part of the request. This is particularly useful for dynamic data that changes frequently or for large data sets that are not practical to include directly in the DSL. This is advantageous in various scenarios, especially when dealing with content that cannot be easily copy-pasted. This includes binary data, various document formats (e.g., PDF, DOCX), image files (e.g., PNG, JPEG), and other media types (e.g., audio and video files). Utilizing external files for the request body facilitates easy updates and management of the content.