You must not have whitespace around the =
sign in variable assignments. Replace this:
SET tableName = testDB
with this:
SET tableName=testDB
Also, you shouldn't have double quotes around the value in a variable assignment, because that way the double quotes will become part of the value. It's better practice to put double quotes around the whole assignment, and then quote the variable as necessary when it's used, e.g.:
set "tableName=testDB"
set "dumpTable=SET NOCOUNT ON; SELECT * FROM %tableName%"
sqlcmd -d database -q "%dumpTable%"