Automated UI tests in EPiServer - selenium

How do you perform your UI tests on a CMS like EPiServer? Where the editor creates content based on Page Types, and you as a developer must test each page instance?
We are currently testing all our pages in EPiServer using dynamically created tests based on the respective Page Type. Our buildserver then every night generates the tests and launches the Selenium RC, ensuring that our tests are covering all pages and run each day.
It has been working for years, but some issues has arisen:
It is based on Selenium RC 1.0.3, which now seems deprecated in favor of the WebDriver.
The Seleniun RC seems to work only with older Firefox versions, when I upgraded to the latest (10), it stopped working
What I would like to do is find out either how to migrate to the WebDriver approach and retain the possibility to let the tests be generated on the fly, or be pointed to another setup that will bring me the same benefits.
What should I do?

Check out Stefan Forsbergs project at https://github.com/stefanforsberg/EPiTest
Also read his blog where he has written a lot about testing UI in EpiServer at http://www.popkram.com/blog/
Hope that helps.

Related

Cross Browser Platform Testing

My team is currently starting to develop a web application with vue.js. We are currently discussing the test framework and a team member prefers cypress. The only issue is, that cypress is not cross platform testing framework. We have requirements to support Chrome, Safari, Edge, tablet and mobile devices.
Most of the modern frameworks such as vuejs promise cross platform functionality. And the raised discussion that we had in the team is the need of cross platform testing. Is it still so important in 2018(almost 2019) to do cross browser and cross OS Platform tests? What do you use for testing and how do you test your web application?
Thank you in advance for your answers.
Of cource the alternative is Selenium using selenium wrappers like Protractor or Webdriver.io or Nightwatch.js.
For same reason, we are not using Cypress. We are using Nightwatch.js. Coz in the above list of wrappers it only has everything inbuilt like cypress. For others in the list we have to find the respective npm for test runner, assertion reporting, parallelisation, etc.
Mainly we have choosed it for internal test runner and junit xml reporting for ci which it gives along with selenium wrapping functionality.
Also one more good thing cypress is working on cross browser support. Recently they have progress in firefox browser.
Refer this issue tracker
We have this same dilemma at my organization. I find Cypress so easy to use that I am ok using it for 99% of my test (that does not include my unit or api test). If I need something special for another browser, which is probably going to be minimal, I would then use a selenium wrapper, for me that would be protractor since we mainly do Angular. I hear a lot of argument not to choose cypress due to the issue that it currently only runs in Chrome, I think sometimes it is an excuse for someone to hate it because they don't want to learn something new. I would bet 90% or more of your test cases Cypress will be just fine, where I need something else I do something else. When I look at the testing triangle, I know most of my test should be UNIT test so I don't have enough UI automation test to worry about it. I will say I have ran into this same argument at my job from developers who say why don't use protractor, and they have the freedom to use protractor, but I notice they never get around to using it. They like to argue about what someone else wants to do, but then they don't even use what they say they prefer. I would ask myself what is going to be the cheapest to implement and be the most effective for me. For me that is mainly cypress and then protractor if I have some special case..

How are all the tools that I'm using related to one another?

So I've been automating tests for some time, but I honestly don't think I completely understand how the tools I am using are fundamentally related to one another. I actually feel a bit embarrassed but this was the toolbox handed down to me and I just ran with it. I've since put it to incredibly good use, which I'm very grateful for.
So I'm using the following, which if I'm not mistaken is fairly common nowadays: selenium-webdriver, rspec, capybara, chromedriver
What is the relationship between all of these that allow me to accomplish what I do on a daily basis?
RSpec is the test runner framework.
Capybara is a tool for emulating user behavior on a web page, and verifying the existence of content on those web pages, there are a number of drivers for it. It comes with rack-test and selenium-webdriver drivers.
Selenium-webdriver is used to integrate with the selenium web automation framework, it supports using firefox out of the box.
Chromedriver allows selenium-webdriver to control googles chrome browser

Browser emulation - Which Selenium do I need?

