Testing Flashcards

1
Q

What is the difference between black box and white box testing?

A

Internal system design is not considered in black box testing. Tests are based on requirements and functionality. White box testing (aka glass box) is based on knowledge of the internal logic of an application’s code. Internal software and code working should be known for this type of testing. Tests are based on coverage of code statements, branches, paths, conditions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is unit testing?

A

Testing of individual software components, modules, and methods. Typically done by the programmer and not by testers, as it requires detailed knowledge of the internal program design and code. May require developing test driver modules, stubs, or test harnesses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is integration testing?

A

Testing of integrated modules to verify combined functionality after integration. Modules are typically code modules, individual applications, client and server applications on a network, etc. This type of testing is especially relevant to client/server and distributed systems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is functional testing?

A

This type of testing ignores the internal parts and focus on the output is as per requirement or not. Black-box type testing geared to functional requirements of an application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is system testing?

A

Entire system is tested as per the requirements. Black-box type testing that is based on overall requirements specifications, covers all combined parts of a system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is regression testing?

A

Testing the application as a whole after the modification in any module or functionality to ensure new modules do not break old modules. Difficult to cover all the system in regression testing so typically automation tools are used for these testing types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between performance, load, and stress testing?

A

Performance testing is used to check whether system meets performance requirements under normal conditions. Load testing is used to check system behavior under heavy loads, such as testing of a web site under a range of loads and incrementally ramping up requests to determine at what point the system’s response time degrades or fails. In stress testing, the system is stressed beyond its specifications typically in spikes to check how and when it fails.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is acceptance testing?

A

Normally this type of testing is done to verify if system meets the customer specified requirements. User or customer do this testing to determine whether to accept application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the difference between alpha testing and beta testing?

A

“Alpha testing is a type of acceptance testing; performed to identify all possible issues/bugs before releasing the product to everyday users or public. The focus of this testing is to simulate real users by using blackbox and whitebox techniques. The aim is to carry out the tasks that a typical user might perform. Alpha testing is carried out in a lab environment and usually the testers are internal employees of the organization. Beta Testing of a product is performed by ““real users”” of the software application in a ““real environment”” and can be considered as a form of external user acceptance testing. Beta version of the software is released to a limited number of end-users of the product to obtain feedback on the product quality. Beta testing reduces product failure risks and provides increased quality of the product through customer validation. It is the final test before shipping a product to the customers.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is usability testing?

A

User-friendliness check. Application flow is tested, Can new user understand the application easily, Proper help documented whenever user stuck at any point. Basically system navigation is checked in this testing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

List the annotations in JUnit 4.

A

BeforeClass, Before, Test, After, AfterClass, Ignore, Suite, RunWith

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In what order are annotated methods executed?

A

BeforeClass –> Before –> Test –> After –> AfterClass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How many times are the Before and After methods executed?

A

Once for each method annotated as Test. Used for setup and teardown for each test case scenario.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Name some of the methods available in the Assert class.

A

assertArrayEquals, assertEquals, assertNotEquals, assertTrue, assertFalse, assertSame, assertNotSame, assertNull, assertNotNull, assertThat, fail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is test-driven development (TDD)?

A

Test-driven development (TDD) is an evolutionary approach to development which combines test-first development. In TDD, you write a failing unit test before you write just enough production code to fulfill that test and then refactor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is behavior-driven development (BDD)?

A

Similar to TDD, behavior-driven development uses a test-first develop later approach. The approach starts by writing a failing acceptance test, typically in a plain text / business and domain readable file. Then, developers write a failing unit test in a programming language, known as a step implementation. Then, as in TDD, you write just enough production code to fulfill that test and then refactor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is Cucumber?

A

Cucumber is a BDD framework that uses Gherkin as its domain-readable language and supports step implementations in a variety of languages, including Java and Ruby.

18
Q

What is Gherkin?

A

Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions. Gherkin serves two purposes: serving as your project’s documentation and automated tests. The Gherkin file describes the feature, scenarios, and scenario steps for the test. It can also contain test data examples and background data for preconditions. Gherkin supports over 60 spoken languages.

19
Q

What is feature file in Cucumber? What does feature file consist of?

A

Feature file in Cucumber is written in Gherkin and consists of parameters or conditions required for executing code. They are: Feature, Scenario, Scenario Outline, Given, When, Then, etc.

20
Q

What is step definition in Cucumber?

A

A step definition is a method definition in a programming language that is tagged with a regular expression that matches a step in the Gherkin feature file. When Cucumber executes the plain text, it will (for each step) look for a registered Step Definition with a matching Regexp. If it finds one, Cucumber will execute the method, passing all groups from the Regexp match as arguments to the method.

21
Q

Explain Given, When, Then.

A

Gherkin follows a standard series of steps: Given > When > Then. GIVEN is a set of preconditions, WHEN is the action(s) taken by the user, and THEN is the expected outcome.

22
Q

What is the difference between Scenario and Scenario Outline?

A

