Skip to content

Latest commit

 

History

History
521 lines (440 loc) · 22.7 KB

TestPlan.md

File metadata and controls

521 lines (440 loc) · 22.7 KB

Test Plan

Hello World

  1. Create a new folder helloworld, create a file named App.java in this folder and filling the following codes:
public class App 
{
    public static void main( String[] args )
    {        
        System.out.println( "Hello World!" );
    }
}
  1. Set BP on println
  2. Press F5, verify for launch.json generated with right mainClass
  3. Press F5, verify for BP to be hit, verify variable args shows like String[0] (id=%d)
  4. Add watch args.toString() + " test", verify the result like [Ljava.lang.String;@726f3b58 test
  5. Input args.toString() + " test" in debug console, verify the same result in debug console and it is expandable.
  6. Verify stack with thread list and on paused thread and one stack: App.main(String[]) (App.java:5)
  7. Press F10, verify Hello World! in debug console.
  8. Press F5, verify program terminates.

Call Stack

  1. Open test project 2.callstack

  2. Open Bar.java, set BP on line 3

  3. Press F5, verify for launch.json generated with right projectName and mainClass

  4. Press F5, verify for BP to be hit, verify variable args shows i: 20 and this: Bar (id=^d)

  5. Verify the stackframe shows:

     Bar.testBar(int) (Bar.java:3)
     Foo.testFoo(int) (Foo.java:6)
     CallStack.main(String[]) (CallStack.java:4)
     
  6. 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.

  7. 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.

  8. Add watch this.bar.toString() and verify the result "Bar@^d" (id=^d)

  9. Add watch "test" + new Bar().hashCode() and verify the result "test^d" (id=^d)

  10. Add watch bar.testBar(j + 10) and verify there is a message This is test method in bar. printed in debug console.

  11. Press F5, verify program terminates.

Call Stack

  1. Open test project 2.callstack

  2. Open Bar.java, set BP on line 3

  3. Press F5, verify for launch.json generated with right projectName and mainClass

  4. Press F5, verify for BP to be hit, verify variable args shows i: 20 and this: Bar (id=^d)

  5. Verify the stackframe shows:

     Bar.testBar(int) (Bar.java:3)
     Foo.testFoo(int) (Foo.java:6)
     CallStack.main(String[]) (CallStack.java:4)
     
  6. 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.

  7. 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.

  8. Add watch this.bar.toString() and verify the result "Bar@^d" (id=^d)

  9. Add watch "test" + new Bar().hashCode() and verify the result "test^d" (id=^d)

  10. Add watch bar.testBar(j + 10) and verify there is a message This is test method in bar. printed in debug console.

  11. Press F5, verify program terminates.

Variables

  1. Open test project 4.variable

  2. Set BP on the last statement of VariableTest#test

  3. Press F5 to generate launch.json and press F5 again to start debug and wait for BP to be hit

  4. Verify

    1. i should be 111
    2. nullstr should be null
    3. str should be full displayed with 1000 a
    4. object should be Object (id=^d) and not expandable
    5. test should be VariableTest (id=^d) and expandable with x (VariableTest): 100, i:19099 and x (Foo): 0
    6. a is not expandable
    7. b is displayed as Class (A) (id=^d) and expand b->classLoader, there should be no errors on logs
    8. intarray should have 3 integers 1, 2, 3
    9. strList should have children size: 2 and expandable elementData, expand elementData, a long string string test aaaaaaa... should be displayed
    10. map should have size: 1 and expandable table with a HashMap$Node child.
    11. t should have one element hello
    12. genericArray should be displayed String[10][] (id=^d) with first non-empty element
    13. multi should be displayed String[5][][] (id=^d) and two levels expandable tree nodes.
    14. d should not be expandable
    15. dd should be displayed as GenericsFoo (id=^d) and should have one child x: Foo (id=^d) with only one child x: 0
    16. list should have only one element of int[1] (id=^d) at index 0
    17. this variable should be displayed
  5. set value on test->x (VariableTest), input value 1, verify this->x (VariableTest) has also been changed to 1

  6. Open user settings and set

    "java.debug.settings.showHex": true,
     "java.debug.settings.maxStringLength": 10,
     "java.debug.settings.showQualifiedNames": true,
     "java.debug.settings.showStaticVariables": false, 
  7. verify

    1. 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)
  8. add watch this.hashCode() verify the result should be hex format.

  9. add watch str + str.length() in debug console, verify the result "string ..." (id=0x^d)

  10. Press F5, verify program terminates.

