# Syntax Validation¶

The Poshi Standalone grade projects includes a validation task that can be used to check your code for syntax errors before running your test. To use this, simply run ./gradlew validatePoshi on your root directory. If there are no errors, the command runs successfully indicated by the message:

BUILD SUCCESSFUL in 1s


Errors in validation are descriptive and will point to the line of code where the error is. In the example below, there are two poshi errors:

1. The function ThisIsNotAFunction on line 12 of the LiferayLearnSearch.macro is not valid.

2. The macro command LiferayLearnSearch#search on line 12 of the LiferayLearn.testcase is not valid.

Exception in thread "main"
2 errors in POSHI

Unable to find class ThisIsNotAFunction at:
/L:/poshi-standalone/poshi-tests/macros/LiferayLearnSearch.macro:12
5 |            value1 = "${searchTerm}"); 6 | 7 | Default.AssertElementPresent.assertVisible(locator1 = "LiferayLearn#NO_RESULTS_MESSAGE"); 8 | 9 | } 10 | 11 | macro searchForTerm { > 12 | ThisIsNotAFunction( 13 | locator1 = "LiferayLearn#SEARCH_BAR"); 14 | 15 | Default.Type( 16 | locator1 = "LiferayLearn#SEARCH_BAR", 17 | value1 = "${searchTerm}");
18 |
19 |        Default.KeyPress(

Invalid macro command LiferayLearnSearch#search at:
/L:/poshi-standalone/poshi-tests/testcases/LiferayLearn.testcase:12

10 |   test CannotSearchForMyName {
at com.liferay.poshi.core.PoshiValidation._throwExceptions(PoshiValidation.java:1870)
11 |       task("When I search for my name") {
at com.liferay.poshi.core.PoshiValidation.validate(PoshiValidation.java:106)
> 12 |           LiferayLearnSearch.search(searchTerm = "yourNameHere");
13 |       }
14 |
at com.liferay.poshi.core.PoshiValidation.main(PoshiValidation.java:60)
16 |           LiferayLearnSearch.assertNoResults(searchTerm = "yourNameHere");
17 |       }
18 |
19 |   }

FAILURE: Build failed with an exception.

* What went wrong: