What's the Point of Selenium?

后端 未结 15 1520
孤街浪徒
孤街浪徒 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:42

    For applications with rich web interfaces (like many GWT projects) Selenium/Windmill/WebDriver/etc is the way to create acceptance tests. In case of GWT/GXT, the final user interface code is in JavaScript so creating acceptance tests using normal junit test cases is basically out of question. With Selenium you can create test scenarios matching real user actions and expected results.

    Based on my experience with Selenium it can reveal bugs in the application logic and user interface (in case your test cases are well written). Dealing with AJAX front ends requires some extra effort but it is still feasible.

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

    It allows you to write functional tests in your "unit" testing framework (the issue is the naming of the later).

    When you are testing your application through the browser you are usually testing the system fully integrated. Consider you already have to test your changes before committing them (smoke tests), you don't want to test it manually over and over.

    Something really nice, is that you can automate your smoke tests, and QA can augment those. Pretty effective, as it reduces duplication of efforts and gets the whole team closer.

    Ps as any practice that you are using the first time it has a learning curve, so it usually takes longer the first times. I also suggest you look at the Page Object pattern, it helps on keeping the tests clean.

    Update 1: Notice that the tests will also run javascript on the pages, which helps testing highly dynamic pages. Also note that you can run it with different browsers, so you can check cross-browser issues(at least on the functional side, as you still need to check the visual).

    Also note that as the amount of pages covered by tests builds up, you can create tests with complete cycles of interactions quickly. Using the Page Object pattern they look like:

       LastPage aPage = somePage
          .SomeAction()
          .AnotherActionWithParams("somevalue")
          //... other actions
          .AnotherOneThatKeepsYouOnthePage(); 
      // add some asserts using methods that give you info
      // on LastPage (or that check the info is there).
      // you can of course break the statements to add additional 
      // asserts on the multi-steps story.
    

    It is important to understand that you go gradual about this. If it is an already built system, you add tests for features/changes you are working on. Adding more and more coverage along the way. Going manual instead, usually hides what you missed to test, so if you made a change that affects every single page and you will check a subset (as time doesn't allows), you know which ones you actually tested and QA can work from there (hopefully by adding even more tests).

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

    Why do you need Selenium? Because testers are human beings. They go home every day, can't always work weekends, take sickies, take public holidays, go on vacation every now and then, get bored doing repetitive tasks and can't always rely on them being around when you need them.

    I'm not saying you should get rid of testers, but an automated UI testing tool complements system testers.

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

    If your application is even 50+ pages and you need to do frequent builds and test it against X number of major browsers it makes a lot of sense.

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

    I use it to test multi page forms as this takes the burden out of typing the same thing over and over again. And having the ability to check if certain elements are present is great. Again, using the form as an example your final selenium test could check if something like say "Thanks Mr. Rogers for ordering..." appears at the end of the ordering process.

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

    This is a common thing that is said about unit testing in general. "I need to write twice as much code for testing?" The same principles apply here. The payoff is the ability to change your code and know that you aren't breaking anything.

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