开发者

Save a test suite as a single file in Selenium

Is it possible to save a test suite as a single file as opposed to a group of files when using Selenium? Normally the test suite file is just a list of links to the test case files; I'm wondering if it is possible to store the test cases within开发者_如何学Go the test suite file itself.


I don't know if it's possible, you could always just copy and paste the source of a number of files into one huge file.

However, if you have a site of any decent size, it's much better to have your tests in many separate files, broken out by function or site areas.

I create a single test file for each major functional part of the site, and sometimes even break those down into smaller pieces.

One advantage of this is that you can test just a specific portion of a site, instead of having to run a test on the entire site, so you can check your test code in small sections.

It's also tons easier to scroll through a few hundred lines of selenium code to check errors in one specific section of the site than it would be to have to scroll through thousands of lines of code to track down the errors.

And unless you're very diligent in commenting the code, it can be difficult to backtrack and figure out what page or specific function experienced the error.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