You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Click the testFoo line in the call stack view, verify vscode views verify variable args shows j: 10 and this: Foo (id=^d) and this is expandable with only member bar: Bar (id=^d), the bar should not be expandable.
Change j to 32 and switch to stackframe Bar.testBar(int) (Bar.java:3) and switch back to Foo.testFoo(int) (Foo.java:6), input j + 1 in debug console and verify 33 is diplayed.
Add watch this.bar.toString() and verify the result "Bar@^d" (id=^d)
Add watch "test" + new Bar().hashCode() and verify the result "test^d" (id=^d)
Add watch bar.testBar(j + 10) and verify there is a message This is test method in bar. printed in debug console.
numbers are displayed in hex, and static variable is hiden and class names have been changed to fully qualified, str should be changed to "string ..." (id=0x^d)
add watch this.hashCode() verify the result should be hex format.
add watch str + str.length() in debug console, verify the result "string ..." (id=0x^d)
Open RecursiveTest.java, and set BP on line 8: return 1
Press F5 choose java and F5 again to start debug and wait for BP to be hit
Add watch number + 100 and verify the call stack list is a long list, and you can switch between them freely with changed arguments number and changed watch values
click on the Load More Stack Frames button, verify you can click on it continually. (The total stack frame count is 1000, and vscode will load 20 of them in one page, so you can click Load More Stack Frames button about 50 times), verify there is no PERFORMANCE issue (no delay more than 1 second during the test steps).
Select stack frame Foo.bar(int,int,Consumer) (Unknown Source:-1), add watch this.hashCode() - arg0 and verify an integer as the result, verify watch new Foo() results in Foo (id=^d)
create a new folder and create file build.gradle with the following text:
apply plugin: 'java'
// Redefine where to look for app and test code
// In this example, our code is structured as:
// project
// └── src
// ├── main
// │ ├── java
// │ └── resources
sourceSets {
main.java.srcDirs = ['src/main/java']
}
copy the src/main folder from prevous test case Maven Test to this folder.
Set BP on the println
Press F5 choose java and F5 again to start debug, verify the BP is hit
Press F5, verify program terminates with output Hello World!
Clone code from https://github.com/spring-projects/spring-petclinic.git
Open the cloned project and verify .project and .classpath files and target folder are generated.
Set BP on WelcomeController.java on line return "welcome"; and main on PetClinicApplication.java
Press F5 choose java and F5 again to start debug, verify the BP on main is hit.
Press F5 and verify the BP on main is hit again.
Wait for output 2017-11-23 20:23:25.230 INFO 9448 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
Open IE and navigate to http://localhost:8080, verify the welcome method is hit
Press F5 and verify page like spring-petclinic/target/classes/templates/welcome.html is displayed on IE with bad css.
Clone code from https://github.com/Microsoft/todo-app-java-on-azure.git
Open the cloned project and verify .project and .classpath files and target folder are generated.
Open file todo-app-java-on-azure\src\main\resources\application.properties and replaces it with a test configuration(see my email attachment)
Set BP on TodoListController.java on addNewTodoItem(@RequestBody TodoItem item) and main on TodoApplication.java
Press F5 choose java and F5 again to start debug, verify the BP on main is hit.
Press F5 to continue, open IE and open http://localhost:8080/#/TodoList and add a todo, press Button Add and verify the BP on addNewTodoItem is hit, wait a little time to load the stack frame.
Press F10 and then Press F5, verify the todo item is added.
Open file in folder 21.single-file.(Open folder or Open file)
Press F5, make sure it debugs well.
update the src to introduce a compilation error. For example, change String s = "1"; to String s = 1;. Then hit F5, check whether vscode pop out an error message "Build fails, do you want to proceed", click abort, make sure there is no more error message.
Open a project in vscode, and add a logpoint. The log message is the simple text message. If you want to print the expression, you need wrap it with a curly bracket { javaExpression }.
Launch java debugger and continue your program.
When the logpoint code branch is hit, it just log the message to the console and doesn't stop your program.
Activity
andxu commentedon Nov 23, 2017
Call Stack
Open test project
2.callstackOpen
Bar.java, set BP on line 3Press F5, verify for launch.json generated with right
projectNameandmainClassPress F5, verify for BP to be hit, verify variable args shows
i: 20andthis: Bar (id=^d)Verify the stackframe shows:
Click the testFoo line in the call stack view, verify vscode views verify variable args shows
j: 10andthis: Foo (id=^d)andthisis expandable with only memberbar: Bar (id=^d), the bar should not be expandable.Change
jto32and switch to stackframeBar.testBar(int) (Bar.java:3)and switch back toFoo.testFoo(int) (Foo.java:6), inputj + 1in debug console and verify33is diplayed.Add watch
this.bar.toString()and verify the result"Bar@^d" (id=^d)Add watch
"test" + new Bar().hashCode()and verify the result"test^d" (id=^d)Add watch
bar.testBar(j + 10)and verify there is a messageThis is test method in bar.printed in debug console.Press F5, verify program terminates.
andxu commentedon Nov 23, 2017
Multiple Thread
3.threadprintlnstatementjavaand F5 again to start debugandxu commentedon Nov 23, 2017
Variables
Open test project
4.variableSet BP on the last statement of
VariableTest#testPress F5 choose
javaand F5 again to start debug and wait for BP to be hitVerify
ishould be111nullstrshould benullstrshould be full displayed with 1000aobjectshould beObject (id=^d)and not expandabletestshould beVariableTest (id=^d)and expandable withx (VariableTest): 100,i:19099andx (Foo): 0ais not expandablebis displayed asClass (A) (id=^d)and expandb->classLoader, there should be no errors on logsintarrayshould have 3 integers1, 2, 3strListshould have childrensize: 2and expandableelementData, expandelementData, a long stringstring test aaaaaaa...should be displayedmapshould havesize: 1and expandabletablewith aHashMap$Nodechild.tshould have one elementhellogenericArrayshould be displayedString[10][] (id=^d)with first non-empty elementmultishould be displayedString[5][][] (id=^d)and two levels expandable tree nodes.dshould not be expandableddshould be displayed asGenericsFoo (id=^d)and should have one childx: Foo (id=^d)with only one childx: 0listshould have only one element ofint[1] (id=^d)at index0thisvariable should be displayedset value on
test->x (VariableTest), input value1, verifythis->x (VariableTest)has also been changed to1Open user settings and set
verify
strshould be changed to"string ..." (id=0x^d)add watch
this.hashCode()verify the result should be hex format.add watch
str + str.length()in debug console, verify the result"string ..." (id=0x^d)Press F5, verify program terminates.
andxu commentedon Nov 23, 2017
Big stack frame
6. recursivefunctionRecursiveTest.java, and set BP on line 8: return 1javaand F5 again to start debug and wait for BP to be hitnumber + 100and verify the call stack list is a long list, and you can switch between them freely with changed arguments number and changed watch valuesandxu commentedon Nov 23, 2017
Breakpoint and innner class
5.breakpointprintlnstatementnew A().n()System.out.println("middle");is hit, verify the watch result ismiddleSystem.out.println("inner");is hit, verify the watch result is displayed with red error messageSystem.out.println("anonymous");is hit and the watch result ismiddleSystem.out.println(j);is hit and the watch result ismiddleandxu commentedon Nov 23, 2017
Variable Performance Test
7.variableperformanceTooManyVariables.java, and set BP onSystem.out.println("variable perf test.")javaand F5 again to start debugandxu commentedon Nov 23, 2017
No Debug Information Test
8.nosourceNoSourceTest.java, and set breakpoint on line 4:System.out.println(i+10);javaand F5 again to start debug, verify the BP is hitFoo.bar(int,int,Consumer) (Unknown Source:-1), add watchthis.hashCode() - arg0and verify an integer as the result, verify watchnew Foo()results inFoo (id=^d)andxu commentedon Nov 23, 2017
Maven Test
mvn archetype:generate –DarchetypeArtifactId:maven-archetype-quickstartDefine value for property 'groupId'please inputcom.ms.samplesDefine value for property 'artifactId'please inputsimple-appsimple-appfolder using vscode.projectand.classpathfiles andtargetfolder are generated.printlnjavaand F5 again to start debug, verify the BP is hitHello World!andxu commentedon Nov 23, 2017
Gradle Test
build.gradlewith the following text:apply plugin: 'java' // Redefine where to look for app and test code // In this example, our code is structured as: // project // └── src // ├── main // │ ├── java // │ └── resources sourceSets { main.java.srcDirs = ['src/main/java'] }Maven Testto this folder.printlnjavaand F5 again to start debug, verify the BP is hitHello World!andxu commentedon Nov 23, 2017
PetClinic
https://github.com/spring-projects/spring-petclinic.git.projectand.classpathfiles andtargetfolder are generated.WelcomeController.javaon linereturn "welcome";andmainonPetClinicApplication.javajavaand F5 again to start debug, verify the BP onmainis hit.mainis hit again.2017-11-23 20:23:25.230 INFO 9448 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)http://localhost:8080, verify thewelcomemethod is hitspring-petclinic/target/classes/templates/welcome.htmlis displayed on IE withbadcss.andxu commentedon Nov 23, 2017
TODO application
https://github.com/Microsoft/todo-app-java-on-azure.git.projectand.classpathfiles andtargetfolder are generated.todo-app-java-on-azure\src\main\resources\application.propertiesand replaces it with a test configuration(see my email attachment)TodoListController.javaonaddNewTodoItem(@RequestBody TodoItem item)andmainonTodoApplication.javajavaand F5 again to start debug, verify the BP onmainis hit.http://localhost:8080/#/TodoListand add a todo, press ButtonAddand verify the BP on addNewTodoItem is hit, wait a little time to load the stack frame.ansyral commentedon Nov 28, 2017
Single file build
21.single-file.(Open folderorOpen file)String s = "1";toString s = 1;. Then hit F5, check whether vscode pop out an error message "Build fails, do you want to proceed", clickabort, make sure there is no more error message.testforstephen commentedon Nov 30, 2017
Console application
23.console-appin vscode.F5choose java and make surelaunch.jsonis generated.F5again to start debug.DEBUG CONSOLEview, verify the program is blocking at the linePlease input your name:.launch.json, change the optionconsoletointegratedTerminal.F5again.TERMINALview, and user can input his/her name there and the program continue to run.10.Go to
launch.json, change the optionconsoletoexternalTerminal.F5again, and the debugger will pop up an external terminal (e.g. cmd.exe).testforstephen commentedon Nov 30, 2017
Java 9 modular application
JAVA_HOME.19.java9-appin vscode.F5choose java and verifylaunch.jsonis auto generated.F5to start debug.breakpointandstepwork.Call Stack, it will open the associated source file in VSCode correctly.yaohaizh commentedon Nov 30, 2017
Multi-root
testforstephen commentedon Dec 12, 2017
Step Filters
19.java9-appin vscode.The new gif:

