A
A
akass2014-10-08 17:23:47
Software testing
akass, 2014-10-08 17:23:47

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

3 answer(s)
A
azShoo, 2014-10-09
@akass

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.

M
Mingun, 2014-10-08
@Mingun

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>
      ]));
    });
  });
});

From the convenience - tests can be run both under Node.js and in the browser, it looks convenient.

V
Vladislav, 2014-10-09
@Div100

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 question

Ask a Question

731 491 924 answers to any question