Skip to content

lazy-tests name #29

@maxim-uvarov

Description

@maxim-uvarov

I asked gpt4 the following question:

I have developed a nushell module, that can execute nushell code chunks in arbitrary markdown documents, and output the results back to markdown documents.

If those documents will be placed in some git repository, then when updating those markdown documents may serve as unit tests for the commands in them.

I would like to name this concept lazy-tests. Is this name misleading? Are there similar concepts in computer science already?


And it responded to me:

Your concept of "lazy-tests" within markdown documents that contain executable nushell code chunks is both innovative and practical, especially for documentation that needs to stay current with the code it describes. When considering your question about the suitability of the term "lazy-tests" and connections to existing concepts, there are a few points to consider:

Understanding "Lazy-Tests"

The name "lazy-tests" intuitively suggests tests that are not run proactively but rather on-demand or under certain conditions, such as when the documentation is updated or when the code within the markdown documents is executed. This approach has a few parallels in software development and testing:

  1. Lazy Evaluation - In programming languages (especially functional ones), lazy evaluation delays the evaluation of an expression until its value is needed. Your "lazy-tests" concept similarly delays the execution of tests until the documentation is updated or checked, mirroring this "on-demand" strategy.

  2. Regression Testing - This involves re-running tests on existing software applications to ensure that changes or updates have not introduced new errors. By integrating tests into your markdown documentation, you're effectively setting up a system for regression testing whenever the documents or associated code are updated.

  3. Literate Programming - Your system also recalls aspects of literate programming, where a computer program is given as an explanation, in the narrative of human language, interspersed with snippets of macros and source code. However, your approach uniquely executes within markdown files and checks the validity of embedded code, aligning with documentation's goals to be accurate and up-to-date.

  4. Continuous Integration (CI) Documentation Testing - In CI practices, automated tests run whenever changes are committed to a repository. While typically focused on the codebase, this concept has been extended to documentation (doc tests) to ensure that examples and guides are not outdated. Your "lazy-tests" could form a part of this broader testing strategy, focusing on verifying the correctness and relevance of documented code snippets.

Is "Lazy-Tests" Misleading?

While the term "lazy" captures the on-demand nature of your testing approach, it might not fully communicate the proactive goal of keeping documentation accurate and reliable. Alternatives could include:

  • Documentation-Driven Tests (DDTs)
  • On-Demand Doc Tests
  • Live Markdown Testing
  • Embedded Code Testing (ECT)

Choosing a name depends on what aspect you want to emphasize: the integration within markdown documents, the on-demand nature of these tests, or their role in maintaining documentation quality.

Conclusion

In summary, your idea aligns with several existing concepts but presents a unique approach focused on documentation. The term "lazy-tests" is not misleading per se, but clarifying its exact operation and goals might benefit from a more descriptive name or a detailed explanation accompanying its introduction. Regardless of the terminology, it's a promising approach to ensuring the accuracy and effectiveness of technical documentation, especially in fast-moving projects with frequent updates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions