Is it possible to write automation tests for nwjs app? - selenium

I am currently working on node-webkit based desktop app. I was searching for a way to do automation testing for this . But most of the automation tools required a server to start up but in my case i have on but it runs in the chromium that comes by default. Is there a way to automate UI acceptance test for nwjs apps.

Take a look at the NW.js Wiki under How to run node webkit's test cases
You will need to setup the chrome driver in order to use selenium for example
Once you have those, check out Yaniv kessler's blog post on how to Automate NW.js UI testing using mocha.

Related

Build Chrome extension to automate debugging - which auto test framework can i use?

I'm currently have a task of making an idea for building a Chrome Extension to automate Debugging web code.
This is a test to get the position in company (not what I'll do in real)
Can I use Auto test frameworks such as Selenium in my Chrome extension?
I've googled but most people care about use Selenium to test a Chrome extension, while I want to put Selenium into my Extension to test people's website.
Thank you guys!

Possible to use cypress for e2e with embedded jxbrowser?

I've recently found and fallen in love with Cypress for e2e testing, much more so than Selenium, but there's a catch: our web app will actually be within jxbrowser, inside a java app. Whatever e2e framework we choose has to be able to run all the tests within jxbrowser inside of this embedded application (hence why we originally looked at selenium, because of the remote driver)
Is it possible to get this working? We absolutely need the embedded jxbrowser tests (Cots integration, can't get around it), and I'd hate to have to fall back to selenium.

Is there a way to run a specific version of a browser in a sandboxed fashion when using WebDriver?

At the moment, it is possible to run the same test on different browser assuming that you have all those browsers installed on your machine and that those browsers have a version compatible with your drivers version.
Is there a way, such as a library or everything else, that allows us to run the same test on different versions of the same browser, downloading those browsers on demand (bit like WebDriverManager does with the drivers)?
We want a test harness runnable on every machine and every operating system and we don't want to rely on any browser already installed in that machine.
A tool that allows us to choose on what browser and what version we want to run the test, it downloads a sandboxed or virtual version of that browser, and it runs the test.
I heard also about Saucelabs, but the systems under test are not available by publicly available URLs because they are in a dev environment.
I thought we could use Docker, but in that case we have to use a Headless browser, and we want to keep to possibility to see what the test is actually doing.
Thanks in advance.
No longer do you need (as we did in the dark old days) to manage our own infrastructure and have machines running instances of browsers and configure a Selenium Grid.
SauceLabs is a Selenium Grid in the cloud and is most definitely the recommended approach here. They offer a wide (ever growing) array of platforms.
With all that infrastructure taken care for you in the cloud the problem changes to one of correctly providing SauceLabs the DesiredCapabilities
I would highly recommend you also use Jenkins and its Sauce OnDemand plugin which allows you to select your target environments and at the same time integrate cross device testing into your build pipeline.
Constructing the DesiredCapabilities objects for SauceLabs in your test code is not a straightforward exercise however and can lead to hard to maintain spaghetti code if not done with a lot of discipline.
There are some NuGet packages that solve the SauceLabs DesiredCapabilities problem and integrates with Jenkins as well.
Saucery2 for NUnit2 (NuGet, Source, Example)
Saucery3 for NUnit3 (NuGet, Source, Examples)
SauceryJ for JUnit4 (Source, Example)
Saucery is DesiredCapability factory for SauceLabs. Full disclosure: I wrote Saucery and maintain it.
Saucery pulls in all the dependencies you would want allowing you to write tests against:
Desktop browsers (simply extend SauceryBase)
with Selenium;
or native app tests against:
IOS (simply extend SauceryIOSBase); or
Android (simply extend SauceryAndroidBase) devices
with Appium.
The home page provides benefits and a How To.

TestCafe framework usage

Does anyone have the exact idea on Devexpress TestCafe tools?
What I have found that "User can get the JavaScript codes, which has been created on the test page at the time of recording. User can directly copy-paste those codes in any other projects."
But I am not sure that if a user can execute his/her own project in TestCafe or not. Please help.
TestCafe is a functional web testing framework. It is intended for creating and performing functional web tests. You can learn more about functional testing and TestCafe in particular from these links:
Unit tests vs Functional tests
TestCafe Documentation
TestCafe Studio, a cross-platform IDE for end-to-end web testing
What is the difference between a paid and an open-source TestCafe version? What is TestCafe Studio?

Selenium: Is there any JS (JavaScript) code coverage tool which we can integrate with Selenium Server/RC

Selenium: Is there any JS (JavaScript) code coverage tool which we can integrate with Selenium Server/RC
Hi,
I want to JS code coverage done by my Selenium Test Suite
Is there any code coverage tool which can be integrated with my existing selenium rc framework??
In theory, you can use any coverage tool that instruments JavaScript code to collect coverage data.
For example, you can use JSCoverage either in proxy mode (for real-time instrumentation) or for static instrumentation to run your Selenium tests off the instrumented code.
One technical hurdle could be to devise a way to accumulate coverage data across multiple pages. The coverage tool of your choice could already have support for accumulation of data from multiple page runs. If not, you might have to handle that bit yourself, but this is probably not something trivial.
I have found the solution for my need, there are multiple tools available but I want a tool which can be integrated with my existing automation easily
Tool is JSCover
http://tntim96.github.io/JSCover/
Just run the Server
Run Server
java -cp JSCover-all.jar jscover.server.SimpleWebServer . 8080
Run Proxy Server
java -jar target/dist/JSCover-all.jar -ws --proxy --port=3128 --report-dir=target
Add Proxy in your Webdriver for port specified, 3128 in my case
After execution of test Generate Reports using
((JavascriptExecutor) driver).executeScript("jscoverage_report();");
You can add this line where you exit WebDriver or Test Case
Not aware of a tool for Selenium, but JsTestDriver has a design very similar to Selenium RC (can launch tests from the command line and they are run on a server that drives browsers headlessly) and provides code coverage information.
IntelliJ integrates with JsTestDriver and provides a visual display of coverage information.
Take a look at https://github.com/yui/yuitest/wiki/Code-Coverage
I've integrated this tool in my Selenium tests a time ago. You need a bit of work to gather coverage info before page changes (in any case js trigger a page reload, link etc...)
Once you set up everything, it will fully coverage any js executed while Selenium load and test your website pages.
PS : Even if it was specially adapted for YUI test, you can use it with selenium.
I don't know what you are trying to achieve, but:
Selenium is testing the final output, as seen on the page itself.
So it really does not matter if its PHP, HTML, JSP, ASP or .NET - the Selenium is designed to mimick the end user and click the final application - the final HTML code generated by whatever is under the hood.
Selenium is also not that good for code coverage tests - one piece code can be on many pages - so better approach with selenium is to do the "user" coverage - try to cover all the possible actions which living human could possibly do with your page
There is no particular tool that can integrate with Selenium to do JS coverage. However there are lots of tools which test JS on every page which can tell if the JS that executing on your web page had any errors. This may not ideal solution but on each page you will have the measure of uptil which point JS executed properly on your webpage under test. There are two solutions for that:
1.) JSErrorCollector API: It will integrate directly with Selenium and let you know if there were any error on the page. Can be found at: http://mguillem.wordpress.com/2011/10/11/webdriver-capture-js-errors-while-running-tests/
2.) Full fledged JS coverage tools: There is an excellent list of tools here which will essentially help you in covering JS on on your web pages. Can be found at: JavaScript unit test tools for TDD