codeforequity-at / botium-bindings

The Selenium for Chatbots
http://www.botium.at
MIT License
108 stars 33 forks source link

How to run single test? #95

Closed ikr0m closed 6 years ago

ikr0m commented 6 years ago

Now I'm running all tests like npm run test How can I run single test (single file?

codeforequity-at commented 6 years ago

Single files are not possible, but single directories. See this sample: https://github.com/codeforequity-at/testmybot/tree/master/samples/utterances

spec-folder contains three spec.js files, each pointing to another directory, starting jest pointing to just one of the files will run only testcases from single directory.

the sample is for jest, but can be easily adapted to mocha.

ikr0m commented 6 years ago

I'm not sure you're planning to add this feature but it's really necessary in real testing. Now I have got many tests and running all of them is not desired because it takes many minutes to finish all tests and it shortens my IBM Watson API calls. I keep only one file in directory and run tests. But it's not convenient to do manually.

Naktibalda commented 6 years ago

You could use --grep parameter of mocha: node node_modules/mocha/bin/mocha spec/ --exit --grep=name-fragment More about grep: http://www.petecorey.com/blog/2016/07/25/mochas-grep-flag/

codeforequity-at commented 6 years ago

Nice hint!

codeforequity-at commented 6 years ago

@ikr0m is this something you could use for your scenario ?

ikr0m commented 6 years ago

@Naktibalda @codeforequity-at Thank you guys, it works great! I've run above command in samples/watson folder. Small issue that mochawesome-report is not updated with last run test results. I can see test results in terminal. So far this is ok.