What's the Point of Selenium?

后端 未结 15 1522
孤街浪徒
孤街浪徒 2021-01-30 07:13

Ok, maybe I\'m missing something, but I really don\'t see the point of Selenium. What is the point of opening the browser using code, clicking buttons using code, and checking f

相关标签:
15条回答
  • 2021-01-30 07:55

    And if you save those tests as JUnit classes you can rerun them at your leisure, as part of your automated build, or in a poor man's load test using JMeter.

    0 讨论(0)
  • 2021-01-30 07:56

    Imagine you have 50 pages, all with 10 links each, and some with multi-stage forms that require you to go through the forms, putting in about 100 different sets of information to verify that they work properly with all credit card numbers, all addresses in all countries, etc.

    That's virtually impossible to test manually. It becomes so prone to human error that you can't guarantee the testing was done right, never mind what the testing proved about the thing being tested.

    Moreover, if you follow a modern development model, with many developers all working on the same site in a disconnected, distributed fashion (some working on the site from their laptop while on a plane, for instance), then the human testers won't even be able to access it, much less have the patience to re-test every time a single developer tries something new.

    On any decent size of website, tests HAVE to be automated.

    0 讨论(0)
  • 2021-01-30 07:57

    Because you can repeat the SAME test over and over again.

    0 讨论(0)
  • 2021-01-30 08:00

    The point is the ability to automate what was before a manual and time consuming test. Yes, it takes time to write the tests, but once written, they can be run as often as the team wishes. Each time they are run, they are verifying that behavior of the web application is consistent. Selenium is not a perfect product, but it is very good at automating realistic user interaction with a browser.

    0 讨论(0)
  • 2021-01-30 08:03

    Selenium will record and re-run all of the manual clicking and typing you do to test your web application. Over and over.

    Over time studies of myself have shown me that I tend to do fewer tests and start skipping some, or forgetting about them.

    Selenium will instead take each test, run it, if it doesn't return what you expect it, it can let you know.

    There is an upfront cost of time to record all these tests. I would recommend it like unit tests -- if you don't have it already, start using it with the most complex, touchy, or most updated parts of your code.

    0 讨论(0)
  • 2021-01-30 08:04

    Selenium (along with similar tools, like Watir) lets you run tests against the user interface of your Web app in ways that computers are good at: thousands of times overnight, or within seconds after every source checkin. (Note that there are plenty of other UI testing pieces that humans are much better at, such as noticing that some odd thing not directly related to the test is amiss.)

    There are other ways to involve the whole stack of your app by looking at the generated HTML rather than launching a browser to render it, such as Webrat and Mechanize. Most of these don't have a way to interact with JavaScript-heavy UIs; Selenium has you somewhat covered here.

    0 讨论(0)
提交回复
热议问题