Big stack frame

  1. Open test project 6. recursivefunction
  2. Open RecursiveTest.java, and set BP on line 8: return 1
  3. Press F5 to generate launch.json and press F5 again to start debug and wait for BP to be hit
  4. 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
  5. 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).
  6. Press F5, verify program terminates.

Breakpoint and innner class

  1. Open test project 5.breakpoint
  2. Change the code to:
class A {

    void m() {
        System.out.println("outer");
    }

    String n() {
        return "outer";
    }
}

public class BreakPointTest {
    public static void main(String[] args) {
        new BreakPointTest().go();
        int j = 0;
        new A() {
            @Override
            void m() {
                System.out.println("anonymous");
            }
        }.m();
        for (int i = 1; i <= 100; i++) {
            if (i <= 99) {
                j++;
            } else {
                System.out.println(j);
            }

        }
    }

    void go() {
        new A().m();
        class A {
            String n() {
                return "inner";
            }

            void m() {
                System.out.println("inner");
            }
        }
        new A().m();
    }

    static class A {
        String n() {
            return "middle";
        }

        void m() {
            System.out.println("middle");
        }
    }
}
  1. Set BP on each println statement
  2. Add watch new A().n()
  3. Press F5 to start debug, verify the line System.out.println("middle"); is hit, verify the watch result is middle
  4. Press F5 again, verify the line System.out.println("inner"); is hit, verify the watch result is displayed with red error message
  5. press F5 again and verify the line System.out.println("anonymous"); is hit and the watch result is middle
  6. press F5 again and verify the line System.out.println(j); is hit and the watch result is middle
  7. Press F5, verify the program stops, verify no error in logs.
  8. verify the following messages in debug console
    middle
    inner
    anonymous
    99

Variable Performance Test

  1. Open test project 7.variableperformance
  2. Open TooManyVariables.java, and set BP on System.out.println("variable perf test.")
  3. Press F5 to generate launch.json and press F5 again to start debug
  4. Open debug view and expand the ‘this’ variable in variable view.
  5. Verify the time for expanding are less than 5 seconds
  6. Press F5, verify program terminates.

No Debug Information Test

  1. Open test project 8.nosource
  2. Open NoSourceTest.java, and set breakpoint on line 4: System.out.println(i+10);
  3. Press F5 to generate launch.json and press F5 again to start debug, verify the BP is hit
  4. Verify the following stack frames:
     NoSourceTest.lambda$0(Integer) (NoSourceTest.java:4)
     ^d.accept(Object) (Unknown Source:-1)
     Foo.bar(int,int,Consumer) (Unknown Source:-1)
     NoSourceTest.main(String[]) (NoSourceTest.java:3)
     
  5. 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)
  6. Press F5, verify program terminates.

Maven Test

  1. Open cmd.exe and create an empty folder and run mvn archetype:generate –DarchetypeArtifactId:maven-archetype-quickstart
    1. On Define value for property 'groupId' please input com.ms.samples
    2. On Define value for property 'artifactId' please input simple-app
    3. For other options, press Enter
  2. Open generated simple-app folder using vscode
  3. Wait and verify .project and .classpath files and target folder are generated.
  4. Set BP on the println
  5. Press F5 to generate launch.json and press F5 again to start debug, verify the BP is hit
  6. Press F5, verify program terminates with output Hello World!

Gradle Test

  1. 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']     
    }
    
  2. copy the src/main folder from prevous test case Maven Test to this folder.
  3. Set BP on the println
  4. Press F5 to generate launch.json and press F5 again to start debug, verify the BP is hit
  5. Press F5, verify program terminates with output Hello World!

PetClinic

  1. Clone code from https://github.com/spring-projects/spring-petclinic.git
  2. Open the cloned project and verify .project and .classpath files and target folder are generated.
  3. Set BP on WelcomeController.java on line return "welcome"; and main on PetClinicApplication.java
  4. Press F5 to generate launch.json and press F5 again to start debug, verify the BP on main is hit.
  5. Press F5 and verify the BP on main is hit again.
  6. 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)
  7. Open IE and navigate to http://localhost:8080, verify the welcome method is hit
  8. Press F5 and verify page like spring-petclinic/target/classes/templates/welcome.html is displayed on IE with bad css.
  9. STOP debug and do the test again from step 4

TODO application

  1. Clone code from https://github.com/Microsoft/todo-app-java-on-azure.git
  2. Open the cloned project and verify .project and .classpath files and target folder are generated.
  3. Open file todo-app-java-on-azure\src\main\resources\application.properties and replaces it with a test configuration(see my email attachment)
  4. Set BP on TodoListController.java on addNewTodoItem(@RequestBody TodoItem item) and main on TodoApplication.java
  5. Press F5 to generate launch.json and press F5 again to start debug, verify the BP on main is hit.
  6. 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.
  7. Press F10 and then Press F5, verify the todo item is added.

