Squaretest
  for IntelliJ IDEA
play_circle_filled
Squaretest for IntelliJ IDEA

Auto generate the boilerplate code required for your Java unit tests.

Watch the video to learn more!
Features

Generate a test-class for your Java class with one action

Use the configurable keyboard shortcut: ctrl+alt+k on Windows and Linux or cmd+shift+k on OS X to generate a test-class in either Java (1.7+) or Groovy. More...

The generated test-class contains appropriate boilerplate code

Squaretest automatically generates the following based on your source-class:
  • Code to construct the instance of the source-class and initialize its dependencies, in many cases
  • A test-method for each public and package-local method in the source-class, containing
    • Local-variables for the arguments required by the method
    • A local-variable for the expected returned-value
    • Code to invoke the method
    • An assertEquals() call or Groovy assertion statement to verify the returned value

Use a Velocity template to configure how the test-classes are generated

All aspects of the generated test-classes are determined by an Apache Velocity template. You can use one of the default templates included with Squaretest or create your own template. More...

Includes default Velocity templates for common test frameworks

Squaretest includes default Velocity templates for both Java and Groovy for the following test-frameworks and mocking frameworks.
  • JUnit4 with Mockito
  • JUnit5 with Mockito
  • Robolectric3 with Mockito
  • AndroidJUnit4 with Mockito

Robust default templates

All templates included with Squaretest detect and handle the following code-patterns in the source-class.
  • Class with dependencies provided in the constructor (the standard Java component)
  • Class with private, dependency-annotated fields (fields annotated with @Inject or @Autowired)
  • Class with package-local, dependency-annotated fields (common in Android apps using Dagger or Guice).
  • Class with static creator methods like parse(..) or from(..) but no package-visible constructor; i.e. the sealed abstract class and similar patterns
  • Abstract classes in general
  • Class containing only static methods; i.e. the Utils classes.
  • Singletons (traditional and enum)
  • Enums in general
  • Android activity (Robolectric3 and AndroidJUnit4 templates only)

Default templates contain Quick Settings

All templates included with Squaretest have Quick Settings, or variables set at the top of the file that can be used to set code-style and other settings. The Quick Settings include the following options.
  • Use special prefixes for test-class members containing dependencies and/or mocks
  • Use special prefixes for local-fields containing test-method parameters and/or mocks
  • Customize the name of the member or local-field used to store the instance of the source class.
  • Use static imports for initMocks and related methods
  • Use mocks for mockable parameters whose names end in listener or callback
  • Use custom initialization expressions for dependencies and test-method arguments of certain types. More...

Default values for common types

Squaretest uses default values for certain commonly-used types that you usually don't want to mock; e.g. dependencies and local-fields of type List will be set to Arrays.asList() instead of a mock or null. Squaretest recognizes 150+ default types from the following libraries.
  • The JDK 8
  • Apache Commons Lang 2 and 3
  • Google Guava
  • RxJava
Squaretest also selects default-values based on the libraries present on the test classpath; e.g. dependencies and local-fields of type Executor will use MoreExecutors.directExecutor() from Google Guava if it's available on the test classpath.

Configurable Project-Level and Module-Level Settings

Open existing unit-tests with the same keyboard shortcut

Before saving the generated test-class, Squaretest searches the project for a class with the same or similar canonical-name. If a match is found, Squaretest opens the existing test instead of creating a new one. Similar canonical-name means the canonical-name +/- 's'; e.g. if the test-class is named com.myapp.FooTest, the similar name is com.myapp.FooTests and vice versa.

This allows many users to use the same keyboard shortcut to quickly jump from a source-class to its test-class.

Configure where the unit-test file is opened

Squaretest can open the generated (or existing) unit-test file in the following ways, configured by the Application Settings.
  • In the same editor window as the source class.
  • In the editor window next to the source class if one is available.
  • In an editor window next to the source class, splitting the editor-window containing the source class vertically to create one if needed.

User Guide

