Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 855 of 3366
9K+ Views
We can pass more than one header in a request in Rest Assured. A web service can accept headers as parameters while making a service call. The headers are represented in a key-value pair.There is more than one way of passing multiple headers in Rest Assured −Passing them in a key-value format using the header method.Syntax Response r = given() .baseUri("https://www.tutorialspoint.com/") .header("header1", "value1") .header("header2", "value2") .get("/about/about_careers.htm");Passing them as a Map using the headers method.Syntax Map m = new HashMap(); m.put("header1", "value1"); m.put("header2, "value2"); Response r = given() .baseUri("https://www.tutorialspoint.com/") .headers(m) .get("/about/about_careers.htm");Passing them as a List using the headers method.Syntax List h ... Read More
1K+ Views
We can manage cookies in WebdriverIO. A cookie helps to identify a user. It is an efficient technique to pass information from one site session to another or in between sessions of two connected websites.We can add, delete and obtain a cookie with WebdriverIO using the methods −browser.setCookies - this is used to set a single cookie or multiple cookies for the present page. To set a cookie for a page, we have to first launch and be on that page.Syntax browser.setCookies({cookie, cookie.name, cookie.value, cookie.path, cookie.domain, cookie.secure, cookie.httpOnly, cookie.expiry} )Here, a cookie is the cookie object or object array and ... Read More
3K+ Views
We can create a Junit report in Cypress. To install the package for the JUnit report, run the command − npm install cypress-junit-reporter --save-devExampleImplementation in cypress.json{ "reporter": "junit", "reporterOptions": { "mochaFile": "cypress/results/results.xml", "toConsole": true } }If we run multiple tests in a run and wish to have a unique report for individual spec files, we have to add [hash] in the mochaFile parameter in cypress.json.ExampleImplementation in cypress.json to avoid overriding report{ "reporter": "junit", ... Read More
5K+ Views
We can create a Mochawesome report in Cypress. Cypress is bundled with Mocha, so any reports that can be generated for Mocha can also be utilized with Cypress.Mochawesome ReportThe Mochawesome report is one of the most important reports in Cypress. To install mochawesome, run the command − npm install mochawesome --save-devTo install mocha, run the command − npm install mocha --save-devTo merge mochawesome json reports, run the command − npm install mochawesome-merge --save-devAll these packages after installation should get reflected on the package.json file.To merge multiple reports in a single report, run the command − npm run combine-reportsIn the cypress.json ... Read More
370 Views
Cypress data-driven testing is achieved with the help of fixtures. Cypress fixtures are added to maintain and hold the test data for automation. The fixtures are kept inside the fixtures folder (example.json file) in the Cypress project. It basically helps us to get data input from external files.Cypress fixtures folder can have files in JSON or other formats and the data is maintained in "key:value" pairs. All these test data can be utilized by more than one test. All fixture data has to be declared within the before hook block.Syntaxcy.fixture(path of test data) cy.fixture(path of test data, encoding type ) ... Read More
6K+ Views
We can upload a file in Cypress. To perform the file upload task in Cypress, we have to first install a plugin with the command −npm ins tall –dev cypress-file-uploadOnce the installation is done, we have to add the statement import 'cypress-fileupload' in the command.js file which resides inside the support folder within our Cypress project. Also, we shall add the file that we want to upload within the fixtures folder(Picture.png file).To upload a file, we have to use the Cypress command, attachFile, and pass the path of the file to be uploaded as a parameter to it.ExampleImplementationdescribe('Tutorialspoint Test', function ... Read More
214 Views
Cypress aliases are an important component that has multiple uses. They are listed below −Sharing ContextWe have to use .as() to alias something that we have to share. To alias objects and primitives, Mocha context objects are used. The aliased object can be accessed with - this.*.Mocha by default shares context for all the hooks applicable for the test and the alias properties are flushed post the execution of a test.describe('element', () => { beforeEach(() => { cy.wrap('eleone').as('x') }) context('subelement', () => { beforeEach(() => { cy.wrap('eletwo').as('y') ... Read More
595 Views
Scenario Outline is used to replicate the same Scenario with a different data set. Writing the same tests with different values is cumbersome and time taking. For instance, We can club the above two scenarios with the Scenario Outline.Thus, we see that a Scenario Outline should be accompanied by keyword Examples. A Scenario Outline is executed once for each of the rows appearing below the Examples segment.Also, we have seen that the Given step has the delimiter. It points to the header of the Examples table. SpecFlow shall put the values within this table before the task of matching ... Read More
5K+ Views
We can perform data-driven testing with the help of keyword Examples. We shall also take the help of keyword Scenario Outline to execute the same Scenario over multiple values.The data sets to be taken into consideration shall be passed below the Examples section one after another separated by | symbol. So, if there are three rows, we shall have three test cases executed from a Single scenario.Also, the Given step has the delimiter. It points to the header of the Examples table. SpecFlow shall put the values within this table prior to the task of matching a step with ... Read More
11K+ Views
The Background keyword is applied to replicate the same steps before all Scenarios within a Feature File.Background RulesLet us describe some of the rules while applying Background −It should be used for defining simple steps unless we are forced to bring the application to a state which requires complicated steps to be carried out. As requested by the stakeholders of the project.It should be brief and realistic.All the Scenarios should also be short and to the point.Background ExampleLet us see an example where we have used Background steps to be executed before all the tests in the Feature File. For ... Read More