review of an open source unit test tool- cucumber_presentation

21
Review of Cucumber Review of Cucumber Presented by Presented by Jabeen Shazia Iqbal Jabeen Shazia Iqbal CWID: 899287056 CWID: 899287056 June 19, 2016 June 19, 2016

Upload: jabeen-shazia-posses-h1-b-visa

Post on 22-Jan-2018

126 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Review of an open source unit test tool- Cucumber_Presentation

Review of CucumberReview of Cucumber Presented byPresented by

Jabeen Shazia IqbalJabeen Shazia Iqbal

CWID: 899287056CWID: 899287056

June 19, 2016June 19, 2016

Page 2: Review of an open source unit test tool- Cucumber_Presentation

Unit Testing Unit Testing The smallest testable part is called Unit, which has one or few inputs and The smallest testable part is called Unit, which has one or few inputs and

mostly has single output. mostly has single output.

It is required to validate these units whether the each unit of the software It is required to validate these units whether the each unit of the software performs as designed, Individual units/components of a software are testedperforms as designed, Individual units/components of a software are tested

Perform White Box Testing. Perform White Box Testing.

Developers perform this unit testing, but in some cases it may be Developers perform this unit testing, but in some cases it may be performed by the independent software testers as well.performed by the independent software testers as well.

The main purpose of this unit testing is to identify failures in the logic The main purpose of this unit testing is to identify failures in the logic and/or algorithms that helps to improve the quality of the code.and/or algorithms that helps to improve the quality of the code.

Page 3: Review of an open source unit test tool- Cucumber_Presentation

Motivation Motivation

→ To change or maintain the code, we would need more To change or maintain the code, we would need more confidenceconfidence

→ Codes are often reusable.Codes are often reusable.

→ To make the development of the software fast. To make the development of the software fast.

Page 4: Review of an open source unit test tool- Cucumber_Presentation

Cont..Cont..

→ The cost of fixing of the defects detected in the Unit Testing The cost of fixing of the defects detected in the Unit Testing would be less comparative to the cost of fixing of defects would be less comparative to the cost of fixing of defects detected in another test such as system or acceptance testing. detected in another test such as system or acceptance testing.

→ Debugging becomes easy. When a Unit test fails, only the Debugging becomes easy. When a Unit test fails, only the latest changes need to be debugged. latest changes need to be debugged.

→ Code after performing the unit testing is more reliable.Code after performing the unit testing is more reliable.

Page 5: Review of an open source unit test tool- Cucumber_Presentation

To perform Unit TestingTo perform Unit Testing

1. Create a Test Plan1. Create a Test Plan - - Test Plan is the document which has the Test Plan is the document which has the information about how the test will be performed, things to be tested, roles, information about how the test will be performed, things to be tested, roles, responsibilities, test environment, activities involved etc. responsibilities, test environment, activities involved etc.

2. Create Test Cases and Test Data2. Create Test Cases and Test Data - - Test case and Test Data documents Test case and Test Data documents are prepared using the sample format the Organization is adopting. Test are prepared using the sample format the Organization is adopting. Test Cases document will involve information such as Test case description, Cases document will involve information such as Test case description, expected result, actual result, pass/fail, etc… Test Data document will expected result, actual result, pass/fail, etc… Test Data document will involve information such as the inputs required to be created for the involve information such as the inputs required to be created for the specific function and condition, to perform the unit testing. specific function and condition, to perform the unit testing.

3. Write Test Scripts3. Write Test Scripts – If we going to automate the Test Cases, then – If we going to automate the Test Cases, then writing Test Scripts may results in saving time that is requited for testingwriting Test Scripts may results in saving time that is requited for testing

Page 6: Review of an open source unit test tool- Cucumber_Presentation

Cont..Cont.. 4.Write the actual code4.Write the actual code- Code is developed in such a way that these test - Code is developed in such a way that these test

cases gets pass when executed. cases gets pass when executed.

5.Once the code is ready to execute the test cases5.Once the code is ready to execute the test cases – Execution of the – Execution of the Test Cases, written in the above 2nd step, will be performed on the written Test Cases, written in the above 2nd step, will be performed on the written code. code.

6.Fix the bugs if any and re test the code6.Fix the bugs if any and re test the code - Result of the execution of - Result of the execution of code will be captured. If the no error pops up, the codes are ready to go. If code will be captured. If the no error pops up, the codes are ready to go. If not, alter the code in such a way to remove the error/bug occurred during not, alter the code in such a way to remove the error/bug occurred during execution. Once the code is updated, rerun the test cases on the updated execution. Once the code is updated, rerun the test cases on the updated code to validate whether the result turns out to be pass. code to validate whether the result turns out to be pass.

7.Repeat the test cycle until the “unit” is free of all bugs 7.Repeat the test cycle until the “unit” is free of all bugs - Tester need to - Tester need to keep updating the code, if the error/bugs appears until there is no bugs in keep updating the code, if the error/bugs appears until there is no bugs in that specific module.that specific module.

Page 7: Review of an open source unit test tool- Cucumber_Presentation

CucumberCucumber

Page 8: Review of an open source unit test tool- Cucumber_Presentation

CucumberCucumber

A testing framework driven by plain English textA testing framework driven by plain English text It supports all programming languageIt supports all programming language It behaves as a documentation and automated It behaves as a documentation and automated

tests tests

Page 9: Review of an open source unit test tool- Cucumber_Presentation

Cucumber FormatCucumber FormatGherkinGherkin is the format for Cucumber Specifications. Technically speaking it is a is the format for Cucumber Specifications. Technically speaking it is a small computer language with a well-defined syntax,small computer language with a well-defined syntax,

Feature: Feature: name of the feature goes herename of the feature goes hereDescription: Description: Write the description of this feature in this field.Write the description of this feature in this field.

Scenario: Scenario: Acceptance criteria scenario goes here.Acceptance criteria scenario goes here.GivenGivenWhenWhenAndAndThenThen

Page 10: Review of an open source unit test tool- Cucumber_Presentation

Procedure to use CucumberProcedure to use CucumberPre-requisite: Pre-requisite: RubyMine JetBrains – 30 Trial version is available RubyMine JetBrains – 30 Trial version is available Install CucumberInstall Cucumber

Steps to play with cucumber Steps to play with cucumber Step 01: Open the RubyMine JetBrains. Step 01: Open the RubyMine JetBrains. Step 02: Create folder as “feature” and create two files Step 02: Create folder as “feature” and create two files

FilenameForGherkinScripts.featureFilenameForGherkinScripts.feature Step_definationStep_defination

Step 03: Write the Gherkin Scripts in the .feature fileStep 03: Write the Gherkin Scripts in the .feature file Step 04: Run the .feature file Step 04: Run the .feature file Step 05: Check the errors throwed Step 05: Check the errors throwed Step 06: Paste the Gherkin Scripts and Write the actual Ruby Code in Step 06: Paste the Gherkin Scripts and Write the actual Ruby Code in

the Step definitions filethe Step definitions file Step 07: Again run the .feature file, repeat the steps 05 and 07 until all Step 07: Again run the .feature file, repeat the steps 05 and 07 until all

errors the are cleared out. errors the are cleared out.

Page 11: Review of an open source unit test tool- Cucumber_Presentation

Cucumber ProcessCucumber Process

Page 12: Review of an open source unit test tool- Cucumber_Presentation

GherkinScriptGherkinScript

Page 13: Review of an open source unit test tool- Cucumber_Presentation

Step_definationsStep_definations

Page 14: Review of an open source unit test tool- Cucumber_Presentation

Step_definationsStep_definations

Page 15: Review of an open source unit test tool- Cucumber_Presentation

Procedure Cont..Procedure Cont..

Run cucumber scripts again. Run cucumber scripts again. All steps, and therefore the entire scenario All steps, and therefore the entire scenario

should now be marked as “passed” should now be marked as “passed”

Page 16: Review of an open source unit test tool- Cucumber_Presentation

Merits of CucumberMerits of Cucumber This unit testing tool is the friendly and understandable by non technical userThis unit testing tool is the friendly and understandable by non technical user

The Given-When-Then syntax of Cucumber scenarios imposes some structure The Given-When-Then syntax of Cucumber scenarios imposes some structure on scenarios while leaving plenty of room for teams to grow their own on scenarios while leaving plenty of room for teams to grow their own language to describe their systemlanguage to describe their system

The style of writing test allows to reuse the gherkins scripts The style of writing test allows to reuse the gherkins scripts

Predictability and improve the confidence among testers and developersPredictability and improve the confidence among testers and developers

The separation of the three level of feature in the gherkin scripts makes it The separation of the three level of feature in the gherkin scripts makes it easier to reuse any part of the code easier to reuse any part of the code

As we know that interaction of Business and IT is not quite good. This As we know that interaction of Business and IT is not quite good. This cucumber makes the bond stronger between them by mentioning the cucumber makes the bond stronger between them by mentioning the customer’s executable specification to the team, helping them to be aware of customer’s executable specification to the team, helping them to be aware of the business goals in mind at all timesthe business goals in mind at all times

Page 17: Review of an open source unit test tool- Cucumber_Presentation

Cont..Cont.. Automation in cucumber lets the specification updated in the gherkins Automation in cucumber lets the specification updated in the gherkins

scriptsscripts

Automation leads to save the team from costly regression Automation leads to save the team from costly regression

Even the reuse of code is possible, since we write the features in Even the reuse of code is possible, since we write the features in separateseparate

Supports other language as well beyond Ruby like Java, Scala, Groovy Supports other language as well beyond Ruby like Java, Scala, Groovy etc.etc.

Quick and easy set up and executionsQuick and easy set up and executions

Cucumber focuses on end-user experienceCucumber focuses on end-user experience

Efficient tool for testingEfficient tool for testing

2.

3.

Page 18: Review of an open source unit test tool- Cucumber_Presentation

Demerits of CucumberDemerits of Cucumber

Extra code for converting the textual specification to Ruby codeExtra code for converting the textual specification to Ruby code

OneOne more layer between test description and the code (you need to more layer between test description and the code (you need to make sure the code really matches the description) make sure the code really matches the description)

Cucumber supports only web environmentCucumber supports only web environment

Page 19: Review of an open source unit test tool- Cucumber_Presentation

SummarySummary

Cucumber follows Behavioral Driven DevelopmentCucumber follows Behavioral Driven Development

First Business Analyst/Product Owner writes the Gherkin Scripts (in First Business Analyst/Product Owner writes the Gherkin Scripts (in normal English), then we run the Gherkin script. Finally we write code to normal English), then we run the Gherkin script. Finally we write code to make this script passmake this script pass

Cucumber supports all programming language not only RubyCucumber supports all programming language not only Ruby

Page 20: Review of an open source unit test tool- Cucumber_Presentation

ReferencesReferences

Unit Testing,Unit Testing, http://softwaretestingfundamentals.com/unit- http://softwaretestingfundamentals.com/unit-testing/testing/

Steps to perform Unit Testing,Steps to perform Unit Testing, http://www.exforsys.com/tutorials/testing/unit-testing.htmlhttp://www.exforsys.com/tutorials/testing/unit-testing.html

Cucumber,Cucumber, https://cucumber.io/#why https://cucumber.io/#why Procedure to perform cucumber and Pros/Cons,Procedure to perform cucumber and Pros/Cons,

http://www.slideshare.net/selvanathankapilan/cucumber-http://www.slideshare.net/selvanathankapilan/cucumber-gherkin-languagegherkin-language

Step by Step Procedure,Step by Step Procedure, https://www.jetbrains.com/help/ruby/2016.1/creating-step-https://www.jetbrains.com/help/ruby/2016.1/creating-step-definition.htmldefinition.html

Page 21: Review of an open source unit test tool- Cucumber_Presentation