开发者

Is there a way to cover all permutations of parameters in a test

I am writing a Selenium test to validate an input form on my web page. 开发者_如何学JAVAI would like to cover all combinations of input data, but I would not like to write a separate test for each. Right now, I'm using an excel spreadsheet as a data source and I have the combinations listed as each row.

I was hoping there would be a way to cover all the cases without needing to use the excel file or write a separate test for each case. Is there anything that can help with this?


If you can come up with each possibility you want to test for each parameter, then you can do a quick cross-join using multiple from statements in LINQ syntax to come up with every combination of those possibilities.

You may also want to look at Pex. It can analyze your class and generate test methods to test every possible code path. It can be really useful for finding those corner cases that you might not have thought of on your own. Of course, this is only useful if you've written the class in a unit-testable manner. It may not help if your web page's form isn't backed by an MVC action or something of that sort.


do you just need a way to get all combinations to values? You can do this with linq and various other techniques - see this questions as an example

So generate all input-combinations for your method and then just write a Unittest (potential very long running) in mstest or whatever to check each one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