In finite element method, one wants to derive a so-called weak form of the differential equation to solve. This latter is obtained by multiplying both sides of the equation by a "test function" then apply the Green theorem.This test function is written as a sum of shape functions and nodal values, these nodal values can finally be simplified from the equation.
Now in mechanical problems (for instance in linear elasticity), I often read "principle of virtual work", where they apply a "virtual displacement" to the body then equal the external and internal work. The resulting finite element formulation is similar, is this actually the same thing as the general "test function" ?
To the best of my knowledge, both the weak form and virtual work are identical. At least in the mechanic's context. However, the concept of weak form is general and applies to non-mechanical systems too. The idea behind the weak form is-- instead of finding a solution to the differential equations (strong form), multiply the differential with a test function and find a solution over the complete domain. Since the test function is arbitrary, so solutions to both weak form and differential equations are identical. In the finite element method, we replace the test functions with the basis functions.