I am developing a js library for smart tv embeded apps, and I would like to make some autotests for my code. The problem is, smarttv's do not provide webdriver interface, so it is impossible to use test runners like karma.
I need a solution that can be embedded to a custom HTML page, run tests by my scenario and log results to a div or console. Which test frameworks are capable of that?
Testcafe is most suitable E2E framework for your needs: http://devexpress.github.io/testcafe/
It does not require any additional capabilities from browser, and can be run at least with a stool if it has a browser and connection to the network.
See advanced usage with example and comparation with driver-based E2E tools here: https://60devs.com/functional-testing-of-web-applications-using-testcafe-and-nightwatch.html
So I ended up using https://github.com/substack/tape
Using this lib I bundle tests into a single js via webpack and run them directly inside a specially created smart tv app.
Automated tests is not clear question, so if you want unit tests you can use every unit test framework working in browser but it must be setup and this is not easy to be automated you will still need to run it manually.
But now is great solution called Suitest which is handling mainly TV platforms and write tests is easy even non-programmer guys, there is lot of ways and also CI integration option.
So it is easy to be configured to run automatically with each commit by some CI or whatever you want.
Related
Is it possible to create API automation tests in Microsoft Playwright? If so how do I create the following POST request as an automated test in Playwright using javascript?
Please note below is just an example.
POST
https://pokeapi.co/api/v2/pokemon-form/1/
BODY
{
"name":"test"
}
3rd party edit
The answer given below points to the playwright api testing documentation but the problem is, that the documentations is quite brief.
It is unclear to me
If i need to create a project first using npm init playwright#latest
Do i need to download the browsers again or can i cancel this steps because i already downloaded the browsers
In which file and folder do i need to put the codes sample provided?
For one code sample the file is playwright.config.js
But the first code sample Writing Tests makes no statement into which file it should be placed
The same is the case for setup and teardown: what are the file names and into which folder must they be placed?
The same is the case for the other chapters: using-request-context, sending-api-requests-from-ui-tests and so on
How can the sample be run / started / executed?
Yes you can run API tests with Playwright. It can be done in a standalone way without using the browser context at all, and also possible while using the browser context.
Playwright is quite different from Cypress in this case since cypress always considers all tests as browser tests, but with playwright requests feature, you can run API tests in standalone mode.
You can see all the required information here.
https://playwright.dev/docs/test-api-testing
So I have written an Angular app and I want to implement end-to-end testing, so I searched the internet for a tool. I found out that Protractor and Cucumber are two popular tools that do that, but I am confused as to what is the difference between them.
Cucumber and Protractor dont do the same job to compare
Cucumber enables us to write automated tests in a behavior-driven development (BDD) style. Its available vis-a-vis with Jasmine or Mocha as a test framework over Protractor API
Protractor is a wrapper over WebDriver Js to write e2e tests to interact with browser. You can write Protractor tests using any of the below Frameworks
Jasmine
Mocha
Cucumber
You will cucumber as a custom framework in Protractor config when you need to write your tests in a BDD style - acceptance tests
I guess this is enough to get you started and you can read more about Protractor with Cucumber here. there are npm packages - cucumber & protractor-cucumber-framework which will enable this integration
Yes, There is a huge difference between 'Protractor' and 'Cucumber'.
Protractor is a tool and Cucumber is just a framework( to be more precise-its a BDD(behaviour -driven-framework)).
So first i'll describe Cucumber based on my experience:- Its very easy to use, we just need to install cucumber by just running a single command, then you are ready to use it. It uses GHERKIN language which is a basic english language. So we write acceptance tests using Gherkin we used to call it a feature file and saved it as ".feature" ex-:
Feature: Check validation of Google search button
Scenario: Finding results on the basis of search
Given I am on google home Page
When I type Europe in search field
And I click on search button
Then i should see some search result
So this is how feature files look written in Gherkin language. And this file is for non-technical persons like for BA's, Managers who just want to know what all things should be covered in one scenario.
Now, what is protractor: - Its a tool build on 'Webdriver'. If you have ever worked on Selenium before than you must be knowing this term. So Basically we deal with the page locators using this tool. and for this we have multiple Element finders ex- CSS ,xpath etc. So inshort, We communicate with our application through Protractor and just giving a layer of abstraction through Cucumber so that non-techncal people can understand it, Cucumber adds more clarity and readability to our automated test scripts . After reading all this you must have to visit these two links :
https://docs.cucumber.io/
https://www.protractortest.org/#/
Use cucumber. Way better to separate test description and implementation!
I am new to Protractor. Can I know how to create a framework in protractor.
I have gone through some videos of how to create a framework.They have specified that we can use POM. But is there any other way of how to create a framework. Could you share me some insights about this.
Protractor is one of the javascript bindings for Selenium Webdriver, which has many feature, but is probably best known for working well with Angular apps (though not a necessity for its use).
I have an example project on GitHub that might give you a nice head-start with Protractor.
FYI, a POM file is part of Maven (Java), and not used in Protractor.
I have some django apps for which I have some templates. I have some inline JS in the template and a lot of DOM manipulations.
I would like to test the JS parts. I don't particularly want to use selenium - mostly as I don't want to run a selenium server and want to make my tests slow.
So my question is:
Can I write these tests with Qunit/Jasmine et all?
Can I integrate them with a CI?
The main problem with javascript testing is compatbility of all that fancy browser features you may use. I am not sure about the capabilities of Jasmine, but I'd take a look at PhantomJS and CasperJS, which are headless WebKit based browser automation environments.
I am building a web app using BackboneJS and RequireJS and need to implement some form of unit testing for UI interaction and data retrieval via AJAX. I have come across QUnit and Jasmine but don't really know how I can integrate this into my app.
If I am testing things such as:
Is the user logged in alright?
Has the data been received from the server ok?
Does clicking a button trigger the expected response?
Do click events work on dynamically loaded html content?
Does the app respond correctly to changes in hash/push-state urls?
I would imagine the testing has to be directly integrated into my app so as to have access to specific JS objects, work with session specific data and respond to changes in push state URLs.
How can I integrate QUnit or Jasmine (or other suggestions) into my modular app to unit test such features?
Unit testing is really simple.
You make a test HTML page. You include QUnit/NodeUnit/Jasmine/TestLibraryOfChoice
You then use requireJS and load one of your javascript modules,
and you simply test the exported object or function. That means testing the valid inputs of your module and asserting the outputs are correct.
You may have to mock out ajax and write HTML mocks
Dojo Objective Harness (DOH) is a very good unit test framework, which is browser agnostic and supports testing asynchronous functions, see here for a walkthrough guide.
However, from your test cases it looks like you want something more like an integration test?
If so Selenium is a good browser automation tool.
Crucially, neither of these tools will require you to modify your code (unless you find bugs :))
If you want to see an example where requireJS based modules are unit tested with QUnit, download the javascript reference architecture at http://boilerplatejs.org.
Disclaimer: I'm the main author of it.