Install
You can install the Squaretest plugin from the IntelliJ plugin repository by following the instructions below.
  1. Go to File | Settings | Plugins | Browse Repositories...
  2. Enter Squaretest in the search-bar at the top
  3. Select the Squaretest plugin, then click the Install button on the right.
Please note that the plugin is currently in beta; there may be bugs.
Getting Started
The best way to get started with Squaretest is to use it to create a test by following the instructions below.
  1. Open a file that you want to create unit-tests for
  2. Do one of the following
    • Press ctrl+alt+k on Windows/Linux or cmd+shift+k on OS X.
    • Choose Squaretest | Generate Test from the toolbar
  3. Follow the instructions on the Configure Squaretest Module Settings dialog.
    The options are as follows.
    • Test Language the language to create your tests in (either Java or Groovy)
    • Template the Apache Velocity template used to create your tests; the templates are named according to the test-runner and mocking framework they use.
    • Test Sources Root the directory in which Squaretest will create your tests (and any package directories required) for this module.
    • Promote Test Language and Template to Project Settings whether or not Squaretest will save the above Test Language and Template in the Project Settings or the Module Settings; the default setting works best for most users.
    • Module Configuration whether or not Squaretest should try to configure the settings for your other modules automatically when they are needed or show this dialog every time; the default setting works best for most users. See Module Configuration for more details.
    Clicking OK will save these settings and create your test-class. You can modify these settings later in the Squaretest Settings Menu described in the next section.
Settings
The Squaretest settings can be changed by doing the following.
  1. Go to File | Settings
    • Mac OS X Users: IntelliJ IDEA | Preferences
  2. Click the Squaretest option shown near the bottom of the list on the left.
The application, project and module-level settings are as follows.
Application Settings
These settings apply to the Squaretest application; i.e. all projects. The options are as follows.
  • Open the Test File specifies which editor window Squaretest should open the test-class in; options are:
    • In the active editor window
    • In the next editor window if one is available
      Squaretest will open the test-class in the editor window next to the active editor window if one is available; otherwise, it will open the test-class in the active editor window.
    • In the next editor window, creating one if needed
      Squaretest will open the test-class in the editor window next to the active editor window if one is available; otherwise, it will create a new editor window by splitting the active editor window vertically and open the test-class in the new window.
  • Template Manager this shows a dialog allowing you to delete or rename any templates you've created.
Project Settings
The Project Settings apply to an IntelliJ Project. They are as follows.
  • Test Language the language to create your tests in (either Java or Groovy)
  • Template the Apache Velocity template used to create your tests.
  • Module Configuration
    • Automatically configure when possible
      Squaretest will automatically configure the Module Settings the first time they are needed if the Project Settings contain a template and one of the following is true.
      • The module contains exactly one test-sources root, and the test-sources root contains source-files matching the template-language (Java or Groovy) in the Project Settings (the most common scenario).
      • The module contains exactly one Groovy test-sources root and the Project Settings contain a Groovy-template.
      • The module contains no test-sources roots and its dependent modules collectively contains exactly one test-sources root and that test-sources root contains source-files matching the template-language in the Project Settings.
    • Always ask to configure module settings
      Squaretest will always prompt the user to configure settings the first time a test is generated for a module.
Module Settings
The Module Settings apply to a specific module. They are as follows.
  • Test Language the language to create your tests in (inherited from the Project Settings by default)
  • Template the template used to create your tests (inherited from the Project Settings by default)
  • Test Sources Root the directory Squaretest will create your tests (and any package directories required) for this module
Keyboard Shortcut
The Squaretest keyboard shortcut can be changed by doing the following.
  1. Go to File | Settings | Keymap
  2. Expand the Plugins folder and then the Squaretest folder
  3. Double-click the Generate Test item and select Add Keyboard Shortcut.
  4. Set the desired shortcut, then click OK, then OK again.
Create Your Own Template
You can create your own template to use to generate tests by doing the following.
  1. Select a template in either the Project Settings or the Module Settings.
  2. Make changes to the template code shown in the editor (see the image below)
    Squaretest JUnit Generator Settings Menu
  3. Enter a name for your template in the textbox next to the Save Template As button.
  4. Click Save Template As, then OK
