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 3363
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
385 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
223 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
601 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
394 Views
Test-Driven Development is also known as the TDD. It consists of the below steps to be followed one-by-one −Step 1− Create a Test.Step 2− Verify if the test fails.If the test passes, create the second test.If the test fails, then move to Step 3.Step 3− Fix the test to make it pass.If the test passes, move to Step 4.If the test fails, then jump to Step 3.Step 4− Start code refractor and redo all the above steps till the development is done.Benefits of TDDThe benefits of TDD are listed below −The developer is required to apprehend the requirements to know ... Read More
2K+ Views
To execute the Feature file, we must add the implementation logic for each of the steps. To add the definition of the step in SpecFlow, the C# language is used. Thus, a Step Definition File contains methods developed in C# within a Class.The methods have annotations along with a pattern to connect the Step Definition to every matching step. SpecFlow shall run the code to execute the keywords in Gherkin.A Step Definition file is a link between the application interface and Feature File. For providing readability features, the Step Definition File can have parameters. This signifies that it is not ... Read More
3K+ Views
The SpecFlow test execution begins from the Feature File. Here all the Features and their corresponding Scenarios are explained in plain text. It has a dual role of serving as an automation element as well as for documentation. A Feature File consists of one or more Scenarios in form of a list.Feature File CreationOnce a SpecFlow project is created, go to the Solution Explorer, and expand it.Right-click on the Features folder. Click on Add, then select the option New Item.Add New Item pop-up comes up. Type SpecFlow Feature in the search box. Select the option SpecFlow Feature File from the ... Read More