Poles say "I have to write a test" because this is how you say it in Polish, but in English, at least in the US, it doesn't make sense. You take a test.
Which is not a problem really, because Polish sentence covers both(at least colloquially). ;-) Obviously, in this case, due to subject being 'my class', you default to the meaning of being tested and not creating a test, but for example "Muszę na jutro napisać test dla moich uczniów." would default to the other(and it would be a fair guess that the speaker is a teacher, too ;-) ).
I think Duolingo should put something like [CA] in from of that translation if it is actually possible. It would be nice if people knew what dialects were which.
Yes, I agree. Writing a test is what the teacher does so that the students can take it.
Ok then, just learned something. To say taking a test is "writing a test" . I was really baffled by this. I could see the literal translation but it didn't make sense to me. The best I came up with was "My writing class tests today." Although I realize that my translation is incorrect.