Quantcast
Channel: LoadRunner Practitioners Forum topics
Viewing all articles
Browse latest Browse all 3978

Execute Junit Test in Loadrunner using eclipse java program

$
0
0

Hi all,

**We wanted to run Junit Test in Loadrunner and below is the code written in eclipse:**
When i run the code in eclipse i get NoClassDefFoundError Exception. From Loadrunner Vugen Folder I zipped the **"lr.class"** file and imported it in the eclipse Jar libraries.

    import classes.lrapi.lr;
    import org.junit.Test;
   
    public class Jtst {

 
 @Test

 

    public void tst() {
     System.out.println("Tst method");
      try{   
  
 lr.start_transaction("T11");
 //lr.start_transaction("T1");
 System.out.print("Executing...");
 
 lr.end_transaction("T1",lr.PASS);
  }catch (Exception e){
   e.printStackTrace();
  }
    }
  
 public static void main(String args[]) throws ClassNotFoundException
 {
  System.out.println("Main");
  Jtst j1 = new Jtst(); 
  
  j1.tst();
  
 }
    }

**When i run the program I get the Exception NoClassDefFoundError Please find below the error message.**

    java.lang.NoClassDefFoundError: lrapi/lr
     at Jtst.tst(Jtst.java:16)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
     at org.junit.internal.runners.model.ReflectiveCallable.run

 


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>