I am struggling to get a RemoteWebDriver to work.
I wondered whether I needed Selenium RC, so I installed that with Nuget and noticed that DefaultSelenium takes a path to the browser as a parameter.
I am getting a bit overwhelmed with all the different libraries available for Selenium - but what I want is to be able to run against a host of browsers (android/chrome/firefox, etc) without those browsers necessarily existing on the machine that Selenium is running on.
Is that possible? And if so, which Selenium libraries would I need (I am using VS2012 and C#) to acheive this?
I was trying to achieve this with RemoteWebDriver with a range of different DesiredCapabilites, rather than using ChromeDriver, FirefoxDriver, etc.
You should, especially considering this is a new project, 100% absolutely positively use the WebDriver API. So you only need the WebDriver NuGet package:
http://www.nuget.org/packages/Selenium.WebDriver/
You will need the IEDriver package too, if you intend to test against IE, and the same for Chrome/Safari etc.
I say this because the WebDriver is constantly being developed on, maintained, and improved. It has a better cleaner and nicer API, and will be more stable in the long run.
RC is deprecated. Although I believe the developer's intend to still fix any bugs, new features and improvements won't be happening.
Try this has some good answers : Run Selenium tests in multiple browsers one after another from C# NUnit. I personal use IWebDriver and Selenium RC and test it like that. Cause i have a lot of tests and testing in every browser is to much for me.

Implementing selenium with Jenkins and PHPUnit

I'm trying to do set up some Selenium WebTests using PHPUnit, but php is no longer supported by Selenium IDE, does this mean I have to re-write all my tests into php in order to use this method?
I'm trying to set up a continuous integration system, but have never even used one before, I tried using jenkins-php.org but it wasn't very helpful.
The newer releasee Selenium IDE "claims" it does not support PHP,
But you can still convert your IDE to PHP or PHPUnit.
(In Selenium IDE) Option > Options > Enable Experimental Functions.
With this option checked you can switch your format under Options again.
You may still want to review your code.
Hope this helps and it is what you meant by "Selenium IDE does not support PHP".
I was able to find: https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-php-formatters/
It allows output from Selenium to PHP, either PHPUnit format or Selenium Testing.
However after all this playing around it became apparent that the best way was to use htmlSuite, it has the most support when it comes to automation and seems to work out of the box, whereas PHPUnit testing requires lots of tinkering.
After a lot of hacking around it became apparent that the best solution is this tool:
http://www.enjoyxstudy.com/selenium/autoexec/index.en.html
It works out of the box, supports htmlSuite, works with windows and linux, runs most browsers, sends email reports, can get new tests from SVN, integrates with Jenkins well, and works with Selenium tests, its not PHP based tests but it works wonders compared to the other tools I tried out.
Really, so much easier, very user friendly, free and works out the box.

Front-end testing - tools Selenium RC

I am wondering what tool(s) do you use for front-end testing...
Currently I am using Selenium RC as tool to test the front-end. I am quite happy with the result as I managed to integrate it with the ms build process etc. The problem with Selenium tests is that they are not always reliable especially if you browse with something else than Firefox.
I am looking for open source alternatives (tools for front-end testing)?
I'd recommend TestPlan which can use Selenium as a backend, or HTMLUnit. It also allows you to do a myriad of other testing. It also works around several of the problems Selenium has, making it a bit easier to user than Selenium directly.
My experience shows, Selenium works the best from everything I tried. Even now I work with Firefox 6 and Selenium IDE works perfectly with it.
Together with selenium, we're also using twill. However, it is because of its speed and it is used only for "quick & fast" tests, I'm afraid not a lot of things are better then selenium out there.
On the other hand, I find Selenium quite reliable, even in another browsers - it's just hard to build tests in such way, to think about race conditions etc.
Have you heard of Watin ?
There is a great tool named cypress.
With cypress it is possible to write
End-to-end tests, Integration tests & Unit tests.
It is open source.
Learning curve is very low.
https://docs.cypress.io/guides/overview/why-cypress