Best EvoMaster code snippet using org.evomaster.client.java.instrumentation.shared.ClassName.getBytecodeName
Source:BranchCovMethodVisitor.java
...60 this.visitLdcInsn(latestVisitLine);61 this.visitLdcInsn(branchId);62 mv.visitMethodInsn(63 Opcodes.INVOKESTATIC,64 ClassName.get(ExecutionTracer.class).getBytecodeName(),65 ExecutionTracer.EXECUTING_BRANCH_JUMP_METHOD_NAME,66 ExecutionTracer.JUMP_DESC_1_VALUE,67 ExecutionTracer.class.isInterface()); //false68 break;69 //comparisons of 2 values70 case Opcodes.IF_ICMPEQ:71 case Opcodes.IF_ICMPNE:72 case Opcodes.IF_ICMPLT:73 case Opcodes.IF_ICMPGE:74 case Opcodes.IF_ICMPGT:75 case Opcodes.IF_ICMPLE:76 this.visitInsn(Opcodes.DUP2);77 this.visitLdcInsn(opcode);78 this.visitLdcInsn(className);79 this.visitLdcInsn(latestVisitLine);80 this.visitLdcInsn(branchId);81 mv.visitMethodInsn(82 Opcodes.INVOKESTATIC,83 ClassName.get(ExecutionTracer.class).getBytecodeName(),84 ExecutionTracer.EXECUTING_BRANCH_JUMP_METHOD_NAME,85 ExecutionTracer.JUMP_DESC_2_VALUES,86 ExecutionTracer.class.isInterface()); //false87 break;88 //object comparison89 case Opcodes.IF_ACMPEQ:90 case Opcodes.IF_ACMPNE:91 this.visitInsn(Opcodes.DUP2);92 this.visitLdcInsn(opcode);93 this.visitLdcInsn(className);94 this.visitLdcInsn(latestVisitLine);95 this.visitLdcInsn(branchId);96 mv.visitMethodInsn(97 Opcodes.INVOKESTATIC,98 ClassName.get(ExecutionTracer.class).getBytecodeName(),99 ExecutionTracer.EXECUTING_BRANCH_JUMP_METHOD_NAME,100 ExecutionTracer.JUMP_DESC_OBJECTS,101 ExecutionTracer.class.isInterface()); //false102 break;103 //null comparison104 case Opcodes.IFNULL:105 case Opcodes.IFNONNULL:106 this.visitInsn(Opcodes.DUP);107 this.visitLdcInsn(opcode);108 this.visitLdcInsn(className);109 this.visitLdcInsn(latestVisitLine);110 this.visitLdcInsn(branchId);111 mv.visitMethodInsn(112 Opcodes.INVOKESTATIC,113 ClassName.get(ExecutionTracer.class).getBytecodeName(),114 ExecutionTracer.EXECUTING_BRANCH_JUMP_METHOD_NAME,115 ExecutionTracer.JUMP_DESC_NULL,116 ExecutionTracer.class.isInterface()); //false117 break;118 default:119 /*120 NOTE: not so interesting to handle switch statements (at121 least for the moment...), as122 quite complex and not so super common anyway...123 */124 }125 super.visitJumpInsn(opcode, label);126 }127 @Override...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!