Delete or Rename Templates
You can delete or rename the templates you've created by clicking Manage All Templates in the Application Settings.
Template Best Practices
The Velocity templates included with Squaretest are organized into 4 parts. Most developers will only need to modify the first 2 parts to update the template to match their code-style and conventions. The parts are described below in the order in which they appear in the template-code.
1. Quick Settings
The first section of the template contains Quick Settings, or variables that configure common code-style settings and other aspects of the test-class that are applied throughout the template-code. See Quick Settings for details about each setting.
2. Test Class Rendering Code
This is the code that renders the test-class, including the package declaration, import statements and class definition. You can modify this code to match the conventions used in your tests; e.g. add @RunWith annotations, make the test-class extend a common base-class in your project or module, add comments between the mock variable declarations and the non-mock variable declarations, etc. See Template Data Model for the list of variables available to the test-class rendering code.
3. Helper Macros
This contains macros used to render parts of the test-class; e.g. renderTestMethods($methods). These macros are invoked in the Test Class Rendering Code and can be modified to change how parts of the test-class are created.
4. InitializeTemplateDataModel Macro
The initializeTemplateDataModel macro configures the data model based on the archetype of the source class and the Quick Settings. This macro is called immediately after the Quick Settings section and sets global variables describing how the test-class should be rendered. The global variables are set based on the source class's constructors, fields, methods, annotations and other factors. The variables set by the macro are described here and may be used in the Test Class Rendering Code and the Helper Macros.

Power users can modify this macro and its helper macros (defined below the macro) to add or change variables in the data model to accommodate their use-cases.

Users should follow the convention of using the initializeTemplateDataModel macro to add or modify variables in the data model, then update the Test Class Rendering Code to check for the new variables and change the output accordingly. This keeps the logic to configure the data model separate from the test-class rendering code and allows both to grow in complexity without becoming unmaintainable.
Formatting Tips
Squaretest is designed to allow users to make changes to the template without worrying about formatting. To accomplish this, Squaretest automatically performs several code-cleanup tasks on the generated test-class, described here. In general, users should follow the guidelines below.
  • Don't worry about organizing the import-statements
    • These will be organized according to your IDE code-style settings in the code-cleanup.
  • Use the fully-qualified, canonical-text when declaring members and variables; e.g. Variable.type.canonicalText.
    • These will be shortened automatically in the code-cleanup.
    • Using fully-qualified, canonical-text simplifies declaring variables with generic types.
  • Don't worry about having extra newlines (more than 1 empty-line) between sections of the test-class; those are removed in the code-cleanup.
  • Don't worry about over-indenting the Java-code or Groovy-code in your templates
    • The test-class will be formatted according to your IDE code-style settings in the code-cleanup.
Advanced Template Editing
Users making significant changes to the templates may wish to use a different editor. The following editors work well.
IntelliJ IDEA Ultimate
The IntelliJ IDEA Ultimate IDE includes a good Velocity editor plugin and comes with a free trial. Squaretest also implements the velocity.globalVariableProvider extension point in the Velocity plugin to provide limited code-completion suggestions and javadocs for some of the template variables. To use the editor, simply use the Squaretest plugin in IntelliJ IDEA Ultimate. Squaretest will automatically use the editor provided by the Velocity plugin in the Settings menu and Configure Squaretest Module Settings dialog.
Other Editors
Squaretest stores the user-created templates in the IntelliJ Template Manager, which stores them in files on the file system. You can edit these files using your editor of choice. Please do not rename them. Also note that you will need to restart IntelliJ IDEA after changing the files. The template files are stored in the following locations.
Windows <SYSTEM DRIVE>\Users\<USER ACCOUNT NAME>\.<PRODUCT><VERSION>\config\fileTemplates
Mac OS X ~/Library/Preferences/.<PRODUCT><VERSION>/fileTemplates
Linux ~/.<PRODUCT><VERSION>/fileTemplates

Template API

The Template API is the data model available to the Velocity template used to create the test-class. The Velocity variables that make up the data model are described in the sections below.
Quick Settings
The Quick Settings are variables set at the top of the default templates that can be used to set code-style and other settings. This section describes the Quick Settings available in the default templates included with Squaretest.

Name Type Description
$dependencyMemberNamePrefix String An optional prefix used for test-class members that contain dependencies for the source class. If set to "", the template-code will use your IDE code-style settings instead.
$mockDependencyMemberNamePrefix String Similar to $dependencyMemberNamePrefix but only applies to test-class members containing mocks.
$parameterLocalFieldNamePrefix String An optional prefix for local-fields that contain arguments for test-methods. If set to "", the template-code will use your IDE code-style settings instead.
$mockParameterLocalFieldNamePrefix String Similar to $parameterLocalFieldNamePrefix but only applies to local-fields containing mocks.
$sourceClass.testClassMemberName String The name of the member used to store an instance of the source class. The default value is determined by the IDE code-style settings.
$sourceClass.testClassLocalFieldName String This is similar to $sourceClass.testClassMemberName, but is used when storing an instance of source class in a local-field in the test-class.
$useStaticImportForInitMocks boolean This specifies whether or not MockitoAnnotations.initMocks and related methods should be imported with static-imports.
$useMocksForListenerAndCallbackParameters String If set to true, the template will use mocks for any mockable method parameter whose name ends in "listener" or "callback", ignoring case.
$initExpressionOverrides Map<String, Map> This sets custom initialization expressions for dependencies and method-parameters of certain types. The key is the canonical name of the type. The value is a Map containing the following keys and values.
Key Value
initExpression A String containing a Java expression that evaluates to an instance of the type.
importsRequired An optional List<String> containing the import lines required for the initExpression.
shouldStoreInReference A boolean indicating whether or not the value of the initExpression should be stored in a reference (local variable or test-class member) or used inline when needed.
The example below specifies that dependencies and method-parameters of type android.content.Context should have value: RuntimeEnvironment.application and that the expression RuntimeEnvironment.application should be used inline wherever the dependency is needed rather than stored in a reference.
#set($initExpressionOverrides["android.content.Context"] = {
  "initExpression" : "RuntimeEnvironment.application",
  "importsRequired" :  ["import org.robolectric.RuntimeEnvironment;"],
  "shouldStoreInReference" : false })
              
Data Model
Squaretest converts the source class (the class for which the test is being generated) into the following Data Model available to the Velocity template code.
Template Variables
Name Type Description
$sourceClass SourceClass Describes the class for which the test is being generated
$importsRequired Set<String> Imports required by various components in the SourceClass
$StringUtils StringUtils The StringUtils class from Apache Commons Lang 3
$CodeStyleUtils CodeStyleUtils The CodeStyleUtils class provides methods for obtaining recommended names for fields based on the IDE code-style settings.
$ListUtils ListUtils The ListUtils class provides methods for operating on lists.
Template Variables added by the initializeTemplateDataModel() Macro
The #initializeTemplateDataModel() macro, defined in the template-code, is invoked after the Quick Settings section in the default-templates and sets several variables used in the rendering logic. These variables are set based on the Quick Settings and the code-patterns used in the $sourceClass. The variables are described below.

