确定测试矩阵结果的有效方法 [英] Efficient way to determine the outcome of test matrix

查看:110
本文介绍了确定测试矩阵结果的有效方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相关问题:

  • Matrix Combination Logic
  • Would cartesian product be the best approach for this

我有25个验证,每个验证都返回一个布尔值(通过则为true,失败则为false).

I have 25 validations, each validation returns a boolean ( true it passed, false it failed ).

每个验证都可以与所有其他验证结合使用,形成一个验证测试组合矩阵.

Each validation can be combined with all other validations to form a Matrix of validation test combinations.

子集验证的特定组合也将具有通过/失败规则.

Specific combinations of the sub-set validations will also have pass/fail rules.

这是一个简短的示例:

    V1 | V2 | V3 | V4 | V5
M1:  T |  T |  T |  T |  T   <-- For this Matrix row it would PASS
M2:  F |  T |  T |  F |  T   <-- For this Matrix row it would FAIL  
M3:  F |  F |  T |  T |  T   <-- For this Matrix row it would PASS
M4:  T |  F |  F |  F |  F   <-- For this Matrix row it would PASS
M5:  T |  T |  F |  F |  F   <-- For this Matrix row it would FAIL

我只在乎水平值的水平验证测试

I only care about the horizontal validation tests the vertical are for values

我知道所有测试,并将每个测试的结果存储在数据库中. 我知道所有验证测试的子集的所有组合矩阵.

I know all the tests and store the outcome of each test in a database. I know all the combination Matrix for the sub-set of all the validation test.

我的问题是:

运行Matrix的最佳方法是什么?

What would be the best way to run the Matrix?

我是否为矩阵验证存储每个通过或未通过测试的每个排列? 然后在哪里存储矩阵组合?

Do I store each permutation of each passing or failing test for the Matrix validation? And then where do I store the Matrix combinations?

我想做到这一点的唯一方法是存储25个测试的所有验证组合(是625个条目),并将我期望这些验证的矩阵结果添加到同一记录中.

I'm thinking the only way to do this is to store all the validations combinations for the 25 tests ( yeah 625 entries ) and add the Matrix results I'm expecting for those validations in the same record.

类似这样的东西

    V1 | V2 | V3 | V4 | V5 | MR ( Matrix Results )
M1:  T |  T |  T |  T |  T | P   <-- For this Matrix row it would PASS
M2:  F |  T |  T |  F |  T | F   <-- For this Matrix row it would FAIL  
M3:  F |  F |  T |  T |  T | P   <-- For this Matrix row it would PASS
M4:  T |  F |  F |  F |  F | P   <-- For this Matrix row it would PASS
M5:  T |  T |  F |  F |  F | F   <-- For this Matrix row it would FAIL

我只是觉得可能有一个我没有看到的最佳解决方案,有什么想法吗?

I just feel like there might be a more optimal solution that I'm not seeing, any thoughts?

推荐答案

这是我要做的方式.首先在数组中定义矩阵图:

Here is the way I would do it. First define your matrix map in an array:

$map = array( 'TTTTT' => TRUE, 'FTTFT' => FALSE, 'FFTTT' => TRUE );

显然,该数组中将有更多元素,但是您明白了.我不知道您的表/列名称,但是下一个CONCAT v1-v5并以字符串形式提取.然后,只需在map数组中找到该键:

Obviously there will be more elements in that array, but you get the point. I don't know your table/column names, but next CONCAT v1-v5 and pull as a string. Then, just find that key in the map array:

$sql = "SELECT CONCAT(v1,v2,v3,v4,v5) AS matrix FROM `validation` WHERE `user`= '$user'";
$result = $mysqli->query( $sql );
$user_matrix = array();
while( $row = $result->fetch_assoc() ) $user_matrix[] = $map[ $row['matrix'] ];

现在您将结果保存在$ user_matrix数组中

Now you have the results in the $user_matrix array

这篇关于确定测试矩阵结果的有效方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