When you open BETA for the first time you’ll be welcomed by the following screen:
The first thing you should do before you start using the tool is to make sure you have the path to the ProB directory configured on the Settings menu. To do this you should click on the Options menu on the top left and select Settings as presented bellow:
Loading a machine
The BETA approach generates unit tests for operations of an abstract B machine individually. The first thing you should do to generate tests for an operation is to open it respective machine. You can download the SimpleLift.mch machine and use it to follow the remainder of this guide.
Proceed clicking on the Options menu and selecting the Load Machine option. Locate the SimpleLift.mch file you just downloaded and click on Open. You’ll be presented to the following screen:
At this step the tool will present the following information (highlighted on the image above):
The name of the machine you just loaded;
The list of operations specified in this machine.
Now that we have loaded a machine on the tool we have to select the operation we intend to generate unit tests for. For this example we are going to select the “go_up” operation. Before we generate the unit test report we have to define the parameters of our report wich are defined on the menu shown bellow:
The image presents in:
The Testing Strategy to be used in the unit test generation. To tool provides two options: Input Space Coverage and Logical Coverage;
The Coverage Criteria that will be used to define the requirements of the test cases generated. For Input Space Coverage the tool provides six options: Equivalent Classes (Each-Choice), Equivalent Classes (Pairwise), Equivalent Classes (All-Combinations), Boundary Analysis (Each-Choice), Boundary Analysis (Pairwise) and Boundary Analysis (All-Combinations). For Logical Coverage the tool provides four options: Predicate Coverage, Clause Coverage, Combinatorial Clause Coverage and Active Clause Coverage.
Once the test generation parameters are defined, the user should click on the Generate Tests button. Then, following screen will be presented:
In this window the user is able to select how he or she wants to generate the test cases. The tool currently supports the generation of HTML and XML test case specifications. It also has a separate module that is capable of generating partial test scripts in Java and C++. Once the types of test cases are selected, the user should click on the Generate Report button. After the tests are generated, the tool should present the following window:
The test cases generated will be located in the same directory of the machine we are testing. You can navigate through the generated report clicking here. This is how the report looks like:
In this spreadsheet you will find an overview on how predicates are partitioned into blocks for different types of characteristics extracted from the model. For more detailed information on this topic, read this report
You can download more examples of B specifications to use in the tool clicking here
How to use the generated XML file
BETA is able to generate a test suite using the XML format. Visit this link to learn how to use it so you can integrate the tests generated by BETA into your own tool.