How to call a java class from jmeter?

I wrote a simple java program:

package bsh;

import test.Testclass;

public class Whatever {

    public static void main(String args[]){
        Testclass t = new Testclass();
        System.out.println(t.squareIt(8));
    }
}


package test;

public class Testclass {

    public Testclass(){
    }

    public int squareIt(int i){
        return i*i;
    }
}

I have two questions about this java program:

  • How to execute this java program from jmeter?
  • How to call sqaureIt (int i) method from jmeter?

How can i achieve this?

+5
source share
3 answers

I have not tried the execution of the main class, but I certainly executed Junit test tests via Jmeter

Take a look at this Junitsampler tutorial document

+1
source

, Sudhakar...
TestCase .
test .
void, Java-.
, test.
, :

public class Whatever extends TestCase {

    public void testIt() {
        //test code here
        new Testclass().squareIt(5);
    }
}
0

JMeter -. , , - -, VisualVM .

-1

All Articles