Name Type Description
$dependencies List<Variable> Contains all fields the test-class should provide for the instance of $sourceClass
$memberFields List<Variable> A subset of $dependencies containing all fields that should be stored in members in the test-class.
$mockMemberFields List<Variable> A subset of $memberFields containing only fields that should be mocked.
$nonMockMemberFields List<Variable> A subset of $memberFields containing all fields that should not be mocked.
$sourceClassMemberNeeded boolean a boolean indicating whether or not an instance of $sourceClass should be created and stored in a member of the test-class.
$shouldUseInjectMocks boolean a boolean indicating whether or not @InjectMocks should be used to provide dependencies to the instance of the $sourceClass.
$shouldSetPackageLocalFields boolean a boolean indicating whether or not the test-class should provide dependencies to the $sourceClass by setting package-local fields.
$mocksNeeded boolean true if $sourceClass has at least one dependency that should be mocked.
$shouldCreateTestsForInstanceMethods boolean a boolean indicating whether or not test should be created for the instance methods in the $sourceClass.
$androidActivity
boolean This is only set in the Robolectric3 and AndroidJUnit4 templates. This is true if the $sourceClass is an Android Activity.
Template Variable Types
SourceClass
Property Name Type Description
name String Contains the name of the source class.
packageName String Contains the package-name from the package-declaration statement in source class.
allSuperTypes List<String> Contains the canonical names of all super types of the source-class.
type Type Contains the type of the source class.
testClassMemberName String Mutable field containing the name of the member used to store an instance of the source class. The default value is determined by the IDE code-style settings.
testClassLocalFieldName String Mutable field containing the name of the local-field used to store an instance of the source class. The default value is determined by the IDE code-style settings.
preferredConstructor Constructor Mutable field that, by default, contains longest constructor (constructor with the most arguments) with at least package-local access or higher (Public, Protected or Package Local).
publicConstructors List<Constructor> All public constructors in the source class, including the default-constructor provided by the java language spec if applicable.
protectedConstructors List<Constructor> All protected constructors in source class.
packageLocalConstructors List<Constructor> All package-local constructors in source class.
privateConstructors List<Constructor> All private constructors in source class
constructors List<Constructor> Contains all constructors in the class, including the default-constructor provided by the java language spec if applicable.
publicInstanceMethods List<Method> All public instance methods in the source class
protectedInstanceMethods List<Method> All protected instance methods in the source class
packageLocalInstanceMethods List<Method> All package-local instance methods in the source class
privateInstanceMethods List<Method> All private instance methods in the source class
instanceMethods List<Method> All instance methods in the source class.
publicStaticMethods List<Method> All public static methods in the source class
protectedStaticMethods List<Method> All protected static methods in the source class
packageLocalStaticMethods List<Method> All package local static methods in the source class
privateStaticMethods List<Method> All private static methods in the source class
packageVisibleStaticCreatorMethods List<Method> Contains all static methods that return an instance of source class and have package-local access or higher.
staticMethods List<Method> All static methods in the source class
methods List<Method> All methods in the source class
publicInstanceFields List<ClassMember> Contains all public instance fields in source class.
protectedInstanceFields List<ClassMember> Contains all protected instance fields in source class.
packageLocalInstanceFields List<ClassMember> Contains all package-local instance fields in source class.
privateInstanceFields List<ClassMember> Contains all private instance fields in source class.
instanceFields List<ClassMember> Contains all instance fields in source class.
publicStaticFields List<ClassMember> Contains all public static fields in source class.
protectedStaticFields List<ClassMember> Contains all protected static fields in source class.
packageLocalStaticFields List<ClassMember> Contains all package-local static fields in source class.
privateStaticFields List<ClassMember> Contains all private static fields in source class.
staticFields List<ClassMember> Contains all static fields in source class.
dependencyAnnotatedFields List<ClassMember> Contains all fields with a dependency-annotation (@Inject or @Autowired).
fields List<ClassMember> Contains all fields (static and instance) in the source class
enum boolean True if source class is an enum.
enumFirstValue String Contains the first value in the enum if source class is an enum; otherwise, returns null.
enumValues List<String> Returns the values in the enum if source class is an enum; otherwise, returns the empty list.
singleton boolean True if source class is a singleton; false otherwise.
singletonAccessExpression String The expression needed to access the instance of the singleton if source class is a singleton; e.g. getInstance(), instance(), INSTANCE; null otherwise. 
abstract boolean True if source class is abstract.
abstractClassBody String Contains the body of an anonymous instance of the abstract-class that contains stubs for all of the abstract methods.
hasGenerics boolean True if source class has one or more type-parameters.
Method
Property Name Type Description
name String The name of the method
parameters List<Variable> The method’s parameters
public boolean True if the method is public; false otherwise.
protected boolean True if the method is protected; false otherwise.
packageLocal boolean True if the method is package-local; false otherwise.
private boolean True if the method is private; false otherwise.
static boolean True if the method is static.
abstract boolean True if the method is abstract.
native boolean True if the method is native.
simpleGetter boolean True if the method is a simple-getter.
simpleSetter boolean True if the method is a simple-setter.
simpleGetterOrSetter boolean True if the method is a simple-getter or a simple-setter.
constructor boolean True if the method is a constructor.
returnType Type The return-type of the method or null if the method has none.
throwsException boolean True if the method throws an exception.
overloadSuffix String The suffix to append to the test-method name to avoid method-name conflicts in the test-class.
Constructor
Constructor is the same as Method, but implements Comparable<Constructor> such that it is ordered by number of parameters.
Variable
Property Name Type Description
declaredName String The declared name for the variable; For ClassMembers this property contains the name of the member this it was created from; for method-parameters, this contains the name of the parameter.
declaredNameWithoutPrefix String The declaredName with any prefixes removed; for method-parameters, this is just the declaredName; for ClassMembers, this is the name with any recognized leading prefix (_, __, m, my, our) removed.
final boolean True if the variable is declared to be final.
type Type The Type of the variable.
defaultInitExpression String Alias for type.defaultInitExpression.
initExpression String Alias for type.initExpression.
shouldBeMocked boolean Alias for type.shouldBeMocked.
shouldStoreInReference boolean Set to true by default; this may be modified by logic in the template code based on the Quick Settings.
testClassMemberName String For ClassMembers, this is the same as the declaredName; for method-parameters, this is determined based on the declared-name and the IDE code-style settings; this may be modified by logic in the template code based on the Quick Settings.
testClassLocalFieldName String For method-parameters, this is the same as the declared-name. For ClassMembers, this is determined based on the declared-name and the IDE code-style settings; this may be modified by logic in the template code based on the Quick Settings.
ClassMember
Name Type Description
Everything in Variable N/A N/A
public boolean True if the member field is public
protected boolean True if the member field is protected
packageLocal boolean True if the member field is package-local
private boolean True if the member field is private
Static boolean True if the member is static.
dependencyAnnotated boolean True if the member is dependency-annotated (annotated with @Inject or @Autowired).
final boolean True if the member is final.
Type
Name Type Description
canonicalName String Contains the canonical name of the type or null if the type has no canonical name, or the canonical name could not be determined.
canonicalText String Contains the canonical text of the type.
mockable boolean True if the type is mockable (non-final, non-static and not an enum)
array boolean True if the type is an array; false otherwise.
defaultInitExpression String The default expression used to obtain an instance of the class or “null” for types that are not Common Types.
initExpression String Mutable field set to defaultInitExpression by default. This may be modified by the template-code; see the Quick Settings initExpressionOverrides for details.
shouldBeMocked boolean Mutable field set to false for types with defaultInitExpressions != "null"; In all other cases, this is set to mockable; this may be modified by logic in the template-code based on the Quick Settings.
ListUtils
Method Return Type Description
filter(
  List<?> theList,
  String attributeName,
  Object attributeValue)