Single file build

  1. Open file in folder 21.single-file.(Open folder or Open file)
  2. Press F5, make sure it debugs well.
  3. 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.

Console application

  1. Open project 23.console-app in vscode.
  2. Press F5 choose java and make sure launch.json is generated.
  3. Press F5 again to start debug.
  4. See VSCode DEBUG CONSOLE view, verify the program is blocking at the line Please input your name:.
  5. Terminate debugger.
  6. Go to launch.json, change the option console to integratedTerminal.
  7. Press F5 again.
  8. See VSCode TERMINAL view, and user can input his/her name there and the program continue to run.
  9. Terminate debugger. 10.Go to launch.json, change the option console to externalTerminal.
  10. Press F5 again, and the debugger will pop up an external terminal (e.g. cmd.exe).
  11. User can input his/her name there and the program continue to run.

Java 9 modular application

  1. In your PC, install latest java 9 JDK, configure JAVA_HOME.
  2. Open project 19.java9-app in vscode.
  3. Press F5 choose java and verify launch.json is auto generated.
  4. Press F5 to start debug.
  5. Verify breakpoint and step work.
  6. Click Call Stack, it will open the associated source file in VSCode correctly.

Multi-root

  1. Clone code from https://github.com/spring-projects/spring-petclinic.git
  2. Clone code https://github.com/Microsoft/todo-app-java-on-azure.git
  3. Open both above projects in the same VSCode windows under workspace features
  4. Navigate to the Debug view
  5. Generate configuration for sprintclinic
  6. Generate configuration for TODO
  7. Check both launch.json to see the selected project's main are generated.

Step Filters

  1. Open project 19.java9-app in vscode.
  2. Follow gif to verify step filters feature. stepfilter

The new gif: stepfilters

Hot Code Replace

  1. Open project 24.hotCodeReplace in vscode.
  2. Set breakpoints: NameProvider.java line 12; Person.java line 13
  3. Press F5 to start debug.
  4. The program stopped at the Person.java line 13
  5. Change the value of the line "old" to "new"
  6. Save the document to trigger HCR. Check the breakpoint will stop at line 12
  7. Click F10 to step over, check the value of res on the debug view of local variable which should be new

Conditional Breakpoints

  1. Open project simple-java in 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!" );
    }
}  

  1. set conditional breakpoint on line 13 with condition i ==1000, F5 and wait the breakpoint to be hit

java-conditional-bp-demo

  1. verify i equals 1000 in variable window.
  2. F5 and wait for program to exit.

Restart Frame

  1. Open project 25.restartFrame in vscode.
  2. Set breakpoint: Person.java line 28
  3. Press F5 to start debug.
  4. The program stopped at the Person.java line 28
  5. Open the debug view, find the call stack of current breakpoint
  6. Right click the HelloWorld$1.run(), choose Restart Frame. Result: It should fail with error message in the right corner.
  7. Right click the Persona.getInternalName(), choose Restart Frame. Result: The program stop at the entry of getInternalName
  8. Right click the Persona.getName(), choose Restart Frame. Result: The program stop at the entry of getName. The above call stacks are popped.

Encoding Test for project under chinese directory

  1. Find some project under chinese characters directory.
  2. Open it in vscode.
  3. Press F5 to start debug.
  4. Verify the program can be launched normally.

Encoding Test for text file encoding

  1. Open a hello world project, and print System.out.println("中文字符3323").
  2. Press F5 to start debug.
  3. Verify the output in DEBUG CONSOLE view is correctly displayed.

Caught and Uncaught exceptions test

  1. Open project simple-java in vscode, change code from line12 to line16 with following code:
for (; i <= 1000; i++) {
     if (i == 1)  {
         throw new IllegalStateException();
      }
 }
  1. Open debug view and tick both Uncaught exceptions and Caught exeptions
  2. Press F5, verify progress stop at line 14
  3. Press F5 again, verify following messages in debug console
Exception in thread "main" java.lang.IllegalStateException
	at com.ms.samples.App.main(App.java:14)

Restart Frame

  1. Open project 25.restartFrame in vscode.
  2. Set breakpoint: Person.java line 28
  3. Press F5 to start debug.
  4. The program stopped at the Person.java line 28
  5. Open the debug console, input s or g , the auto complete window will pop up with intellisense support.

