Found 33676 Articles for Programming

How to group test cases in Pytest?

Debomita Bhattacharjee
Updated on 19-Nov-2021 12:14:41

1K+ Views

We can group test cases in Pytest. Pytest is a test framework in python. To install pytest, we need to use the command pip install pytest. After installation, we can verify if python has been installed by the command pytest – version. The version of pytest shall be known.Pytest can be used for creating and executing test cases. It can be used in a wide range of testing API, UI, database, and so on. The test file of pytest has a naming convention that it starts with test_ or ends with _test keyword and every line of code should be ... Read More

What are fixtures in Pytest?

Debomita Bhattacharjee
Updated on 19-Nov-2021 12:10:34

303 Views

The fixtures are methods that shall execute before each test method to which it is associated in pytest. Pytest is a test framework in python. To install pytest, we need to use the command pip install pytest. After installation, we can verify if python has been installed by the command pytest –version. The version of pytest shall be known.Pytest can be used for creating and executing test cases. It can be used in a wide range of testing API, UI, database, and so on. The test file of pytest has a naming convention that it starts with test_ or ends ... Read More

How to exclude a test from execution in Pytest?

Debomita Bhattacharjee
Updated on 19-Nov-2021 12:09:05

6K+ Views

We can exclude a test from execution in Pytest. Pytest is a test framework in python. To install pytest, we need to use the command pip install pytest. After installation, we can verify if python has been installed by the command pytest –version. The version of pytest shall be known.Pytest can be used for creating and executing test cases. It can be used in a wide range of testing API, UI, database, and so on. The test file of pytest has a naming convention that it starts with test_ or ends with _test keyword and every line of code should ... Read More

How to execute a selected test from a collection of tests in Pytest?

Debomita Bhattacharjee
Updated on 19-Nov-2021 12:04:57

672 Views

We can execute a selected test from a collection of tests in Pytest. Pytest is a test framework in python. To install pytest, we need to use the command pip install pytest. After installation, we can verify if python has been installed by the command pytest –version. The version of pytest shall be known.Pytest can be used for creating and executing test cases. It can be used in a wide range of testing API, UI, database, and so on. The test file of pytest has a naming convention that it starts with test_ or ends with _test keyword and every ... Read More

What is a Pytest framework?

Debomita Bhattacharjee
Updated on 19-Nov-2021 12:01:45

698 Views

Pytest is a test framework in python. To install pytest, we need to use the command pip install pytest. After installation, we can verify if python has been installed by the command pytest –version. The version of pytest shall be known.Pytest can be used for creating and executing test cases. It can be used in a wide range of testing API, UI, database, and so on. The test file of pytest has a naming convention that it starts with test_ or ends with _test keyword and every line of code should be inside a method that should have a name ... Read More

What are some of the rules of creating a CSS expression?

Debomita Bhattacharjee
Updated on 19-Nov-2021 11:54:18

394 Views

There are some rules for creating a CSS expression. The CSS is one of the important locators in Selenium. A customized CSS can be developed with the help of attributes like id, class name, and by the combination of tagname and html attributes.The ways of creating a CSS are listed below −Using a class name html attribute.This will select the web element of that particular class represented by (.)classname.Syntax− driver. find_element_by_css_selector(".name")Here name is the value of the attribute class.Using an id html attribute.This will select the web element of that particular id represented by (#) id.Syntax− driver. find_element_by_css_selector("#search")Here search is ... Read More

How to use regular expressions in a CSS locator?

Debomita Bhattacharjee
Updated on 19-Nov-2021 11:50:54

5K+ Views

We can use regular expressions in a CSS locator. We can identify elements by matching their attributes partially with the help of regular expressions. In CSS, there are multiple methods to achieve this. They are listed below −Using the wild character *. This means the string contains our given text.Syntax− driver.find_element_by_css_selector("input[name*='sel']")It will search the input tag which contains the 'name' attribute containing 'sel' text.Using the wild character ^. This means the string starts with our given text.Syntax− driver.find_element_by_css_selector("input[name^='Tut']")It will search the input tag which contains the 'name' attribute starting with 'Tut' text.Using the wild character $. This means the string ... Read More

How to work with id locator in WebdriverIO?

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:51:12

1K+ Views

We can work with the id locator in WebdriverIO. Once we navigate to a webpage, we have to interact with the web elements available on the page like clicking a link/button, entering text within an edit box, and so on to complete our automation test case.For this, our first job is to identify the element. We can use the id attribute for an element for its identification. It is a very useful locator and speeds up the execution of automation tests in comparison to all the locators.In the WebdriverIO code, we have the option to specify the value of the ... Read More

How to perform drag and drop actions in WebdriverIO?

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:46:36

1K+ Views

WebdriverIO can perform mouse operations like drag and drop using the dragAndDrop method. With this, we execute clicking and holding events on the present object(source), then pass the object to the target element. Finally, release the mouse.Syntaxlet p = $('#loc') let t = $('#target') p.dragAndDrop(t)Here, p is the source locator and t is the destination locator.Let us perform the drag and drop functionality for the below elements −In the above image, the element with the name - Drag me to my target has to be dragged and dropped on the element - Dropped!.ExampleCode Implementation// test suite name describe('Tutorialspoint application', function(){ ... Read More

How to handle frames in Puppeteer?

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:31:43

3K+ Views

We can handle frames in Puppeteer. The frames in an html code are represented by the frames/iframe tag. Puppeteer can handle frames by switching from the main page to the frame. To work with elements inside a frame, first, we have to identify the frame with the help of locators. The method contentFrame is used to access the elements inside the frame.Syntaxconst f = await page.$("frame[name='frame-bottom']") const m = await f.contentFrame()Let us see the html code of an element inside a frame and obtain the text - BOTTOM inside it.The tagname highlighted in the above image is frame and the ... Read More

Advertisements