List<?>
Returns a new list containing items in the given list that have a property with attributeName that contains attributeValue.
max(List<T> theList)
T
Returns the max item in the list as determined by the items' implementations of compareTo(T). Type T must implement Comparable<? super T>.
min(List<T> theList)
T
Returns the min item in the list as determined by the items' implementations of compareTo(T). Type T must implement Comparable<? super T>.
nullToEmpty(List<?> theList)
List<?>
Returns theList if it is non-null and Collections.emptyList() otherwise.
CodeStyleUtils
Method Return Type Description
suggestMemberName(
  String className)
String
Returns the suggested name to use for a member of type className based on the IDE code-style settings.
suggestLocalFieldName(
  String className)
String
Returns the suggested name to use for a local-field of type className based on the IDE code-style settings.
StringUtils
This is the StringUtils class from Apache Commons Lang 3.6.
Newlines

Squaretest removes all but one trailing newline at the end of the generated unit-test file. This allows developers to have space between macros and comments without concern that they will appear in the unit-test.

Squaretest also replaces each group of 3 or more newlines in the generated unit-test file with 2 newlines. This removes the need for developers to add extra branching logic to templates to ensure the unit-test contains an appropriate number of newlines between sections.

Code Cleanup

Squaretest performs several, automated code-cleanup tasks on the generated test-class. These include the following.

  • Optimize imports according to the IDE code-style settings.
  • Shorten class references (replace fully-qualified names with imports)
    • This allows you to use fully-qualified names throughout the template without having them appear in the generated test-class.
  • Reformat all code in the test-class according to the IDE code-style settings.
    • This allows you to indent the template-code in a way that is easy-to-read, without having to worry about the generated Java-code being over-indented.

