bdd

Is there an rspec test for exact length of an attribute?

浪尽此生 提交于 2020-12-04 17:21:07
问题 I'm trying to test the length of a zip code attribute to ensure its 5 characters long. Right now I'm testing to make sure its not blank and then too short with 4 characters and too long with 6 characters. Is there a way to test it being exactly 5 characters? So far I've found nothing online or in the rspec book. 回答1: If you're testing a validation on an ActiveRecord model, I recommend trying out shoulda-matchers . It provides a bunch of useful RSpec extensions useful for Rails. You could

Is it possible to create reusable and generic Specflow step definitions for multiple similar screens using page objects?

只谈情不闲聊 提交于 2020-05-15 10:18:06
问题 I am working on an app with many similar datatable / CRUD screens. I use Selenium with page objects pattern to navigate in the app, and object mothers to create predefined test data especially for forms with many inputs. While writing feature files, it occurred to me that the tests are so similar to each other and that it should be possible to generalize some common steps for the sake of reuse and DRYness. The DataTable page object was easy, since selectors are the same for all the pages. So

In behave, how do you run a scenario only?

别来无恙 提交于 2020-05-14 14:37:28
问题 I have a 'behave' feature that has a lot of tests on it. I only need to run a specific scenario for development needs. How do I do it? (preferably on the command line) 回答1: To run only a single scenario you can use -n with the name of the scenario: $ behave -n 'clicking the button "foo" should bar the baz' I'm using single quotes above to keep the name of the scenario as one argument for -n . Otherwise, the shell will pass each word of the scenario name as a separate argument. 回答2: If you

What is the “include” folder used for in a Katalon Studio project

扶醉桌前 提交于 2020-04-30 06:32:09
问题 Similarly to what is being asked in this question, which is yet without answer, I'm struggling to understand how should I properly use folders in a Katalon Studio project. In particular, so far I wasn't able to trigger creation of any file in the Include subfolders. Which files should I expect to find there? Depending on the answer, I can decide wether to put them under version control or go and default .gitignore to exclude Include . I watched the available tutorials, but so far I couldn't

【卡片记忆】iOS 单元测试查看覆盖率

主宰稳场 提交于 2020-03-03 21:29:39
###iOS 覆盖率 https://github.com/knight2010/XcodeCoverage ###定义API的需求 为添加到项目中的每个方法或者函数定义需求和结果非常重要。对于需求,包括输入和输出范 围,exceptions 抛出异常,条件限制,以及返回值的类型(尤其如果值是类的实例时)。定义 要求并确保满足代码中的需求可以帮助你编写出健壮的安全的代码。 ###边写边测 每当你设计和编写一个方法或函数时,就应该编写一个或多个测试用例来确保API的需求得到满 足。记住,为现有代码编写测试要比为你正在编写的代码难得多。 ###检查边界条件 如果对一个方法的参数值必须在特定范围内,你的测试应包括该范围的最低值和最高值。例 如,如果一个程序有一个整数参数,那么该参数值的范围要在 0 和 100 之间(包括首尾值), 该方法的测试代码应该为参数传递0,50和100这些值。 ###使用negative测试 negative 测试可以确保您的代码能适当地响应出错的条件。当收到无效的或意外的输入值时, 它可以验证代码的行为。同样的,还可以验证它返回错误代码或引发异常时的行为。例如,如 果一个整数参数范围必须为 0到100(包含首尾值),创建测试用例并传值 -1 和 101,以确保 该程序能引发一个异常或返回一个错误代码。 ###编写全面的测试用例

After Step and before Step Cucumber

本秂侑毒 提交于 2020-02-05 02:03:09
问题 I want to execute something before and after each step (not scenario). How do I do that in Cucumber ? Like the after and before in junit. ** I am using java. 回答1: There should be something like AfterStep (haven't found BeforeStep yet) AfterStep do #After every step #this is also before the next step... end If you want to filter these for certain steps, do AfterStep('@cucumis', '@sativus') do # This will only run after steps within scenarios tagged # with @cucumis AND @sativus. end Reference:

How to reuse scenarios within different features with rspec + capybara

荒凉一梦 提交于 2020-02-01 03:42:24
问题 Say I have some scenarios that I want to test under different contexts, or "features". For example, I have scenarios which involve the user visiting certain pages and expecting certain ajax results. But, under different conditions, or "features", I need to perform different "background" tasks which change the state of the app. In this case I need to run the same scenarios over and over again to make sure that everything works with the different changes to the state of the app. Is there a way

is there a way to use .feature file as input

只愿长相守 提交于 2020-01-25 17:51:33
问题 i'm currently trying to learn bdd techniques and trying frameworks for it. the idea comes from test to code, but i want to use it in revers way if possible. i'm currently using specflow, selenium and nunit combination. i want to open my work to anyone (non-developers) for adding new examples or test cases. let's say i have implemented all use cases but changing step orders or modifying/adding examples would enrich my test cases. the problem is that i have to build the project for each change

Karate: Query Param values are getting encoded

南楼画角 提交于 2020-01-25 11:24:30
问题 I am using karate 0.6.1 version and facing issue with get request with queryparam. Scenario Outline: Verify the response Data with account details when there are filter values are provided with wildcard Given params { <paramName>: <paramValue> } When method get Then status 200 Examples: | paramName | paramValue | | Name | 'Volvo%' | | Name | 'test data'| in the request url with queryparam becomes like url?Name=Volvo%25 And url?Name=test+data which is not correct, how should i resolve that.