Scenario is one of the core Gherkin structures. Every scenario starts with the Scenario: keyword (or localized one), followed by an optional scenario title. Each feature can have one or more scenarios, and every scenario consists of one or more steps (given, when, then). Scenario Outlines allow us to more concisely express these examples through the use of a template with placeholders instead of copying and pasting scenarios to use different values which can quickly become tedious and repetitive. Scenario Outline must be followed by Examples.

23
Q

What is the difference between Examples and data tables?

A

Tables are arguments to steps, and they are handy for specifying a larger data set - usually as input to a Given or as expected output from a Then. While syntactically they are identical to tables in Examples, they have a different purpose. With Examples, the value substituted for the placeholder changes with each subsequent run of the Scenario Outline, until the end of the Examples table is reached.

24
Q

What is Background?

A

Backgrounds allows you to add some context to all scenarios in a single feature. A Background is like an untitled Scenario, containing a number of steps. The difference is when it is run: the Background is run before each of your Scenarios.

25
Q

What are the difference between JBehave and Cucumber?

A

“Although Cucumber and Jbehave are meant for the same purpose, acceptance tests are completely different frameworks •Jbehave is Java based and Cucumber is Ruby based •Jbehave are based on stories while Cucumber is based on features “

26
Q

What are the two required files to execute a Cucumber test scenario?

A

Gherkin feature file and Step definitions in Java or Ruby

27
Q

How do you allow dynamic test data in a feature file?

A

In your Gherkin feature file, you can designate a dummy value in the Examples table or DataTable. In your step implementation, you can check for this dummy value and replace it with dynamic data from some other source.

28
Q

What is the DataTable object in Cucumber JVM?

A

DataTable is the object used to receive arguments from Gherkin tables and examples. You can create a POJO that represents the data and can cast DataTable into a List or Map of your POJO type. This allows you to quickly translate Gherkin tables and examples into a collection of objects.

29
Q

What is Selenium?

A

Selenium (more recently named WebDriver) is a tool for automating web application testing, and in particular to verify that they work as expected. It is an automation testing tool that can open browsers, input text, click objects on the page, and more. The benefit of this tools is that it can almost replace much of manual testing for Web applications.

30
Q

What are the different drivers in Selenium?

A

InternetExplorerDriver, ChromeDriver, FirefoxDriver

31
Q

What are the different types of locators in Selenium?

A

“Selenium uses what is called locators to find and match the elements of your page that it needs to interact with. There are 8 locators strategies included in Selenium: Identifier , Id , Name , Link , DOM , XPath , CSS , UI-element “

32
Q

What is an assertion in Selenium?

A

Assertions in Selenium verify that the state of the application conforms to what is required or expected (much like JUnit). All Selenium Assertions can be used in three modes: assert, verify, and waitFor. For example, you can “assertText”, “verifyText”, and “waitForText”. When assert fails, the test is aborted. When verify fails, the test will continue but will log the failure. This allows a single assert to ensure that the application is on the correct page, followed by a bunch of verify assertions to test form field values, labels, etc.

33
Q

How do you type into a textbox with Selenium?

A

WebElement sendKeys method.

34
Q

How do you launch a Web browser using Selenium?

A

WebDriver get(url) method

35
Q

What is Xpath?

A

XPath is a syntax for defining parts of an XML document. XPath uses path expressions to navigate in XML documents. XPath contains a library of standard functions. XPath is a major element in XSLT

36
Q

What are the different types of waits?

A

Waiting is having the automated task execution elapse a certain amount of time before continuing with the next step. You should choose to use Explicit Waits or Implicit Waits.

37
Q

What is explicit wait?

A

An explicit waits is code you define to wait for a certain condition to occur before proceeding further in the code.

38
Q

What is implicit wait?

A

“An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. The default setting is 0. Once set, the implicit wait is set for the life of the WebDriver object instance. driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);”

39
Q

How do you select from a drop-down menu?

A

“Just wrap your WebElement into Select Object: Select dropdown = new Select(driver.findElement(By.id(““identifier””))); To select an option, you can do: dropdown.selectByVisibleText(““Option1””); or dropdown.selectByIndex(1); or dropdown.selectByValue(““value1””);”

40
Q

How do you use XML to input data into WebDriver tests?

A

“By integrating Selenium with TestNG. There are two ways by which we can achieve parameterization in TestNG: 1. Parameters annotation and TestNG XML file. 2. DataProvider annotation.”

41
Q

How would you manipulate dynamic content on a Web page?

A

“You can use Xpath to iterate through dynamically created content. Typically, generated content has a base HTML id or name with an index identifying each dynamic element. pageID:formID:pBlockID:pbTableID:1:dateColID pageID:formID:pBlockID:pbTableID:2:dateColID pageID:formID:pBlockID:pbTableID:n:dateColID”

42
Q

How would you automate a file upload using Selenium?

A

For those of you doing this locally, all you need to do is use the sendKeys command to type the local path of the file in any file field. This works in all drivers. When moving this test to a remote server, use the setFileDetector method to let WebDriver know that you’re uploading files from your local computer to a remote server instead of just typing a path.