testing

Conditionally ignore nunit testcase

会有一股神秘感。 提交于 2020-08-24 07:58:28
问题 W.r.t. Nunit; Is there a mechanism to conditionally ignore a specific test case? Something in the lines of : [TestCase(1,2)] [TestCase(3,4, Ignore=true, IgnoreReason="Doesn't meet conditionA", Condition=IsConditionA())] public voidTestA(int a, int b) So is there any such mechanism or the only way to do so is to create separate test for each case and do Assert.Ignore in the test body? 回答1: You could add the following to the body of the test: if (a==3 && b == 4 && !IsConditionA()) { Assert

How to move tests into a separate file for binaries in Rust's Cargo?

家住魔仙堡 提交于 2020-08-21 09:52:15
问题 I created a new binary using Cargo: cargo new my_binary --bin A function in my_binary/src/main.rs can be used for a test: fn function_from_main() { println!("Test OK"); } #[test] fn my_test() { function_from_main(); } And cargo test -- --nocapture runs the test as expected. What's the most straightforward way to move this test into a separate file, (keeping function_from_main in my_binary/src/main.rs )? I tried to do this but am not sure how to make my_test call function_from_main from a

How to move tests into a separate file for binaries in Rust's Cargo?

*爱你&永不变心* 提交于 2020-08-21 09:47:52
问题 I created a new binary using Cargo: cargo new my_binary --bin A function in my_binary/src/main.rs can be used for a test: fn function_from_main() { println!("Test OK"); } #[test] fn my_test() { function_from_main(); } And cargo test -- --nocapture runs the test as expected. What's the most straightforward way to move this test into a separate file, (keeping function_from_main in my_binary/src/main.rs )? I tried to do this but am not sure how to make my_test call function_from_main from a

How to draw a Control Flow Graph from this code?

℡╲_俬逩灬. 提交于 2020-08-21 06:47:18
问题 int main() { int i, grade = 0; printf (" Enter points: \n"); scanf ("%d", &i); if (i >= 50 && i <= 60) grade = 5; else if (i > 50 && i <= 60) grade = 6; else if (i > 60 && i <= 70) grade = 7; else if (i > 70 && i <= 80) grade = 8; else if (i > 80 && i <= 90) grade = 9; else if (i > 90 && i <= 100) grade = 10; char sign = ' '; if (grade) { int p = i % 10; if (grade != 5) { if (p >= 1 && p <= 3) sign = '-'; else if (grade != 10 && (p >= 8 || p == 0)) sign = '+'; } printf (" The grade is %d%c.

JUnit testing SQL queries

 ̄綄美尐妖づ 提交于 2020-08-19 10:20:06
问题 I'm working on a project and we are required to create some test cases. I have a SQL database and parsing data there with queries like: public Contractor create(String name, String address, String email, String phone, String city, int cvr) throws SQLException{ Contractor contractor = new Contractor(name, address, email, phone, city, cvr); String sql = String.format("INSERT INTO person (name, address, email, phone, city, category) VALUES ('%s', '%s', '%s', '%s', '%s', 2)", name, address, email

Configure Pytest discovery to ignore class name

百般思念 提交于 2020-08-19 06:11:31
问题 Pytest's default discovery rules will import all Class starting with Test that do not have an __init__() . I have a situation where this causes an incorrect class to be imported. I am testing a django project that uses Factory Boy. http://factoryboy.readthedocs.org/en/latest/ to build out a Django model named Testimonial . like so: class TestimonialFactory(factory.Factory): class Meta: model = models.Testimonial This issue is that factory.Factory does not have an __init__() . So py.test sees

Configure Pytest discovery to ignore class name

本小妞迷上赌 提交于 2020-08-19 06:11:04
问题 Pytest's default discovery rules will import all Class starting with Test that do not have an __init__() . I have a situation where this causes an incorrect class to be imported. I am testing a django project that uses Factory Boy. http://factoryboy.readthedocs.org/en/latest/ to build out a Django model named Testimonial . like so: class TestimonialFactory(factory.Factory): class Meta: model = models.Testimonial This issue is that factory.Factory does not have an __init__() . So py.test sees

Configure Pytest discovery to ignore class name

て烟熏妆下的殇ゞ 提交于 2020-08-19 06:10:07
问题 Pytest's default discovery rules will import all Class starting with Test that do not have an __init__() . I have a situation where this causes an incorrect class to be imported. I am testing a django project that uses Factory Boy. http://factoryboy.readthedocs.org/en/latest/ to build out a Django model named Testimonial . like so: class TestimonialFactory(factory.Factory): class Meta: model = models.Testimonial This issue is that factory.Factory does not have an __init__() . So py.test sees

soapUI: multipart/form-data REST request with file attachments

十年热恋 提交于 2020-08-16 07:25:11
问题 I am using soapUI for testing a REST web service. Is there a way to attach a file with the other parameters in a multipart request? I see the attachment tab in the panel but I cannot give that attachment a parameter name so that server can identify. It's not helping. 回答1: I found it but forgot to post it here. It was not so intuitive. In your REST Request if you can see an attachment tab, open it and add and attachment with + button. The Name of that file would show full path. e.g. C:\temp\my

How to choose which test suite to run on my helm release

蓝咒 提交于 2020-08-10 19:34:48
问题 I want to run different test suites on my helm release in different (partly manual) CI jobs. How do I best execute these test suites from a CI job? Details: With a single test suite, helm test is very helpful. But how can I easily tell helm test which test suite to execute? Currently, I have only two test suites A and B and an environment variable SUITE I inject via helm install. The test job decides based on the value of SUITE which test suite to execute. But this injection is complex and I