yaohaizh commentedon Dec 18, 2017
Hot Code Replace
24.hotCodeReplacein vscode.F5to start debug.reson the debug view of local variable which should benewandxu commentedon Mar 12, 2018
Conditional Breakpoints
simple-javain vscode, write the following code:package com.ms.samples; /** * Hello world! * */ public class App { public static void main( String[] args ) { int i = 0; for (; i <= 1000; i++) { if (i == 1000) { System.out.println( "Hello World!" ); } } System.out.println( "Hello World!" ); } }i ==1000, F5 and wait the breakpoint to be hityaohaizh commentedon Mar 28, 2018
Restart Frame
25.restartFramein vscode.F5to start debug.HelloWorld$1.run(), chooseRestart Frame. Result: It should fail with error message in the right corner.Persona.getInternalName(), chooseRestart Frame. Result: The program stop at the entry of getInternalNamePersona.getName(), chooseRestart Frame. Result: The program stop at the entry of getName. The above call stacks are popped.testforstephen commentedon Apr 13, 2018
Encoding Test for project under chinese directory
F5to start debug.testforstephen commentedon Apr 13, 2018
Encoding Test for text file encoding
System.out.println("中文字符3323").bsaby commentedon Apr 26, 2018
Caught and Uncaught exceptions test
simple-javain vscode, change code from line12 to line16 with following code:yaohaizh commentedon Apr 26, 2018
Restart Frame
25.restartFramein vscode.F5to start debug.sorg, the auto complete window will pop up with intellisense support.testforstephen commentedon Jun 27, 2018
Logpoint
{ javaExpression }.