EvoSuite / evosuite

EvoSuite - automated generation of JUnit test suites for Java classes
http://www.evosuite.org
GNU Lesser General Public License v3.0
832 stars 341 forks source link

how to show java source code after BytecodeInstrumentation.getTransformedBytes() #299

Open wangyg25 opened 4 years ago

wangyg25 commented 4 years ago

Context

Please provide below a detailed introduction to the issue itself, and describe what you were doing when the issue happened. Or, what do you want to achieve?

Steps to Reproduce

Please break down here below all the needed steps to reproduce the issue. [If possible, please upload an example of the project you are generating tests for.]

1. 2. 3.

EvoSuite Arguments

Please provide the whole EvoSuite commmand you executed (if relevant)

Current Result

Please describe here below the current result you got (if relevant) [if relevant, include a screenshot]

Expected result

Please describe here below what should be the expected behaviour (if relevant)

Additional info

Please add any information of interest here below

jose commented 4 years ago

Hi @wangyg25,

Not sure if I understood your question... Do you want to print out the source of the class under test after EvoSuite instruments it? Could you please provide more context on this?

-- Best, Jose

VoglSebastian commented 3 years ago

EvoSuite operates on Java Byte code. Consequently there is no source code after the transformation.

One could only write the .class-Files to the disc and generate new sources by decompiling them. This new sources would not contain any documentation and are missing some variable names.

I don't see an actual use case of this, because EvoSuite will add dependencies such that the class is probably not usefull in any other context.

In case you want to understand how EvoSuite works internally, I would recommend reading about EvoSuite/Test Generation instead of looking at Bytecode/Decompiled source code