Cornutum / tcases

A model-based test case generator
MIT License
218 stars 54 forks source link

Lifecycle hooks #262

Closed emtilmont closed 1 year ago

emtilmont commented 1 year ago

It would be great if there was support in the tcases-api-test command to support setup and teardown lifecycle hooks. Since the tests that are generated from OAS run against a live server, they require live test data. Because JUNIT runs in random order by default, relying on data setup by other tests is insufficient, since the dependencies are not known to exist at test runtime.

Is it possible to support lifecycle hooks for setup and teardown such as beforeEach or afterEach?

kerrykimbrough commented 1 year ago

Another suggestion: generate tests with a specific base class, using the -b option (or if using Maven, -DbaseClass). Then define your @Before and @After methods in the base class.

emtilmont commented 1 year ago

@kerrykimbrough that definitely could work. i am probably just overlooking it somewhere but could you please link me to documentation about providing a base class for tcase-api-test generated tests?

kerrykimbrough commented 1 year ago

An example is shown here. Among several other options, this illustrates the use and effect of -b.