Questions tagged [testing]
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.
29 questions
0
votes
0
answers
24
views
Create an Ert-test environment that does not depend on Emacs customization variables or hooks
"The outcome of running a test should not depend on the current state of the environment, and each test should leave its environment in the same state it found it in. In particular, a test should ...
3
votes
4
answers
487
views
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 ...
0
votes
1
answer
50
views
Testing lexically-bound, nested functions with ERT
I am experimenting with writing elisp in a more scheme-y style where helper functions are definded inside another function's lexical envirnonment like this (with lexical binding turned on):
(defun my-...
1
vote
1
answer
180
views
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 ...
0
votes
1
answer
48
views
Org-babel: Notify if the result of execution differs from the previous recorded result
I want to use my org-mode documentation as a sort of quasi-unittest; I want to execute the whole buffer, and be notified if marked cells' new results differ from their previous results. E.g,
#+...
1
vote
1
answer
91
views
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 ...
1
vote
1
answer
78
views
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-...
2
votes
1
answer
106
views
How to automate user-testing with elisp?
Is it possible to automate testing user input?
An example of this could be multiple editing operations, undo, saving, reverting the buffer etc. Then checking the buffer contents is what the test ...
1
vote
1
answer
303
views
install dependencies for emacs package in a CI environment
I am testing an Emacs package on Travis CI with ert. A PR now requires the s package. This is how I currently make sure it's available in the test environment:
script:
- $EMACS --version
- $EMACS ...
0
votes
1
answer
117
views
How do I let ert know where my tests are defined?
What I'm doing:
If I define a test like:
(ert-deftest tmp-test ()
"failing test"
:expected-result :failed
(should (eql (+ 1 0) 2)))
and then I run
M-x ert-run-tests-automatically ;; ...
-1
votes
1
answer
72
views
What is the equivalent of Ruby's "rake test" for project elfeed?
In a ruby/rails project, the "standard" way to run "the test suite" is
rake # alias for rake test
Some projects will mention (when there's a deviation)how to run tests in their README.
How do you ...
0
votes
1
answer
259
views
Testing Emacs Lisp Code Involving Org Mode
I'm trying to figure out how I can use ERT and libraries like el-mock to test simple functions that manipulate my org-document.
Consider a function like this:
(defun promote-next-heading ()
(org-...
0
votes
0
answers
160
views
How do you run tests in anaconda mode?
Elpy has support for running test using your test runner.
Looking at anaconda it does not seem to do the same functionality is there a package that can detect all your tests and let you run them ...
5
votes
1
answer
2k
views
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 ...
0
votes
1
answer
219
views
How to run rspec from the emacs shell?
I'm following an entry-level tutorial on rspec here, and I've created a very simple test at spec\lib\zombie_spec.rb:
require "spec_helper"
describe "A Zombie" do
#Your 'examples' (tests) go here.
...
1
vote
1
answer
222
views
Why does running my tests with ert-run-tests-batch-and-exit fail
I have written a few simple tests, when I run them on the buffer inside emacs everything passes.
However, when I run them in batch mode as shown below, it fails. What can explain this?
emacs -batch -...
4
votes
1
answer
406
views
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 ()
(...
0
votes
0
answers
76
views
Mutation testing for Emacs Lisp
What is the practice of mutation testing in Emacs Lisp?
Source file in question is haskell-indentation.el with test suite in haskell-indentation-tests.el
There are quite some strings in haskell-...
3
votes
0
answers
70
views
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 ...
7
votes
2
answers
1k
views
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 ...
1
vote
2
answers
150
views
Compile-run-navigate traceback without term mode
I have experimented with emacs' various shells (term in combination with compilation-mode in particular), and have had performance problems. For that reason I still use a separate terminal (e.g. ...
2
votes
1
answer
353
views
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 ...
0
votes
2
answers
209
views
How to get current file name when running under ERT?
I have a set of tests that involve loading files from the file-system and I would like to use the current filename to locate the test files relative to the test file.
The below code shows the pattern ...
2
votes
2
answers
142
views
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, ...
4
votes
1
answer
417
views
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
(...
2
votes
2
answers
286
views
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 ...
4
votes
2
answers
845
views
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 ...
2
votes
1
answer
170
views
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 ...
5
votes
3
answers
1k
views
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 ...