Software testing is any activity aimed at evaluating an attribute or capability of a program or system and determining that it meets its required results.
Questions tagged [testing]
28 questions
7
votes
2 answers
How can I quickly switch between source namespace and test namespace?
In Cider, I can use C-c , to run the tests for the current namespace. This will work whether I'm currently in the source namespace or the test namespace itself (and indeed, this magic behavior is discussed in detail in the README).
Given that Cider…

Sam Estep
- 449
- 5
- 20
5
votes
3 answers
Running all tests in a leiningen project?
Is there a way, via cider or some other emacs extension, to run all of the tests in a leiningen project?
cider has the function cider-test-run-tests which attempts to just run the tests
related to the code in the current buffer. That's fine, but…

abingham
- 927
- 6
- 18
5
votes
1 answer
Debug pytests in emacs
I try to debug my pytest-cases like this:
import pytest
def test_something()
...
...
pytest.set_trace()
Then, i execute the tests by running elpy-test. The test starts to
run and stops at pytest.set_trace() - unfortunately…

Markus
- 471
- 2
- 12
4
votes
1 answer
How can I test an idle timer with ERT?
Say I have a function that is called on an idle timer:
(defun tmp:create () (mkdir "test"))
(run-with-idle-time 3 nil #'tmp:create)
How can I test that this function works?
Using something like
(ert-deftest async () ""
(should-not (file-exists-p…

Sean Allred
- 6,861
- 16
- 85
4
votes
2 answers
projectile-rails: run the current test
While it is easy to run the whole test suite with projectile-rails, this takes too much time. I'd like to be able to run the current test (i.e., the test point is located in) with a shortcut. Is this possible?

ckruse
- 457
- 3
- 12
3
votes
1 answer
How do I temporarily mock a function for testing?
I'd like to patch some elisp functions inside my unit tests. I've tried cl-labels and cl-flet, but neither achieve the result I want:
(defun return-number ()
1)
(defun calls-return-number ()
(return-number))
(defun patch-cl-labels ()
…

Wilfred Hughes
- 6,890
- 2
- 29
- 59
3
votes
0 answers
Emacs Lisp performance regression testing
I'm trying to find a way to implement ERT tests for performance of some elisp code. For that to work I need to have a stable performance metric.
Is there a stable performance metric I could use?
It is okay if Emacs version is fixed.
My attempt is…

Gracjan Polak
- 1,082
- 6
- 21
2
votes
4 answers
How can I 'test' changes to my .emacs.d/init.el?
I'll often make changes to my init.el and find that after I M-x load-file, the results can be different next time I open emacs. Or maybe while one thing I modified gets better, something else gets clobbered and I want to revert. However, I may…

Mittenchops
- 289
- 1
- 8
2
votes
2 answers
How can I skip a test if another test failed?
Say I have two tests:
(defun func-one () nil)
(defun func-two () (and (func-one) t))
(ert-deftest test-one ()
"Test basic functionality"
(should (func-one)))
(ert-deftest test-two ()
"Test advanced functionality"
(should (func-two)))
How…

Sean Allred
- 6,861
- 16
- 85
2
votes
1 answer
Accessing resource files in ERT tests
I'm trying to use ERT to test the ycmd package, and part of what I need to do is pass bodies of code to the ycmd server and ask for completion candidates. I'd like to be able to keep these bodies of code in separate files, partly for organization…

abingham
- 927
- 6
- 18
2
votes
1 answer
Find corresponding test file
Newbie question here.
In intellij there is Ctrl-Shift T to go to the corresponding test file. (For java at least.) I would like something similar in emacs. Something like this:
For a language (or project) there need to ba a mapping between source…

froderik
- 155
- 1
- 6
2
votes
2 answers
Pending test in Ert
I'm currently starting to build a package the TDD way, and for that I'm using ert, following ert-runner opinions.
I would like to write a set of pending tests, to identify what I have I to test, before to implement the test.
Is it possible to write…

AdrieanKhisbe
- 209
- 1
- 10
1
vote
1 answer
How do I change the python layer test command
I'm writing an app in python, which I will run in docker. Therefore I want to test it in docker as well. I'm working in spacemacs and want to use the tools available to test.
With projectile this is possible, I can call projectile-test-project and…

Harm
- 21
- 3
1
vote
1 answer
unread-command-events and batch mode
I'm writing tests for an interactive function. I've been using the unread-command-events variable in conjunction with call-interactively to verify that it does the right thing.
However, I just discovered that this doesn't work in batch mode.
For…

Lindydancer
- 6,095
- 1
- 13
- 25
1
vote
1 answer
Enforce order of ERT tests?
When running ert tests, the seem to be run by default in string< order. For instance running tests
(require 'ert)
(ert-deftest t1111 () (print 'AAAA))
(ert-deftest t3333 () (print 'BBBB))
(ert-deftest t2222 () (print 'CCCC))
(ert-run-tests-batch…

kdb
- 1,561
- 12
- 21