Template Recipes

Non-Standard Test-Package Structure

Q: What if my test classes don't follow the same package-structure as the source-class?

A: You can change the package-declaration statement in your template to match your module's test-structure; Squaretest automatically creates package directories according to the package-declaration statement in the generated test-class. E.g. suppose some of your source-classes are in com.foo.bar, but your test-classes needs to be in com.foo.test.bar. You can replace the package-declaration line in your template with the following.

package $sourceClass.packageName.replace('com.foo.bar', 'com.foo.test.bar');

Troubleshooting

IncorrectOperationException: Cannot create package 'com.foo' in source folder

This happens when IntelliJ does not recognize the Test Sources Root in your Module Settings as a test-source-folder.

  • If you are using Gradle or Android Studio, please ensure the Java and/or Groovy plugins are configured correctly.
  • If you are using IntelliJ as the build system, Right-click the folder | Mark Directory As | Test Sources Root.

Report Bugs

Track and report bugs and other issues with Squaretest here.

Forum

Please post questions or feedback about Squaretest below.

squaretest

Frequently Asked Questions

Which version of the Velocity Engine does Squaretest use to create the tests?
Squaretest uses a fork of version 2.0 of the Apache Velocity Engine.
Can Squaretest create unit-tests in Groovy?
Yes, Squaretest can create unit-tests for your Java classes in Groovy. It cannot create unit-tests for Groovy classes at this time, though.
Does Squaretest collect usage metrics?
The first time you generate a test, Squaretest will ask you to allow the anonymous collection of usage data. The data helps us identify problems with Squaretest and prioritize bug-fixes and improvements. You can enable or disable the collection of usage metrics in the Squaretest settings menu at anytime. See Usage Data for more details.
Does Squaretest send any data to the cloud?
Squaretest will anonymously send usage-data to the cloud if the customer has allowed it as described above. Squaretest also sends requests to the licensing system; these requests include data from your license if one is present. It does not make any other network requests.

The one exception to this is if you create and use a Velocity template that makes a network request; i.e. create a Velocity template that uses code like $sourceClass.getClass().forName("java.net.URL").getConstructors() to construct an instance of java.net.URL, and then calls the openConnection() method on the URL object; using a template like that to create unit-tests could cause Squaretest to make a network request.
Who stands behind Squaretest?
Squaretest LLC was founded by Nate Shevick, a 6+ year software developer. Nate worked for amazon.com for over 4 years before leaving to create Squaretest in 2017.
Is Squaretest affiliated with Square, Inc?
No. Squaretest is not affiliated with Square, Inc. in any way.
Where did the name Squaretest come from?
The Carpenter's Square is simple, easy-to-use and incredibly useful for carpentry and woodworking. Squaretest aims to be like the Carpenter's Square for writing unit tests.
Why not release Squaretest as Open Source?
Squaretest was created to help software developers avoid spending time and energy writing boilerplate code. Due to the complexity of software in general, this required a substantial development effort. Additionally, keeping Squaretest up-to-date with the latest coding conventions and test-frameworks requires sustained development effort. Supporting such a development effort requires funding.

Several open-source business models were considered. Unfortunately, none of them appeared to provide enough revenue to support the development required to create and maintain Squaretest.

Terms and Conditions

The Squaretest plugin may be used in accordance with the following Terms and Conditions.

Contact us

Please use the following emails to contact us.