Answer the question
In order to leave comments, you need to log in
What is the easiest programming language to write tests in?
In addition to the usual popular c++ and java, is there any language by choosing which you can easily and quickly write tests? (unit)
I explain, they gave the task to write a function, cover with tests, evaluate the coverage. encountered yet. Ready to learn from scratch.
Answer the question
In order to leave comments, you need to log in
In almost any language, you can comfortably write tests, frameworks and libraries for this business in bulk.
For example: python - pyunit, py.test, robot framework, selenium
C# - the same selenium, nunit, testng.
Tests in Java, as mentioned above, are also quite easy to write.
In general, here you should rather choose a language that you know \ you like \ would like to learn for some reason \ in which it is more convenient to implement the function you need, and then google the framework for unit-\auto-tests in this language.
I think Jasmine for JavaScript is perfect. The test looks like this (test piece from the PEGjs project ):
describe("compiler pass |generateBytecode|", function() {
var pass = PEG.compiler.passes.generate.generateBytecode;
function bytecodeDetails(bytecode) {
return {
rules: [{ bytecode: bytecode }]
};
}
describe("for rule", function() {
it("generates correct bytecode", function() {
// Функция toChangeAST -- специально написанное расширение.
// Так можно написать любую тестирующую функцию
expect(pass).toChangeAST('start = "a"', bytecodeDetails([
14, 0, 2, 2, 18, 0, 19, 1 // <expression>
]));
});
});
});
It is quite convenient to write in Java, an example from Wiki:
import org.junit.Test;
import junit.framework.Assert;
public class MathTest {
@Test
public void testEquals() {
//указываем что значения должны быть равными
Assert.assertEquals(4, 2 + 2);
Assert.assertTrue(4 == 2 + 2);
}
@Test
public void testNotEquals() {
//указываем что значение должно должно быть false
Assert.assertFalse(5 == 2 + 2);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question