testing

pytest: how to make dedicated test directory

落爺英雄遲暮 提交于 2020-05-10 20:55:11
问题 I want the following project structure: |--folder/ | |--tests/ | |--project/ Let's write a simple example: |--test_pytest/ | |--tests/ | | |--test_sum.py | |--t_pytest/ | | |--sum.py | | |--__init__.py sum.py: def my_sum(a, b): return a + b test_sum.py: from t_pytest.sum import my_sum def test_my_sum(): assert my_sum(2, 2) == 5, "math still works" Let's run it: test_pytest$ py.test ./ ========== test session starts =========== platform linux -- Python 3.4.3, pytest-2.9.2, py-1.4.31, pluggy-0

bash command grouping for test results in function

瘦欲@ 提交于 2020-05-09 06:49:07
问题 I am accustomed to testing that a variable has a non-null value (or give a message and bail) using a line like this: test $variable || (echo "Value of \$variable cannot be null."; exit 1) I'm quite new to using functions in my scripts, but I've got a case where I need to be sure a non-null value is passed or bail out of the function. However the command grouping for the "or" case is not working the same way inside the function. I wrote this little test script to demonstrate: $ cat -n bubu.sh

Selenium - Difference between WebDriver.findElement() and WebElement.findElement()

纵然是瞬间 提交于 2020-05-08 05:26:29
问题 I was using WebElement.findElement(By.cssSelector('')).click(); to find an element on a page , but it returned "Unable to locate element" , But when I used WebDriver.findElement(By.cssSelector('')).click(); then it was able to find the element and clicked on it. I am unable to understand the difference between the findElement() of the two interfaces. Kindly Help. 回答1: WebElement.findElement() will use the element as the scope in which to search for your selector. This means it is generally

Selenium - Difference between WebDriver.findElement() and WebElement.findElement()

北城余情 提交于 2020-05-08 05:26:29
问题 I was using WebElement.findElement(By.cssSelector('')).click(); to find an element on a page , but it returned "Unable to locate element" , But when I used WebDriver.findElement(By.cssSelector('')).click(); then it was able to find the element and clicked on it. I am unable to understand the difference between the findElement() of the two interfaces. Kindly Help. 回答1: WebElement.findElement() will use the element as the scope in which to search for your selector. This means it is generally

Gradle: How to get output from test STDERR/STDOUT into console?

我的梦境 提交于 2020-05-07 10:43:11
问题 (Gradle 3.2.1) I run some java tests, which logs output in Stderr/Stdout. I can see that output, if I start gradle test --info but in that case, much of unwanted output from 3-rd party libraries is there too. Documentation suggests using logging.caputureStandardError / logging.caputureStandardError (loglevel) , but it doesn't seem to have any effect. tasks.withType(Test) { logging.captureStandardOutput LogLevel.QUIET logging.captureStandardError LogLevel.QUIET } Then if running gradle test ,

Gradle: How to get output from test STDERR/STDOUT into console?

做~自己de王妃 提交于 2020-05-07 10:43:06
问题 (Gradle 3.2.1) I run some java tests, which logs output in Stderr/Stdout. I can see that output, if I start gradle test --info but in that case, much of unwanted output from 3-rd party libraries is there too. Documentation suggests using logging.caputureStandardError / logging.caputureStandardError (loglevel) , but it doesn't seem to have any effect. tasks.withType(Test) { logging.captureStandardOutput LogLevel.QUIET logging.captureStandardError LogLevel.QUIET } Then if running gradle test ,

BeanCreationException: Error creating bean with name 'flywayInitializer'

懵懂的女人 提交于 2020-04-30 10:17:38
问题 I am trying to run my project tests in a docker container. All of the tests work just fine when running locally. Errors started occurring when I tried to move my testing to docker container. Here is the error message: java.lang.IllegalStateException: Failed to load ApplicationContext [...] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway

Getting Header overflow error while using testcafe

随声附和 提交于 2020-04-30 07:03:07
问题 Using testcafe for automated testing but i am getting the following error while perfoming a particular action(click of a button) Failed to perform a request to the resource at "https://www.example.com" because of an error. Error: Parse Error: Header overflow The application is working fine when we try to do the same action manually in the browser.But throws this error while doing it using testcafe. Tried using lower version of node also it doesn't help.can someone help with this? 来源: https:/