101) How can a cucumber be integrated with Selenium WebDriver?

We can combine cucumber with selenium webdriver by adding everything dependence / pots related to selenium and cucumber in the project.


102) When is a cucumber used in real time?

Cucumber should be used to ensure the most important parts of application using end-of-life tests. BDD should also be used to ensure The required behavior is used in combination tests. Importantly, the business should be you are able to understand these tests, so you can reduce uncertainty and build self-confidence in what is constructive.


103) Give an example of a Background keyword in Cucumber?

Feature: Add items to shopping cart


Background: User is logged in

Given user navigate to login page

When user submits username and password

Then user should be logged in successfully


Scenario: Search a product and add it to shopping cart


Given user searches for dell laptop

When user adds the selected item to shopping cart

Then shopping cart should display the added item


104) How to extract a specific test method to the test case function using TestNG?

<suite name = "Sample Test Suite" verbose = "1">

<test name = "Sample Test">

<class>

<class name = "com.test.sample">

<pathways>

<exclude name = "TestA" />

</methods>

</class>

</class>

</test>

</suite>


105) How to exclude a particular group from a test case using TestNG?

<? xml version = "1.0" encoding = "UTF-8"?>

DOCTYPE PROGRAM suite "https://testng.org/testng-1.0.dtd">

<suite name = "Test Suite">

<group>

<gijima>

<exclude name = "integrated"> </exclude>

</run>

</groups>

<test name = "Test">

<class>

<class name = "TestNGGroupsExample" />

</class>

</test>

</suite>


106) How can you disable the test case in TestNG?

@Test (enabled = false)

empty public check () {

System.out.println ("This test has been disabled");

}


107) How can you ignore the test case in TestNG?

@Test (enabled = false)

empty public check () {

System.out.println ("This test is ignored");

}


108) What are the various ways to generate TestNG results reports?

There are two ways to report on TestNG :


Audience : Using the audience category, the class should use org.testng.ITestListener interface. These classes were notified during operation byTestNG where testing starts, ends, fails, skips, or passes.


Journalists - Using the reporting section, the section should use org.testng.Reporter interface. These sections are called where the whole suitethe end is over. The object that contains the details of every run is this transferred to this class when called.


109) How to write standard expressions in the testng.xml file to search for @Testmethods that contain the keyword "smoke"?

<? xml version = "1.0" encoding = "UTF-8"?>

DOCTYPE PROGRAM suite "http://testng.org/testng-1.0.dtd">

<suite name = "testSuite">

<test name = "test"> <iquass>

<class name = "sample">

<pathways>

<exclude name = "smoke. *" />

</methods>

</class>

</class>

</test>

</suite>


110) What unit of time do we specify for test suites and test cases?

The time period is Milliseconds


111) Write down different ways in which TestNG can be used?

  • Control Line
  • Maven
  • IDE

112) How can you use TestNG using Command Prompt?

Java -cp C: \ Selenium \ SampleTest \ lib \ *; C: \ Selenium \ SampleTest \ bin org.testng.TestNG testng.xml


113) What is the use of @Test (invocationCount = x)?

An invocationcount adjective tells how often TestNG should use the test way. In this example, the testCase method will be installed ten times:

@Test (pleadingCount = 10)

public void testCase () {

System.out.println ("How to Appeal");

}


114) What is the use of @Test (threadPoolSize = x)?

The threadPoolSize attribute tells TestNG to create a cable pool to use test using multiple strands. With a cable pool, it will significantly reduce the start time of the test method.

Example: Start a rope pool, which contains 3 strands, and use a test way 3 times

@Test (invocationCount = 3, threadPoolSize = 3)

public void testThreadPools () {

System.out.printf ("Id Thread:% s% n", Thread.currentThread (). GetId ());

}


115) What does the timeout mean in TestNG?

When using test methods there may be situations where certain test methods beats or may take longer than completion expectations. We need to manage these types of cases by defining Timeout and continue to do other cases / testing methods

@Test (timeOut = 5000)

public void executeTimeOut () casts InterruptedException {

Thread Sleep (3000);

}


116) What is a Unit?

JUnit is an open source unit for Java Testing Framework. Applicable to Java Engineers write and write repetitive tests.


117) What are Junit annotations?

  • @Test
  • @ParameterizedTest
  • @RepeatedTest
  • @TestFactory 
  • @TestTemplate
  • @Disable
  • @Tag
  • @Phela
  • @BeforeAll
  • @BeforeEach
  • @AfterEach
  • @TestInstance

118) How is TestNG better than JUnit?

  • TestNG supports more annotations than Junit
  • TestNG supports test format but Junit does not
  • TestNG supports a variety of audiences using annotations but Junit it is not
  • TestNG reports are better than Junit

119)What test cases need to be done automatically?

  • Tests that need to be done against all system build / release,such as smoke testing, hygiene testing and deferred testing.
  • Testing that requires conflict and many configurations - a different OS Browser integration.
  • Tests that perform the same functionality but use data that is different from its input each test works e.g. data processing.
  • Tests that involve inserting large volumes of data, such as over-fillinglong forms.
  • Tests that take a long time to do and may need to be done on time breaks or overnight.

120) When should I use Selenium IDE?

Because of its simplicity, Selenium IDE should only be used as a prototyping tool, not an overall solution for developing and maintaining complex test suites.


Post a Comment

Previous Post Next Post