简体   繁体   English

如何制作用于测试的扩展条目决策表

[英]How to make an Extended Entry Decision Table for Testing

So I need to make a Decision Table to test a bit of code. 因此,我需要制作一个决策表来测试一些代码。 The code is simple and straight forward but requires two user inputs to determine two proceeding variables. 该代码简单明了,但是需要两个用户输入才能确定两个过程变量。 This is why I need to make this more than a binary (true/false) table. 这就是为什么我需要做的不仅仅是二进制(真/假)表。

The user is prompted to input total income , this will, in turn, determine which bracket the user falls into. 提示用户输入总收入 ,这将反过来确定用户属于哪个类别 Then the user is prompted to input the amount of dependents , which will determine the final tax . 然后提示用户输入受抚养人的数量,这将确定最终税额 Depending on the income bracket, a switch statement will then set tax = income * [certain percentage]. 根据收入级别,转换语句将设置税率 = 收入 * [确定百分比]。 After this the amount of dependents will determine what percentage of the tax will be removed. 此后, 受抚养人的数量将确定将免除税收的百分比。

Essentially what I need to know is how to set up my Conditions , Actions , and Rules . 本质上,我需要知道的是如何设置我的条件操作规则

Here is an example of decision table but this one is binary (true/false) 这是决策表的示例,但这是二进制(对/错)

I am using Java for the code but that isn't entirely relevant. 我使用Java编写代码,但这并不完全相关。 What I need specifically is deciding what my Conditions should be, whether it's solely income or the combinations of income and dependents, etc. I do not need to write the code, just need to write the test table for it. 我特别需要确定我的条件应该是什么,无论是纯收入还是收入与受抚养人的结合等等。我不需要编写代码,只需为其编写测试表。

If anyone can help inform me as to what I should do or where I should look, that would be appreciated. 如果有人可以帮助我告知我该做什么或应该去哪里,那将不胜感激。 I am willing to provide anymore information if need be! 如果需要,我愿意提供更多信息!

Thanks! 谢谢!

If you understand, what the regular (binary) decision table is, then it'll be easy for you to get the extended table as well - the difference is in conditions only. 如果您了解常规(二进制)决策表是什么,那么您也很容易获得扩展表-区别仅在于条件。

Conditions in the extended decision table can have more than two values . 扩展决策表中的条件可以具有两个以上的值 For example, in your case you have two conditions: 例如,在您的情况下,您有两个条件:

  • Tax Bracket with values (for example): [0, 9275], [9276, 37650], [37651, 91150] etc. 带有值的税级 (例如):[0、9275],[9276、37650],[37651、91150]等。
  • Number of Dependents with values: 0, 1, 2, 3 etc. (what's the max?) 数值为0、1、2、3等的受抚养人数量 (最大值是多少?)

For Actions I'd choose the tax rate and the deduction amount - they depend on the bracket and on the number of dependents correspondingly. 对于“ 操作”,我将选择税率和扣除额-它们取决于括号和相应的受抚养人数量。

Rules (=columns in the table) connect conditions and actions - for all the possible combinations of condition values you have a list of actions to perform. 规则 (表中的列)连接条件和操作-对于条件值的所有可能组合,您都有要执行的操作的列表。 In your case these actions will be simply two numbers, which you will use in a tax formula. 在您的情况下,这些操作将只是两个数字,您将在税收公式中使用它们。

(Frankly I don't see why you need a decision table in this case at all... I think, the tax formula with parameters, depending on income, will be enough) (坦率地说,在这种情况下,我根本看不到为什么需要决策表...我认为,根据收入确定参数的税收公式就足够了)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM