Using specflow to run an algorithm instead of test?
So we're currently building an application supposed to let us define variables and constraints, and then solve that constraint net. Part of an AI class basically.
So we built a simple use case given two variables with possible values being {1, 2} each, and a constraint where one variable has to be bigger than the other one.
This was quite simple using specflow. Except it still is in form of a test, so we have to execute the test to execute the algorithm.
Can we somehow tell specflow to run a specific feature file just using code, not as a test?
Can we also feed specflow a new feature file at runtime? Would allow us to build a Web app where were can just type in certain problems (like the Einstein-puzzle) and let specflow parse variables and constraints.
0
-
This is our small example:
Given the first number is element of {1, 2} And the second number is element of {1, 2} And milk is element of {2,3} When the first number shall be bigger than the second number And milk shall be bigger than the second number Then solve it
0 -
"Then solve it" solves it and prints the result to the console. In this case of course, the test console.
0 -
An interesting use-case for SpecFlow that you have here.
Sadly SpecFlow can't execute Scenarios at runtime, as we generate a code-behind file when you build the project. So your web app would need to compile a project before it can run anything.
If this ok, you can create a new unit test provider, that generates the code in a different way which can be executed without any test framework.
0
Please sign in to leave a comment.
Comments
3 comments