Monday 31 October 2022

TestNG Tutorial #3 How to use Hard Assertion in Selenium TestNg


In this video we are going to see what is hard assertion in testng


 

Hard Assertion

The Default build mechanism of assert is Hard assertion, and it’s stored in org.testng.assert package. We use this type of assertion when our requirement for the test execution should stop immediately is the assertions fail and will throw an assertion error. The test case also marked as failed when a hard condition fails.

Example:

package com.techbeamers.hardassertion;
import org.testng.Assert;
import org.testng.annotations.Test;
public class HardAssertion 
{
   String className = “HardAssertion”;

   @Test
   public void test_UsingHardAssertion() {
      Assert.assertTrue(true == true);
      Assert.assertEquals(“HardAssert”, “HardAssertion”);
      Assert.assertEquals(className, “HardAssertion”);
      System.out.println(“Successfully passed!”);
   }
}
...
FAILED: test_UsingHardAssertion
java.lang.AssertionError: expected [HardAssertion] but found [HardAssert]
...

Tuesday 9 August 2022

Appium| Locator strategies | Find elements in Native App Android, iOS

Locator strategies supported by Appium:

In the video we will see how to find element in different os Android and iOS when doing mobile automation testing:
ID Class Name Xpath Accessibility ID Android UI Automator Android View Tag (Espresso Only) iOS UI Automation


Refer part 2 here: https://mobiletestingtip.blogspot.com/2021/11/appium-locator-strategies-2-find.html

Tuesday 7 June 2022

Appium: Tap gesture using Touch Action Class

Appium: Tap gesture using Touch Action Class

While the Selenium WebDriver spec has support for certain kinds of mobile interaction, its parameters are not always easily mappable to the functionality that the underlying device automation (like UIAutomation in the case of iOS) provides. To that end, Appium implements the new TouchAction / MultiAction API defined in the newest version of the spec (https://dvcs.w3.org/hg/webdriver/raw-file/tip/webdriver-spec.html#multiactions-1). Note that this is different from the earlier version of the TouchAction API in the original JSON Wire Protocol. These APIs allow you to build up arbitrary gestures with multiple actuators. Please see the Appium client docs for your language in order to find examples of using this API. Note for W3C actions W3C actions is also available in some drivers such as XCUITest, UIA2, Espresso and Windows. W3C actions are implemented to the best of the limitations of the operating systems' test frameworks. e.g. WDA cannot handle zero wait PR. API doc and API docs of each client help to understand how to call them. An Overview of the TouchAction / MultiAction API TouchAction TouchAction objects contain a chain of events. In all the appium client libraries, touch objects are created and are given a chain of events. The available events from the spec are: * press * release * moveTo * tap * wait * longPress * cancel * perform



Sunday 8 May 2022

TestNG Tutorial #2 - How to Write Test Cases Using TestNG

How to write first test case in TestNg 
In this video we are going to see
  1. Setting Up A TestNG Project In IntelliJ?
  2. First Test Case With TestNG Downloading Selenium Jar Files For TestNG using maven 
  3. How To Create A TestNG Test Class In TestNG?

Saturday 8 January 2022

TestNG Framework introduction with intelliJ IDE | Setup Environment

Introduction to TestNG

From the the TestNg official site: TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing (testing a class in isolation of the others) to integration testing (testing entire systems made of several classes, several packages and even several external frameworks, such as application servers).

Writing a test is typically a three-step process:

  • Write the business logic of your test and insert TestNG annotations in your code.
  • Add the information about your test (e.g. the class name, the groups you wish to run, etc...) in a testng.xml file or in build.xml.
  • Run TestNG.
You can find a quick example on the TestNg Welcome page.

The concepts used in this documentation are as follows:

  • A suite is represented by one XML file. It can contain one or more tests and is defined by the <suite> tag.
  • A test is represented by <test> and can contain one or more TestNG classes.
  • A TestNG class is a Java class that contains at least one TestNG annotation. It is represented by the <class> tag and can contain one or more test methods.
  • A test method is a Java method annotated by @Test in your source.
A TestNG test can be configured by @BeforeXXX and @AfterXXX annotations which allows to perform some Java logic before and after a certain point, these points being either of the items listed above.

The rest of this manual will explain the following:

  • A list of all the annotations with a brief explanation. This will give you an idea of the various functionalities offered by TestNG but you will probably want to consult the section dedicated to each of these annotations to learn the details.
  • A description of the testng.xml file, its syntax and what you can specify in it.
  • A detailed list of the various features and how to use them with a combination of annotations and testng.xml.


Interview Experience with AMAZON for the role of Quality Assurance Tester

This role was for Digital/ IoT/Mobile Application based testing :)  Amazon is a dream company and everyone wants to work for that company a...

Popular Posts