Logpoint

  1. 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 }.
  2. Launch java debugger and continue your program.
  3. When the logpoint code branch is hit, it just log the message to the console and doesn't stop your program.

logpoint

Start without debugging

  1. Open a Hello world project in VS Code.
  2. Set a breakpoint.
  3. Press Ctrl+F5 to start without debugging.
  4. Verify that the program starts without hitting the breakpoint.
  5. Open a spring-boot project in VS Code.
  6. Press Ctrl+F5 to start without debugging.
  7. Verify that the program starts, and there is no information in "watch" and "callstack" view.
  8. Click the "pause" button in the toolbar, it should NOT pause the program.
  9. Click the "stop" button in the toolbar, it should stop the program.

Environment Variables

  1. Open 26.environmentVariables in vscode.
  2. Press F5 to start.
  3. Verify the output in Debug Console should be as following:
    CustomEnv: This env is for test plan.
    SystemPath: <value of PATH >
    

Runtime classpath entry

  1. Open 27.runtimeClassEntry in vscode.
  2. Press F5 to start.
  3. Verify the output in Debug Console should be as following:
      Tomcat started on port(s): 8080 (http)
    

Resolve Variables

  1. Open 17.argstest in vscode.
  2. Change the launch.json as following:
"mainClass": "test.${fileBasenameNoExtension}",
"args": [  "\"${execPath}\"",
           "${env:APPDATA}",
           "${fileExtname}",
           "${workspaceRootFolderName}"]
]
  1. Make a BP at line one of main method, Keep ArgsTest.java open and press F5 to start.
  2. Verify the args has the values:
    • "C:\Users\andxu\AppData\Local\Programs\Microsoft VS Code\Code.exe"
    • "C:\Users\andxu\AppData\Roaming"
    • ".json"
    • "17.argstest"

Args and vmArgs

  1. Open 17.argstest in vscode.
  2. Change the launch.json as following:
 "mainClass": "test.ArgsTest",
 "args": ["a b", "foo \\\"bar"],
 "vmArgs": ["-Xms64M",  "-Xmx128M",  "-Dfoo= \\bar"]
  1. Add the following statement to get the properties:
 String foo = (String) System.getProperties().get("foo");
  1. Press F5 to verify the variables should be like this:

    args

Classpath shortener for long classpath project

  1. Open longclasspath project in VS Code.
  2. Append the following config to the launch.json:
  "shortenCommandLine": "none"
  1. Click Run or Debug CodeLens.
  • On Windows, it should pop up an error box saying "CreateProcess error"=206, The filename or extension is too long".
  • On Linux and Macos, it may succeed.
  1. On Windows/Linux/Macos, modify the launch.json with the following combinations. Click Run/Debug both should succeed.
  "shortenCommandLine": ""/"auto"/"jarmanifest"/"argfile", // argfile requires your Java version is 9 and higher.
  "console": ""/"internalConsole"/"integratedTerminal"/"externalTerminal"

Jump to source code when clicking stack trace in DEBUG CONSOLE

  1. Open 28.debugfeatures project in VS Code.
  2. Open StackTrace.java file.
  3. Click Run or Debug CodeLens, check the DEBUG CONSOLE. It's expected to render the source link for each stack trace line, and clicking the link should open the associated Java file in the editor.

image

Show the logical structure view for the Map and List variables

  1. Open 28.debugfeatures project in VS Code.
  2. Open LogicalStructure.java file, and add a breakpoint at line 30.
  3. Click Debug CodeLens, check the Variable viewlet.
  • emptyMap - non-expandable
  • bookset - Show two children (0: LinkedHashMap$Entry, 1: LinkedHashMap$Entry)
  • bigStore - Lazy loading the children and show the index range first [0..9999] ...
  • emptyList - non-expandable
  • list - Show two children (0: LogicalStructure$Foo, 1: LogicalStructure$Foo).
  • bigList - Lazy loading the children and show the index range first [0..9999] ...

image

Enable Java 12 preview for standalone Java files

  1. Install JDK-12.
  2. Open 28.debugfeatures project in VS Code, and open Java12Preview.java file.
  3. Uncomment "java.home" in ./vscode/settings.json.
  4. Run VS Code commmand Java: clean Java language server workspace, and click Restart and delete button in the prompted message box to reload VS Code.
  5. Add a breakpoint at line 7 of Java12Preview.java, and click Debug CodeLens. The debugger should run successfully.
  6. Open VS Code menu Help -> Open Process Explorer, find the Java Debuggger process in the Process Explorer. And its command line string should contain --enable-preview flag.

image