-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate test engine #601
Comments
xml 格式 <root>
<config statement="true" preparestatement="true">
<execute >
<sql>
</sql>
</execute>
<executeUpdate>
<sql>
</sql>
</executeUpdate>
<executeQuery>
<sql>
</sql>
</executeQuery>
</config>
<check order="true">
<t_order order_id="1" order_id_type="int" user_id="1" user_id_type="int" />
</check>
</root> |
这个xml应该还需要讨论,主要有以下几点:
因此,我感觉一个xml的伪代码可能大致是: <asserts sharding-rule-config="xxx">
<assert id="" init-data-file="xxx" expected-data-file="xxx">
<sql></sql>
<parameters>
<parameter value="1" type="int">
<parameter value="test" type="String">
</parameters>
<parse-context>
<table />
<select-items />
<order-by-items />
<group-by-items />
... other context
</parse-context>
<assert/>
</asserts> |
我本来想分成多步走,第一步是,先代替 断言部分 ,所以没有包含 1和6 部分。 |
回答一下上面的问题: 另外,还有两个需求需要讨论
|
Integrate test engine's folder structure:
rule-name enum: sharding-tables, sharding-databases, sharding-databases-tables, master-slave, master-slave-sharding-tables, master-slave-sharding-databases, master-slave-sharding-databases-tables. assert-type example: simple-select, group-by-select, update, create, etc. |
xml example for init & expected: <dataset>
<metadata>
<table name="t_order">
<cloumn name="order_id" type="int" />
<cloumn name="user_id" type="int" />
<cloumn name="status" type="varchar" />
</table>
</metadata>
<data>
<t_order order_id="1600" user_id="16" status="init" />
<t_order order_id="1601" user_id="16" status="init" />
<t_order order_id="2600" user_id="26" status="init" />
<t_order order_id="2601" user_id="26" status="init" />
<t_order_item item_id="160001" order_id="1600" user_id="16" status="init" />
<t_order_item item_id="160002" order_id="1600" user_id="16" status="init" />
<t_order_item item_id="160101" order_id="1601" user_id="16" status="init" />
<t_order_item item_id="160102" order_id="1601" user_id="16" status="init" />
<t_order_item item_id="260001" order_id="2600" user_id="26" status="init" />
<t_order_item item_id="260002" order_id="2600" user_id="26" status="init" />
<t_order_item item_id="260101" order_id="2601" user_id="26" status="init" />
<t_order_item item_id="260102" order_id="2601" user_id="26" status="init" />
</data>
</dataset> |
xml example for assert: <asserts>
<assert id="test" expected-data-file="xxx.xml">
<sql>select order_id,user_id from t_order where order_id in (%s,%s,%s)</sql>
<parameters>
<parameter value="1000" type="int"/>
<parameter value="1101" type="int"/>
<parameter value="2200" type="int"/>
</parameters>
<parse-context>
<tables>
<table name="t_order" />
</tables>
<table-tokens>
<table-token begin-position="40" original-literals="t_order" />
</table-tokens>
<conditions>
...
</conditions>
</parse-context>
</assert>
<assert id="test2" expected-data-file="xxx.xml" expected-update-count="1">
<sql>update t_order set user_id = 10111 where order_id = %s</sql>
<expected-sql>select order_id,user_id from t_order where order_id = %s</expected-sql>
<parameters>
<parameter value="1000" type="int"/>
</parameters>
<parse-context>
...
</parse-context>
</assert>
</asserts> Load init-data automatically. |
目前Sharding-JDBC已经有一个自动测试框架,代码分为两部分:
但是功能仍有待提升,目前的大致想法:
因为测试框架目前还可以勉强使用,但仍有很大提升空间,因此征询志愿者领取任务,感兴趣的同学欢迎联系我。
The text was updated successfully, but these errors were encountered: