Skip to content

Jmeter_Learning_Path_For_Functional_Testing

Rajendra Prasad Reddy Penumalli edited this page Sep 12, 2019 · 19 revisions
java -jar dir/swagger-codegen-cli.jar \
generate \
-i resources/2_0/petstore.yaml \
-l jmeter \
-o ~/Downloads/swagger-petstore-gen-jmeter
  • Assertions
    • Using builtin elements
    • Using Groovy Assertion:
      • PASS: SampleResult.setSuccessful(true);
      • FAIL:SampleResult.setSuccessful(false);
  • Data Types Used in Jmeter
    • Static data specific to the environment
      • Login Credentials
      • Host
      • port
    • Dynamic Data that can be generated on the fly
      • Unique Data that can be used for only one time
      • Stamps
      • Conditionally generated Data
      • Resource ID
  • Variables and Properties:
    • User-Defined Variables
      • Scope
      • Defining @ Project Level
      • Defining UDV Element
      • Getting via Groovy
    • Variables
      • Scope: Local to a thread
      • Defining @ ThreadGroup Level
      • Creating via Groovy
      • Getting/passing variable between the steps via Groovy
      • Sharing object between the steps via Groovy
    • Properties
      • Scope
      • Passing From Command Line Interface in Headless mode
      • Creating via Groovy
      • Getting via Groovy

Creating Robust Script that can run on multiple Environments

  • Parameterisng request with Variables and Properties
  • Parameterisng request body with Variables and Properties

Managing Session across:

  • Config Element Cookie Manager
  • Groovy Way extracting and passing cookie as header manager
  • Samples
  • Thread Groups

Looping

  • Executing Only once
  • Executing a Sample/Request in a loop or Until State Changes to Expected Value
    • With Some Delay between repetitions
    • With Max_Timeout value
    • With Max_Count of the repetition count

Functions in Jmeter

  • ${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}
  • ${__groogy(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}
  • ${__time(dd/mm/yyyy,)}

Correlation

Branching

  • if Controller
  • While loop controller

Designing Test

  • Grouping Samplers using Simple Controller
  • Modularsing Test Divide and Concur
  • Identifying Common blocks and keep them in fragments and call them using Module Controller
  • Identifying Common blocks and keep them in fragments and call them other JMeter scripts using include Controller

Clearing Stray Data of Previous Runs

Debugging Options

  • Console log
  • Properties view
  • Debug Sampler

Options for Running in Headless Mode

  • -n, --nongui run JMeter in nongui mode
  • -J, --jmeterproperty =
  • -l, --logfile logfile name
  • -q, --addprop additional JMeter property file(s)
Note: jmeter --help list all command line arguments

Sample Project Hiearachy

-- Test fragment (login)
  -- HTTP Cookie Manager
  -- HTTP Request (post with username and password)
-- Test fragment (logout)
  -- HTTP Cookie Manager
  -- HTTP request (includes cookie)

--Thread Group
  -- Transaction Controller
    -- Module Controller (login)
    -- HTTP Cookie manager
    -- HTTP Request
    -- Module Controller (logout)
-- Results Tree

Tips :

  • Command alias for jmeter
  • Shortcuts for toggling elements Ctrl+t
  • Creating script that can run accross environments (dev,qa,stg,prod)
  • Loading Data from Project Path
    • with a subfolder for each environment

Clone this wiki locally