Specifically, how can testers motive developers ?
This is actually a hard question. Especially the motivation piece. Some suggestions for that specific part:
- Be critical of code but not people who write it
- Be an easy-going fun flexible person to work with
- Develop good relations with programming managers
- Be enthusiastic about testing and how wonderful it can be
- Give lunch and learns on testing, TDD, BDD and their benefits
- Work with management on what criteria people are reviewed on
- Participate in application code reviews so help is a two-way street
More generally:
Teach TDD
Not the "code should be covered by tests at some point... version" but the
- Write a failing test
- Write the code to make it pass
version.
Also three keys thing: culture, refactoring and rewards($)
Culture:
Have lots of ongoing conversations about tests, unit tests, which tests to write, test good practices, when to write functional ui tests, how to manage overlap of tests, etc. Make testing a frequent topic of conversation in the group.
Refactoring:
As Niels pointed out, being able to refactor 'in safety' is a wonderful and amazing thing. It is part of culture but well worth calling out on its own! I recently wrote a bunch of bash scripts and ended up writing a small test framework just so I could refactor them. The ability to do the refactoring and run those tests as I was doing it was invaluable. Likewise the thought of changing them (whether refactoring, new features or bugs) was very scary. I guess I've bought into testing :)
Reward($):
Make sure that tests are part of developer employee evaluation and salary increases.
If you have old / legacy code*1 measure what is currently tested*2 and make a project to fill in the holes / untested application code. If code is older technology without tests, consider wrapping in newer tests.
*1 The best definition of legacy code I've seen is "the code you have in production today"
*2 Use a code coverage measure tool such as codecov, code climate, etc.