I’ve just noticed the '“Unit Test” package on the OpenTAP repository.
Is there any documentation or usage examples available?
I’ve just noticed the '“Unit Test” package on the OpenTAP repository.
Is there any documentation or usage examples available?
Hi @benstreek,
The Unit Test plugin is not really production ready, but we use it to test various plugins. The idea is to run regular software unit tests as an OpenTAP test plan.
It’s a quite rudimentary unit testing framework, and its very much experimental, but you are welcome to try it out if you’d like. If you do, let me know what you think.
Currently there is no documentation so here is a quick guide:
To get started install the package as an OpenTapPackageReference and then make a class that implemets ITestFixture. Then mark tests with [Test] or [TestCase] (similar to nunit).
After build, use “tap unit-test run” to run your unit tests.
example:
public class MyTests: ITestFixture
{
[TestCase("3 * 4", 12.0)]
[TestCase("3 + 2", 5.0)]
public void TestThing(string expression, double expectedResult)
{
// .. some code that calculates a result..
Assert.AreEqual(result,expectedResult);
}
}