test-generator READMEFeaturesThis extension allows you to generate automatically some test structure to help you cover that technical debt in case you didn't do your unit tests before. Is intended to work for angular components but you might also try it with other typescript files and let us know what happens. Release NotesThis extensión is only a beta so we are still developing and bugfixing Run a toolFrom the Run menu in Visual Studio Code, as shown in the image, or by pressing F5. Operate the toolWe can use three options configured in the tool: file unit test, unit tests of the entire project, unit test of a section of the component (function or method). File unit testWe open an Angular project. As shown in the image, right-click on a component that we want to test, and click on Test Generator: This File. In the same way, if we right-click inside an artifact or file open in the current editor, the option "Test Generator: This File" appears. Current selection Filewe select a method or function within a component, right-click in Test Generator:current file, will appear, generate a unit test for that method. Note: If the function or method already exists in the test file, it will be overwritten and remain in the same position. If it does not exist, it will appear at the end of the unit test file. All filesTo generate unit tests for all the files in the project, we have to use ctrl+shift+P and apply the command shown in the image "Test Generator: all typescript files" Another way to operate the toolWe can also run a file unit test by opening the commands in the top bar of the environment or by pressing CTRL+Shift+P. The image you provided shows the commands for the three methods we discussed earlier.
Note: The generation time will vary depending on the number of tests to generate |