I know that we can test the component label test using the React Testing Library. But from my curiosity, I want to know that is there any way to do an end-to-end test on the react components using this library.
I'll be grateful if I get some nice information on it.
There's an example of using React Router within the RTL docs: https://testing-library.com/docs/example-react-router/ so it looks like it's possible. However, I'd recommend using a dedicated e2e testing library such as Cypress to do the job. There is an RTL integration for Cypress so you can follow the same testing principles that RTL advocates.
Related
I have an application in which I need to do UI testing as well as rest Api testing.Could anyone suggest me any testing tool for this.
My framework will be data driven.
Also, it is 20% UI and 80% rest api testing.
It is good that you have decided 80% API tests and 20% UI tests, which will satisfy the test automation pyramid. Well, the test tools and frameworks completely depend on your language of choice.
For API tests
Java -- RestAssured
Python -- requests library
For UI tests, Selenium webdriver is my preferred choice.
If you are starting test automation, I would suggest start with reading the documentation.
I'm using Nightwatch-Cucumber that based on Nightwatch.js. And I want to integrate REST API tests in my Nightwatch framework. Currently I only have End2End tests based on Selenium, but in future I want to have both test types in one framework to make it also possible to use the End2End tests and the REST API tests in harmony within one Cucumber test. So, I want to combine both tests.
What is the best and smartest way to implement such REST API tests in my test framework based on Nightwatch-Cucumber? I've tried some stuff with frisby.js, but this framework uses Jasmine and Jest and it's not a good idea to use it in combination with Nightwatch and Cucumber.
Any recommendations?
You can use request-promise.
In nearest future, new version of nightwatch-cucumber will work with Jasmine and Jest too.
I found many similar questions related to this, but not the particular answer I am looking for. Actually my requirement is little different, so I end up posting the following issue.
I want to automate Rest APIs, and I got two options for the same case.
The first one is Rest Assured and second one is Play Framework.
For example, to test this RestAPI:
http://servername:9000/dbs/all/list/m1/p1/sch1
(↑ This gives xml response)
So, I have written a code in Java with Rest assured, and is working fine. I integrate this with Maven project so that can be integrated with Jenkins.
Sample code:
import com.jayway.restassured
public class TestNGSimpleTest2 {
#Test
public void testApi() {
expect().
statusCode(200).
body("Status", equalTo("Su22ccess")).
when().
get("http://localhost:9000/dbs/all/list/m1/p1/sch1");
}
So my first question is:
Is the rest assured is the best tool to use?
Does Play framework is better?
I found many other tool like Jmeter, RightAPI etc. to test RestAPI. But I dont think this is automable. Am I right?
For automating REST API testing, as a starting point I recommend using Postman and newman.
Postman provides an excellent UI for building requests, and newman is its command-line counterpart. After you create a set of requests and corresponding tests within the Postman UI, you can run the entire collection from Jenkins via newman, preventing a deployment if tests fail.
The RestAssured code you have posted will work just fine for basic cases. It's not necessarily the "right tool" if you want to:
continuously add new test case and don't have many resources
propogate alerts with well-formed error messages (especially to places like Slack or GitHub)
reduce false-positives
re-use the same tests for monitoring
Building these features takes time and resources which, depending on the size of your team may or may not be a good call.
Some of the commercial solutions you posted can solve some of these problems for you.
Assertible is a codeless solution that supports the workflow you described directly: https://assertible.com/blog/automated-api-testing-with-jenkins
We can integrate Jenkins and JMeter for automating RestAPI testing.
The reason for that is,
In Jenkins we can schedule our tests/builds in whichever way(every minute/hour/day/month.....) or based on the commits etc..
we can bundle n number of APIs together in JMeter and execute in a single test.(Maintaining is easy)
There is a jenkins plugin "Performance" which can be used to check the response time for each API call, which compares the response time with respect to the previous response times.
JMeter has an in-build threading feature, which helps execute tests much faster than any single threaded tests.
Screenshots:
Steps
We can prepare our APIs in JMeter
Configure the tests in non GUI Mode in Jenkins.
Install and Configure the Performance plugin in Jenkins.
I am user of Selenium RC with java for a quite long time. But till date I am not able to find the best framework for Selenium RC scripts. I would like to know the following details,
a) What are the different frameworks available for Selenium RC?
b) Which is the best one for Selenium RC with Java?
Help me with your answer, please also provide the supporting URL so that I can have some basic idea about the frameworks and chose the best one for my project.
Thanks in advance
We have been using OpKey, a framework on selenium build by CresTech. What we liked about it was out of box Object map and data map implementation..For us script maintenance was a issue we were struggling with.I would recommend OpKey
We use TestNG. In addition to providing a JUnit-type organization for system tests, it supports data driving and has scope for Continuous Integration.
Page Object - [http://roadtoautomation.blogspot.in/2015/02/page-object-model-for-selenium-webdriver.html]
Keyword Driven Framework - Keyword-based test design and test automation is formed on the idea that the discrete functional business events that make up any application can be described using short text description (keywords). In this framework testers to develop test cases using Microsoft Excel using a list of keywords. When the test is executed, the framework
processes the Excel workbook and calls functions as sociated with the
keywords entered in the Excel spreadsheet. These keyword functions in
turn perform specific actions against the application under test
(AUT).
http://seleniumeasy.com/selenium-tutorials/keyword-driven-framework-example
Data Driven Framework
https://www.youtube.com/watch?v=FSiba01-R2M
Hybrid framework - Combination of Keyword and Data Driven framework
So our front end GUI is getting a large overhaul to a new GWT based application. I have been working on creating the automation scripts for the old front end using cURL in some tcl/expect scripts. As I have looking at the new app I am starting to realize more and more that cURL is out of the question for performing these web interactions and was wondering if anybody had some ideas/experience with testing a web app made with GWT??
Any help would be appreciated!!
The closest analogy to cURL tests for a static-page UI for a dynamic JS/GWT UI will be Selenium (or Webdriver) tests. Selenium tests load the page up in a real browser, including all JS, and simulate clicking on and interacting with UI elements and tests that they react accordingly.
That being said, unit tests should also be written to test the functionality of your GWT UI without having to load the page in a browser, just testing that the underlying Java/JS performs correctly. The MVP pattern aims to make this easier/quicker.